Issue
I make a plot using pcolormesh
and it turns out like this:
Then, I tried to set the argument shading = 'gouraud'
, but the result looks blurry:
To make the picture clear, I also tried to interpolate
the data to a smaller meshgrid. Unfortunately, it doesn' work.
So I want to know what I should do to make my plot looks smoother and clearer.
Solution
Here I use a gaussian filter to smooth the data and make the plot look clearer.
First, plot the original data, plt.pcolormesh(x, Y, Z)
, and the result shows:
Then, let the data pass through a gaussian filter Z2 = ndimage.gaussian_filter(Z, sigma=1.0, order=0)
. And plot the result plt.contourf(X, Y, Z2, levels = 10)
to give:
This would make the figure look clear while capturing the main distribution features of the data.
Hope it helps!
Answered By - Feng Hu
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.