Python Forum
Problem with contourf plot and polar projection - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Problem with contourf plot and polar projection (/thread-20724.html)



Problem with contourf plot and polar projection - weihnachtsmo - Aug-27-2019

Hi,
I have a Problem drawing a plot with ploar coordinates.
I have the data in three columns (x,y and intensity). In cartesian coordinates, the data look as they should, but as soon I change the projection to ploar Things go weird (see Images).
I produced a meshgrid for the data and used a contourf plot. But also the tricontourf plot Looks the same.
    chi, phi, intensity = np.genfromtxt(f, unpack=True, skip_header = 5)
    intensity = intensity / max(intensity)
    chi_new = np.linspace(0, 85, 50)
    phi_new = np.linspace(0, 360, 50)
    
    chi_dense, phi_dense = np.meshgrid(chi_new, phi_new)
    grid = np.meshgrid(chi_new, phi_new)

    int_new = griddata(np.array([chi, phi]).T, intensity, (chi_dense, phi_dense), method='cubic')
    
    fig = plt.figure()
    ax = fig.add_subplot(1, 2, 1, projection='polar')
    ax.contourf(phi_dense, chi_dense, int_new, levels = np.linspace(0,1,50))
I think the Problem could be the connection between the data Points (see contour plot)

İmage


Anyone a glue what the Problem is About?

PS: How can I attach an Image of the figures or add the raw data?