datascience.tables.Table.plot¶
- Table.plot(column_for_xticks=None, select=None, overlay=True, width=None, height=None, **vargs)[source]¶
Plot line charts for the table. Redirects to
Table#iplot
for plotly charts if interactive plots are enabled withTable#interactive_plots
- Args:
column_for_xticks (
str/array
): A column containing x-axis labels- Kwargs:
- overlay (bool): create a chart with one color per data column;
if False, each plot 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.plot.
See http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.plot for additional arguments that can be passed into vargs.
- Raises:
ValueError – Every selected column must be numerical.
- Returns:
Returns a line plot (connected scatter). Each plot is labeled using the values in column_for_xticks and one plot is produced for all other columns in self (or for the columns designated by select).
>>> table = Table().with_columns( ... 'days', make_array(0, 1, 2, 3, 4, 5), ... 'price', make_array(90.5, 90.00, 83.00, 95.50, 82.00, 82.00), ... 'projection', make_array(90.75, 82.00, 82.50, 82.50, 83.00, 82.50)) >>> table days | price | projection 0 | 90.5 | 90.75 1 | 90 | 82 2 | 83 | 82.5 3 | 95.5 | 82.5 4 | 82 | 83 5 | 82 | 82.5 >>> table.plot('days') <line graph with days as x-axis and lines for price and projection> >>> table.plot('days', overlay=False) <line graph with days as x-axis and line for price> <line graph with days as x-axis and line for projection> >>> table.plot('days', 'price') <line graph with days as x-axis and line for price>