Matplotlib တွင် စာကြောင်းများစွာကို ဘယ်လိုဆွဲမလဲ။


အောက်ပါအထားအသိုကို အသုံးပြု၍ Matplotlib ကွက်ကွက်တစ်ခုတွင် လိုင်းများစွာကို သင်ပြသနိုင်သည်-

 import matplotlib. pyplot as plt

plt. plot (df[' column1 '])
plt. plot (df[' column2 '])
plt. plot (df[' column3 '])

...
plt. show ()

ဤသင်ခန်းစာတွင် အောက်ပါ pandas DataFrame ကို အသုံးပြု၍ ဇယားတစ်ခုတွင် လိုင်းများစွာကို ဘယ်လိုဆွဲရမလဲဆိုတာ ဥပမာများစွာကို ပေးသည် ။

 import numpy as np 
import pandas as pd

#make this example reproducible
n.p. random . seeds (0)

#create dataset
period = np. arange (1, 101, 1)
leads = np. random . uniform (1, 50, 100)
prospects = np. random . uniform (40, 80, 100)
sales = 60 + 2*period + np. random . normal (loc=0, scale=.5*period, size=100)
df = pd. DataFrame ({' period ': period, 
                   ' leads ': leads,
                   ' prospects ': prospects,
                   ' sales ': sales})

#view first 10 rows
df. head (10)


        period leads sales prospects
0 1 27.891862 67.112661 62.563318
1 2 36.044279 50.800319 62.920068
2 3 30.535405 69.407761 64.278797
3 4 27.699276 78.487542 67.124360
4 5 21.759085 49.950126 68.754919
5 6 32.648812 63.046293 77.788596
6 7 22.441773 63.681677 77.322973
7 8 44.696877 62.890076 76.350205
8 9 48.219475 48.923265 72.485540
9 10 19.788634 78.109960 84.221815

Matplotlib တွင် စာကြောင်းများစွာကို ရေးဆွဲပါ။

အောက်ပါကုဒ်သည် matplotlib ရှိ ကွက်ကွက်တစ်ခုတည်းတွင် လိုင်းသုံးလိုင်းစီကို မည်သို့ဆွဲရမည်ကို ပြသသည်-

 import matplotlib. pyplot as plt

#plot individual lines
plt. plot (df[' leads '])
plt. plot (df[' prospects '])
plt. plot (df[' sales '])

#displayplot
plt. show ()

Matplotlib ဇယားတွင် စာကြောင်းများစွာ

Matplotlib ရှိ လိုင်းများကို စိတ်ကြိုက်လုပ်ပါ။

စာကြောင်းတစ်ခုစီ၏ အရောင်၊ ပုံစံနှင့် အကျယ်ကိုလည်း စိတ်ကြိုက်ပြင်ဆင်နိုင်သည်-

 #plot individual lines with custom colors, styles, and widths
plt. plot (df[' leads '], color=' green ')
plt. plot (df[' prospects '], color=' steelblue ', linewidth= 4 )
plt. plot (df[' sales '], color=' purple ', linestyle=' dashed ')

#displayplot
plt. show () 

Matplotlib တွင် လိုင်းများစွာကို စိတ်ကြိုက်လုပ်ပါ။

Matplotlib တွင် ဒဏ္ဍာရီတစ်ခုကို ထည့်ပါ။

မျဉ်းကြောင်းများ ခွဲခြားရန် စာတန်းတစ်ခုကိုလည်း ထည့်နိုင်သည်။

 #plot individual lines with custom colors, styles, and widths
plt. plot (df[' leads '], label=' Leads ', color=' green ')
plt. plot (df[' prospects '], label=' Prospects ', color=' steelblue ', linewidth= 4 )
plt. plot (df[' sales '], label=' Sales ', color=' purple ', linestyle=' dashed ')

#add legend
plt. legend ()

#displayplot
plt. show () 

Matplotlib တွင် စာကြောင်းများစွာအတွက် ဒဏ္ဍာရီကို ထည့်ပါ။

Matplotlib တွင် ဝင်ရိုးအညွှန်းများနှင့် ခေါင်းစဉ်များထည့်ပါ။

နောက်ဆုံးတွင်၊ သင်သည် ကြံစည်မှုပြီးမြောက်ရန် ဝင်ရိုးအညွှန်းများနှင့် ခေါင်းစဉ်တစ်ခုကို ထည့်နိုင်သည်-

 #plot individual lines with custom colors, styles, and widths
plt. plot (df[' leads '], label=' Leads ', color=' green ')
plt. plot (df[' prospects '], label=' Prospects ', color=' steelblue ', linewidth= 4 )
plt. plot (df[' sales '], label=' Sales ', color=' purple ', linestyle=' dashed ')

#add legend
plt. legend ()

#add axis labels and a title
plt. ylabel (' Sales ', fontsize= 14 )
plt. xlabel (' Period ', fontsize= 14 )
plt. title (' Company Metrics ', fontsize= 16 )

#displayplot
plt. show () 

Matplotlib သင်ခန်းစာများကို ဤနေရာတွင် သင်ရှာဖွေနိုင်ပါသည်။

မှတ်ချက်တစ်ခုထည့်ပါ။

သင့် email လိပ်စာကို ဖော်ပြမည် မဟုတ်ပါ။ လိုအပ်သော ကွက်လပ်များကို * ဖြင့်မှတ်သားထားသည်