Hello,
I am struggling with a potentially easy problem in matplotlib: I have
some 2D data
which I visualize using matplotlibs contour function. However, besides the
contour lines itself I want to visualize the underlying grid as well
which I do by setting ticks for
each data point on x and y axis and setting the tick labels to void:
figure()
ax=gca()
ax.set_aspect('equal')
xax=ax.xaxis
xax.set_ticks(X[0,:])
xax.set_ticklabels('')
yax=ax.yaxis
yax.set_ticks(Y[:,0])
yax.set_ticklabels('')
contour(X,Y,g,0,linewidth=4)
ax.grid(color='r', linestyle='', linewidth=1)
Here, X, Y are the coordinates of my grid created with
X, Y = np.meshgrid(X, Y)
So far everything is fine and I have my grid. However, I also want to
have some tick labels
on the x and y axis. I tried that using twinx() but that has the result
that
i) the aspect ratio is lost (which I have set with ax.set_aspect('equal'))
ii) the gridlines are reset to the major ticks of the newly created
axis.
How can I achieve both: i) having my 2D grid vizualized and ii) having some
ticks and labels along the x and y axis.
Thanks for any help and greetings from Sweden
Michael
