Xarray: How does Xarray plot a bar chart?

Created on 21 Apr 2016  路  2Comments  路  Source: pydata/xarray

How can I plot a bar chart from a Python Xarray dataset (eg. rain data axis)?

I am already using this code to resize the plot

fig, ax = plt.subplots(figsize=(9, 9))
dsfanadia.rain.plot(ax=ax)

Thank you

plotting usage question

Most helpful comment

@hugo-pires -

xarray's plotting module does not have a bar chart method at this time (api ref). You can, of course, export your data array to a pandas series and use the pandas bar chart. Psudo code...


fig, ax = plt.subplots(figsize=(9, 9))
rain_series = dsfanadia.rain.to_series()
rain_series.plot.bar(ax=ax)

All 2 comments

@hugo-pires -

xarray's plotting module does not have a bar chart method at this time (api ref). You can, of course, export your data array to a pandas series and use the pandas bar chart. Psudo code...


fig, ax = plt.subplots(figsize=(9, 9))
rain_series = dsfanadia.rain.to_series()
rain_series.plot.bar(ax=ax)

Thank you.

Was this page helpful?
0 / 5 - 0 ratings