Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
118 views
in Technique[技术] by (71.8m points)

python - What is the equivalent of Matlab "axis xy" in Matplotlib?

I'm trying to plot a soundfield both in matlab and python but if Matlab allows me to do like this:

imagesc(x,y,real(sf_vsrc)); colorbar;
axis xy
title('soundfield ground truth');

enter image description here

using python I'm doing like this:

plt.imshow(sf_vsrc_gt,extent=[x[0],x[-1],y[0],y[-1]])
plt.colorbar()
plt.show()

enter image description here

Indeed, in Matlb if I don't put "axis xy" I have the same plot as python, so how can I put "axis xy" in python to have the same result as Matlab?

question from:https://stackoverflow.com/questions/65870495/what-is-the-equivalent-of-matlab-axis-xy-in-matplotlib

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can change it via an optional input:

plt.imshow(sf_vsrc_gt,extent=[x[0],x[-1],y[0],y[-1]], origin='lower')

or by later playing with the extent and origin properties.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...