.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "recipes/axes/plot_date_axis_start.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_recipes_axes_plot_date_axis_start.py: Truncate X-axis and Y-Axis --------------------------- Charts can be truncated on either axis by specifying an ``axis_min`` or ``axis_max`` as ``axis`` arguments. This will limit the plot area to the specified range of values. - The values should be the same data type as the series being plotted on it. - For example, the x-axis is a ``date`` type, python ``date`` objects should be used to limit the bounds - Notice that the data of the series is bound to the overall x-axis min and max .. caution:: For y-axes, the ``axis_min`` and ``axis_max`` values are supported but with a caveat. If the series goes beyond these bounds, the bounds will automatically modified to include the series max or min. This is to ensure that series data does not escape the plot area. .. GENERATED FROM PYTHON SOURCE LINES 18-51 .. rst-class:: sphx-glr-script-out .. code-block:: none /home/runner/work/visualization_toolkit/visualization_toolkit/visualization_toolkit/helpers/plotly/charts/core/chart.py:651: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy .. raw:: html


| .. code-block:: Python import pandas as pd from datetime import date from dateutil.relativedelta import relativedelta from visualization_toolkit.helpers.plotly import chart, axis, series fig = chart( pdf, x_axis=axis( column_name="day", axis_type="date", label="Week Ending", tick_interval=relativedelta(days=7 * 6), axis_min=date(2024, 6, 30), axis_max=date(2024, 10, 20), ), chart_series=[ series( column_name="abnb_gbv_share", label="ABNB GBV Share", color="dark-blue", ), ], y1_axis=axis( axis_type="percent", axis_min=0, axis_max=1, tick_format="0.0%", ), ) fig .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.021 seconds) .. _sphx_glr_download_recipes_axes_plot_date_axis_start.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_date_axis_start.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_date_axis_start.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_date_axis_start.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_