MCPcopy Create free account
hub / github.com/spotify/chartify / _second_axis_example

Function _second_axis_example

chartify/examples.py:1086–1112  ·  view source on GitHub ↗

Docstring

(price_by_date)

Source from the content-addressed store, hash-verified

1084
1085@_print_source
1086def _second_axis_example(price_by_date):
1087 """Docstring"""
1088 # Initialize chart with second_y_axis=True
1089 ch = chartify.Chart(
1090 blank_labels=True,
1091 x_axis_type="datetime",
1092 y_axis_type="linear",
1093 second_y_axis=True,
1094 )
1095 ch.set_title("Second Y axis")
1096 # Plot the first axis
1097 ch.plot.line(data_frame=price_by_date, x_column="date", y_column="total_price")
1098 ch.axes.set_yaxis_range(0, 50)
1099 ch.axes.set_yaxis_label("First axis label")
1100 ch.axes.set_yaxis_tick_format("0a")
1101
1102 # Plot the second axis
1103 ch.second_axis.axes.set_yaxis_range(0, 80)
1104 ch.second_axis.axes.set_yaxis_label("Second axis label")
1105 ch.second_axis.plot.line(
1106 # Data must be sorted by x column
1107 data_frame=price_by_date,
1108 x_column="date",
1109 y_column="triple_total_price",
1110 )
1111 ch.second_axis.axes.set_yaxis_tick_format("0.0")
1112 ch.show(_OUTPUT_FORMAT)
1113
1114
1115@_print_source

Callers 1

chart_second_axisFunction · 0.85

Calls 6

set_titleMethod · 0.95
showMethod · 0.95
set_yaxis_rangeMethod · 0.80
set_yaxis_labelMethod · 0.80
set_yaxis_tick_formatMethod · 0.80
lineMethod · 0.45

Tested by

no test coverage detected