MCPcopy Create free account
hub / github.com/holoviz/hvplot / bar

Method bar

hvplot/plotting/core.py:828–887  ·  view source on GitHub ↗

A vertical bar plot A `bar` plot represents categorical data with rectangular bars with heights proportional to the values that they represent. The x-axis represents the categories and the y axis represents the value scale. The bars are of equal width which

(self, x=None, y=None, stacked=False, **kwds)

Source from the content-addressed store, hash-verified

826 )
827
828 def bar(self, x=None, y=None, stacked=False, **kwds):
829 """
830 A vertical bar plot
831
832 A `bar` plot represents categorical data with rectangular bars
833 with heights proportional to the values that they represent. The x-axis
834 represents the categories and the y axis represents the value scale.
835 The bars are of equal width which allows for instant comparison of data.
836
837 Reference: https://hvplot.holoviz.org/ref/api/manual/hvplot.hvPlot.bar.html
838
839 Plotting options: https://hvplot.holoviz.org/ref/plotting_options/index.html
840
841 Parameters
842 ----------
843 x : string, optional
844 Field name to draw x-positions from. If not specified, the index is used.
845 y : string, optional
846 Field name to draw y-positions from. If not specified, all numerical
847 fields are used.
848 stacked : bool, optional
849 If True, creates a stacked bar plot. Default is False.
850 color : str or array-like, optional.
851 The color for each of the series. Possible values are:
852
853 The name of the field to draw the colors from. The field can contain numerical values or strings
854 representing colors.
855
856 A single color string referred to by name, RGB or RGBA code, for instance 'red' or
857 '#a98d19'.
858
859 A sequence of color strings referred to by name, RGB or RGBA code, which will be used
860 for each series recursively. For instance ['red', 'green','blue'].
861 **kwds : optional
862 Additional keywords arguments are documented in :ref:`plot-options`.
863 Run ``hvplot.help('bar')`` for the full method documentation.
864
865 Returns
866 -------
867 :class:`holoviews:holoviews.element.Bars` / Panel object
868 You can `print` the object to study its composition and run:
869
870 .. code-block::
871
872 import holoviews as hv
873 hv.help(the_holoviews_object)
874
875 to learn more about its parameters and options.
876
877 References
878 ----------
879
880 - Bokeh: https://docs.bokeh.org/en/latest/docs/reference/models/glyphs/vbar.html
881 - HoloViews: https://holoviews.org/reference/elements/bokeh/Bars.html
882 - Matplotlib: https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.bar.html
883 - Pandas: https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.plot.bar.html
884 - Plotly: https://plotly.com/python/bar-charts/
885 - Wiki: https://en.wikipedia.org/wiki/Bar_chart

Callers 1

Calls

no outgoing calls

Tested by 1