easyclimate.plot.bar¶
Bar plot for xarray dataset
Functions¶
Plot a bar chart with time for a 1D |
Module Contents¶
- easyclimate.plot.bar.bar_plot_with_threshold(da: xarray.DataArray, width=0.8, threshold: float = 0, pos_color: str = 'red', neg_color: str = 'blue', ax=None, **kwargs) matplotlib.container.BarContainer¶
Plot a bar chart with time for a 1D
xarray.DataArraywith bars colored based on a threshold value.Parameters:¶
- da
xarray.DataArray 1-dimensional data array to plot
- width:
floator array-like, default: 0.8 The width(s) of the bars.
Note
If x has units (e.g., datetime), then the width is converted to a multiple of the width relative to the difference units of the x values (e.g., time difference).
- threshold
float, optional Threshold value for color separation (default: 0)
- pos_color
str, optional Color for bars ≥ threshold (default: ‘red’)
- neg_color
str, optional Color for bars < threshold (default: ‘blue’)
- axmatplotlib axes, optional
Axes object to plot on (uses current axes if None)
- **kwargs :
Additional arguments passed to plt.bar
Returns:¶
- matplotlib.container.BarContainer
The bar plot object
See also
- da