datascience.tables.Table.barh

Table.barh(column_for_categories=None, select=None, overlay=True, width=None, **vargs)[source]

Plot horizontal bar charts for the table. Redirects to Table#ibarh if interactive plots are enabled with Table#interactive_plots

Args:
column_for_categories (str): A column containing y-axis categories

used to create buckets for bar chart.

Kwargs:
overlay (bool): create a chart with one color per data column;

if False, each will be displayed separately.

show (bool): whether to show the figure if using interactive plots; if false, the

figure is returned instead

vargs: Additional arguments that get passed into plt.barh.

See http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.barh for additional arguments that can be passed into vargs.

Raises:
ValueError – Every selected except column for column_for_categories

must be numerical.

Returns:

Horizontal bar graph with buckets specified by column_for_categories. Each plot is labeled using the values in column_for_categories and one plot is produced for every other column (or for the columns designated by select).

>>> t = Table().with_columns(
...     'Furniture', make_array('chairs', 'tables', 'desks'),
...     'Count', make_array(6, 1, 2),
...     'Price', make_array(10, 20, 30)
...     )
>>> t
Furniture | Count | Price
chairs    | 6     | 10
tables    | 1     | 20
desks     | 2     | 30
>>> t.barh('Furniture') 
<bar graph with furniture as categories and bars for count and price>
>>> t.barh('Furniture', 'Price') 
<bar graph with furniture as categories and bars for price>
>>> t.barh('Furniture', make_array(1, 2)) 
<bar graph with furniture as categories and bars for count and price>