Cheat Sheet : Plotting with Matplotlib using Pandas Plot Type Description Pandas Function Example Visual Line Plot Shows trends and changes over time DataFrame.plot.line() DataFrame.plot(kind = ‘line’) df.plot(x=’year’, y=’sales’, kind=’line’) Area Plot Displays data series as filled areas, showing the relationship between them DataFrame.plot.area() DataFrame.plot(kind = ‘area’) df.plot(kind='area') Histogram Displays bars representing the data count in each interval/bin Series.plot.hist() Series.plot(kind = ‘hist’, bins = n) s.plot(kind='hist', bins=10) df[‘age’].plot(kind='hist', bins=10) Bar Chart Displays data using rectangular bars DataFrame.plot.bar() DataFrame.plot(kind = ‘bar’) df.plot(kind='bar') Pie Chart Displays data as a circular plot divided into slices, representing proportions or percentages of a whole Series.plot.pie() Series.plot(kind = ‘pie’) DataFrame.plot.pie(y, labels) DataFrame.plot(kind = ‘pie’) s.plot(kind='pie’,autopct=...
Comments
Post a Comment