Simple Bar Chart#
A basic bar chart showing the count of items in each category. This example uses a small pandas DataFrame to demonstrate categorical bar plots.
import pandas as pd
import hvplot.pandas # noqa
df = pd.DataFrame({
'category': ['A', 'B', 'C', 'A', 'B', 'C', 'A', 'B', 'C', 'A'],
})
counts = df['category'].value_counts().sort_index()
counts.hvplot.bar(title='Simple Bar Chart (Bokeh)', xlabel='Category', ylabel='Count')
import pandas as pd
import hvplot.pandas # noqa
hvplot.extension('matplotlib')
df = pd.DataFrame({
'category': ['A', 'B', 'C', 'A', 'B', 'C', 'A', 'B', 'C', 'A'],
})
counts = df['category'].value_counts().sort_index()
counts.hvplot.bar(title='Simple Bar Chart (Matplotlib)', xlabel='Category', ylabel='Count')
See also
Categorical section for more complex bar plots.
This web page was generated from a Jupyter notebook and not all
interactivity will work on this website.