datascience.tables.Table.barh¶
-
Table.
barh
(column_for_categories=None, select=None, overlay=True, **vargs)[source]¶ Plot horizontal bar charts for the table.
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).
Every selected except column for column_for_categories must be numerical.
- Args:
- column_for_categories (str): A column containing y-axis categories
- Kwargs:
- overlay (bool): create a chart with one color per data column;
- if False, each will be displayed separately.
- 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.
>>> t = Table().with_columns([ ... 'Furniture', ['chairs', 'tables', 'desks'], ... 'Count', [6, 1, 2], ... 'Price', [10, 20, 30] ... ]) >>> t Furniture | Count | Price chairs | 6 | 10 tables | 1 | 20 desks | 2 | 30 >>> furniture_table.barh('Furniture') <bar graph with furniture as categories and bars for count and price> >>> furniture_table.barh('Furniture', 'Price') <bar graph with furniture as categories and bars for price> >>> furniture_table.barh('Furniture', [1, 2]) <bar graph with furniture as categories and bars for count and price>