3.7-jadval - Boxstyle parametrlari
Sinf
Ism
Xususiyatlar
Tashqi ko'rinish
Doira
doira
pad = 0,3
DArrow
darrow
pad = 0,3
LArrow
tomoq
pad = 0,3
RArrow
siyrak
pad = 0,3
Dumaloq
dumaloq
yostiq = 0,3,
rounding_size = Hech narsa
4-tur
dumaloq4
yostiq = 0,3,
rounding_size = Hech narsa
Dumaloq tish
yostiq = 0,3,
tish_size = Hech narsa
Sawtooth
arra tishlari
yostiq = 0,3,
tish_size = Hech narsa
Kvadrat
kvadrat
pad = 0,3
Yozuvning foniga misol:
matplotlib.patches- dan FancyBboxPatch-ni import qiladi
bbox_properties = dict (
boxstyle = "rarrow, pad = 0.3" ,
ec = 'g' , fc = 'r' ,
ls = '-' ,
lw = 3
)
(plt.title "Sarlavha" , Shrift = 17 , bbox = bbox_properties, o'rnini = ( 0.5 ,
0.85 ))
plt.plot ( oraliq ( 0 , 10 ), oraliq ( 0 , 10 ))
65
3.23-rasm - Yozuvning fonini o'rnatish misoli
3.5 Ranglar paneli - rangli panel
Agar siz ranglarni taqsimlashni rejalashtirmoqchi bo'lsangiz
colormesh (), pcolor (), imshow () va boshqalar, keyin namoyish qilish uchun
sizga kerak bo'lishi mumkin rang va raqamli qiymat
Matplotlib-da colorbar deb nomlangan afsonaning analogi . Yarataylik
np.random.rand () va displey yordamida tasodifiy tarqatish
pcolor () orqali:
np sifatida numpy- ni import qilish
np.random.seed ( 123 )
vals = np.random.randint ( 10 , size = ( 7 , 7 ))
plt.pcolor (vals)
3.24-rasm - Ranglarni taqsimlash
66
Keling , ushbu to'plam uchun ranglar panelini yarataylik :
np.random.seed ( 123 )
vals = np.random.randint ( 10 , size = ( 7 , 7 ))
plt.pcolor (vals)
plt.colorbar ()
3.25-rasm - Berilgan rang uchun ranglar paneli
tarqatish
Rang satrida ranglarni alohida ajratish uchun sizga kerak
kerakli rang sxemasini taqdim etish
tegishli funktsiyaga cmap parametri (bizning holatimizda, pcolor ()):
np.random.seed ( 123 )
vals = np.random.randint ( 10 , size = ( 7 , 7 ))
plt.pcolor (vals, cmap = plt.get_cmap ( 'viridis' , 11 ))
plt.colorbar ()
Do'stlaringiz bilan baham: |