Al_Iskander Al_Iskander - 1 year ago 99
Python Question

Plot bar chart from pandas dataframe

I have following pandas dataframe that I would like to plot the

values as a
bar plot
in matplotlib:


Close 1 Close 2 Close 3 Close 4 Close 5 Close 6
NaN 0.000348 0.000975 0.001450 0.001923 0.002483 0.002916
high 0.001416 -0.000215 0.000058 0.000026 -0.000766 -0.000255

The labels on the x-axis shall be the column names. How can this be done?

Many thanks in advance.

Answer Source

you can plot transposed DF:

In [9]: import matplotlib

In [10]:
Out[10]: <matplotlib.axes._subplots.AxesSubplot at 0xa1ae240>

enter image description here

with vertical labels:

In [14]:, alpha=0.6, figsize=(14,12))
Out[14]: <matplotlib.axes._subplots.AxesSubplot at 0xa3499e8>

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download