简体   繁体   中英

Rotate entire y-axis 45 degrees (triangular plot) - Matplotlib

What I have is:

在此处输入图像描述

But what I want is (paint mockup):

在此处输入图像描述

Is there any function matplotlib to perform this axis rotation? The code I used to produce the plot is this:

X = np.linspace(1 * 10**5, 100 * 10**5, 300)
Y = np.linspace(1 * 10**5, 100 * 10**5, 300)

fig = plt.contourf(X,Y,data,levels=10) # data is NaN for upper left triangle

plt.colorbar()
plt.savefig('output.png')

plt.yticks(rotation=45) should help for your case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM