in CODE4ALL

Create Area chart

import matplotlib.pyplot as plt
import numpy as np
x=[1,2,3,4,5]
y1=[1,1,2,3,5]
y2=[0,4,2,6,8]
y3=[1,3,5,7,9]
y=np.vstack([y1,y2,y3])
labels=[“Fibonacci”, “Event”, “Odds”]
fig, ax=plt.subplots()
ax.stackplot(x,y1,y2,y3,labels=labels)
ax.legend(loc=’upper left’)
plt.show()

y2=[1,0,1;1,4,3;2,2,5;3,6,7;5,8,9]
area(y2)
title(‘Chart in Matlab by Huy’)
legend (‘Fibonacci’ , ‘Event’,’Odds’ , ‘Location’ , ‘northwest’ )

note:

matrix ngược so với chuỗi

northwest, southwest: vị trí

https://ww2.mathworks.cn/en/products/matlab/plot-gallery.html

Write a Comment

Comment