def _second_axis_example()

in chartify/examples.py [0:0]


def _second_axis_example(price_by_date):
    """Docstring"""
    # Initialize chart with second_y_axis=True
    ch = chartify.Chart(
        blank_labels=True,
        x_axis_type="datetime",
        y_axis_type="linear",
        second_y_axis=True,
    )
    ch.set_title("Second Y axis")
    # Plot the first axis
    ch.plot.line(data_frame=price_by_date, x_column="date", y_column="total_price")
    ch.axes.set_yaxis_range(0, 50)
    ch.axes.set_yaxis_label("First axis label")
    ch.axes.set_yaxis_tick_format("0a")

    # Plot the second axis
    ch.second_axis.axes.set_yaxis_range(0, 80)
    ch.second_axis.axes.set_yaxis_label("Second axis label")
    ch.second_axis.plot.line(
        # Data must be sorted by x column
        data_frame=price_by_date,
        x_column="date",
        y_column="triple_total_price",
    )
    ch.second_axis.axes.set_yaxis_tick_format("0.0")
    ch.show(_OUTPUT_FORMAT)