Note
Go to the end to download the full example code.
Line Chart Formatting#
Line charts have different options to control styling behavior. Options are arguments passed to a given series in the chart function.
Use
colorto control the color of the series. The color names match options from Ernie and our YD style guide.By default the series mode is set to lines for a line chart
The shape argument can control the line shape. The options are
dashfor long dashes,dotfor short dashes, orsplinefor smooth curve lines.The mode argument can also be set to
markersfor plotting only data points andlines+markersto display both lines and markers at the data point.By default, line charts are solid lines with no markers or smoothing.
import pandas as pd
from visualization_toolkit.helpers.plotly import chart, axis, series
fig = chart(
pdf,
x_axis=axis(column_name="fiscal_qy", label="Fiscal Quarter"),
y1_axis=axis(label="Downloads", axis_type="number"),
chart_series=[
series(
column_name="ucan",
label="UCAN",
color="dark-blue",
shape="dash",
),
series(
column_name="china",
label="China",
color="light-blue",
shape="spline",
),
series(
column_name="india",
label="India",
color="green",
mode="lines+markers",
),
series(
column_name="asia_ex_china",
label="Asia ex. China",
color="yellow",
shape="dot",
),
series(
column_name="other",
label="Other",
color="red",
mode="markers",
),
],
)
fig
Total running time of the script: (0 minutes 0.022 seconds)