Skip to main content
Version: Python

plot_style

plot_style alters the style of a XY series and category charts.

Syntax

plot_style(style)

Parameters

ParameterTypeDescription
stylestr

The plot style to apply. The following options are available:

  • BAR
  • STACKED_BAR
  • LINE
  • AREA
  • STACKED_AREA
  • SCATTER
  • STEP

These arguments are case insensitive.

Examples

The following example creates a single series plot using the STACKED_BAR style.

from deephaven import read_csv
from deephaven.plot.figure import Figure
from deephaven.plot import PlotStyle

# source the data
source = read_csv(
"https://media.githubusercontent.com/media/deephaven/examples/main/MetricCentury/csv/metriccentury.csv"
)

# apply a plot style
plot_single_stacked_area = (
Figure()
.axes(plot_style=PlotStyle.STACKED_BAR)
.plot_xy(series_name="Heart_rate", t=source, x="Time", y="HeartRate")
.show()
)

The following example creates a category plot with the stacked_bar style.

from deephaven import new_table
from deephaven.column import string_col, int_col
from deephaven.plot.figure import Figure
from deephaven.plot import PlotStyle

source_one = new_table(
[string_col("Categories", ["A", "B", "C"]), int_col("Values", [1, 3, 5])]
)

source_two = new_table(
[string_col("Categories", ["A", "B", "C"]), int_col("Values", [2, 4, 6])]
)

result = (
Figure()
.axes(plot_style=PlotStyle.STACKED_BAR)
.plot_cat(series_name="source_one", t=source_one, category="Categories", y="Values")
.plot_cat(series_name="source_two", t=source_two, category="Categories", y="Values")
.show()
)