.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "recipes/chart_context/plot_shaded_region.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_chart_context_plot_shaded_region.py: Shaded Regions --------------------------- Shaded regions can be used to call attention to general section of the chart. The ``shaded_regions`` argument is used to define these areas. Pass in a list of ``shade_x`` or ``shade_y`` instances. Similar to annotations they use an inverval of values to position the shaded area along its axis. - The shaded region ``start`` and ``end`` values control its position. .. GENERATED FROM PYTHON SOURCE LINES 13-57 .. raw:: html


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