How to make a chart with 3 y-axes using matplotlib in python
HTML-код
- Опубликовано: 19 дек 2021
- import matplotlib.pyplot as plt
fig, ax1 = plt.subplots()
years = [2018,2019,2020,2021]
first = [1,2,1,2]
second = [10,15,17,11]
third = [111,120,117,129]
ax1.plot(years,first,color="blue")
ax2 = ax1.twinx()
ax2.plot(years,second,color="green")
ax3 = ax1.twinx()
ax3.plot(years,third,color="red")
#ax3.spines['right'].set_position(('outward',60))
ax3.spines['right'].set_position(('axes',1.15))
ax1.set_ylabel("First",color="blue")
ax2.set_ylabel("Second",color="green")
ax3.set_ylabel("Third",color="red")
ax1.tick_params(axis='y',colors="blue")
ax2.tick_params(axis='y',colors="green")
ax3.tick_params(axis='y',colors="red")
ax2.spines['right'].set_color("green")
ax3.spines['right'].set_color("red")
ax3.spines['left'].set_color("blue")
plt.show()
#fig.tight_layout()
fig.savefig("3-axis-v3.png",bbox_inches='tight') Наука
Great work!, truly appreciate your work. Looking forward to your next python /matplotlip video s
Simple and straightforward, thank you
Very very useful video, simple & clear.Thank you!
Great work. kindly appreciated. very easy to follow and well explained at each stages.
Very nice solution, learned something new thanks!
thank you , your explain is very awesome
this really helps!! thanks alot!!!!!!!
Very helpful...thanks
Thank you very much!!!! blessings
Hello\ pls tell me how to restart Endnotes from each chapter in MS 2007? I have to complete the thesis. I want to insert Endnotes at the end of the Introduction only, but when I insert them, it goes to the end of the thesis. How to solve this problem. pls tell
Very well explained and very useful! How would you make the distance between marks of the 3 axes the same? (for example, that the width between marks is 1 cm). I can't find a way to solve it. thank you!!
Thank you so much.
شكرا جزيلاً اختي العزيزة
have we got the same for js ??
Matplotlib can plot 1 Xaxie and 6 y-axies?
How can i add legend title to this type of code?
Thx!!!
how can make map of track of altimetry satellite
Can we make this for x?
Thank you it helps me a lot :))