.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "sources/visualisation/bar_line.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_sources_visualisation_bar_line.py: Bar Line Charts =============== .. GENERATED FROM PYTHON SOURCE LINES 7-48 Bar-line charts, which combine `bar charts `_ and `line charts `_, can be generated using the :py:func:`~isaricanalytics.visualisation.fig_bar_line_chart` function, which returns a :py:class:`Plotly Go Figure ` object. The plot below was generated using a synthetic dataset of monthly and cumulative patient enrolment data for a clinical site. The dataset is given below as a table (but can also be loaded from the static :file:`examples/csv/bar_line.csv` file). .. list-table:: Monthly and cumulative patient enrolment at a clinical site between January and June, 2026 :header-rows: 1 :widths: auto * - Month-Year - Patient Enrolment - Cumulative Patient Enrolment * - January 2026 - 2 - 2 * - February 2026 - 8 - 10 * - March 2026 - 50 - 60 * - April 2026 - 20 - 80 * - May 2026 - 15 - 95 * - June 2026 - 5 - 100 In addition to the data(frame) itself, note some of the other key columns required for the :py:func:`~isaricanalytics.visualisation.fig_bar_line` function: * ``"xlabel"`` - the ``x``-axis label * ``"ylabel_left"`` - the left ``y``-axis label, which should correspond to the bar column (see below) * ``"ylabel_right"`` - the right ``y``-axis label, which should correspond to the line column (see below) * ``"bar_column"`` - the column representing the bar values, which should be labelled with ``"ylabel_left"`` * ``"line_column"`` - the column representing the line values, which should be labelled with ``"ylabel_right"`` Here are the Python steps you need to generate the plot using the :py:func:`~isaricanalytics.visualisation.fig_bar_line_chart` function: .. GENERATED FROM PYTHON SOURCE LINES 48-68 .. code-block:: Python :lineno-start: 48 import pandas as pd from isaricanalytics.visualisation import fig_bar_line_chart # Load the CSV data = pd.read_csv("./csv/bar_line.csv") # Create and display the figure fig = fig_bar_line_chart( data, title="Bar-Line Chart of Monthly and Cumulative Patient Enrolment", xlabel="Month-Year", ylabel_left="Cumulative Patients Enrolled", ylabel_right="Patients Enrolled", bar_column="cum_patients_enrolled", line_column="patients_enrolled", index_column="month_year" ) fig.update_layout(autosize=True) fig .. raw:: html .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 69-80 .. note:: Any dataframe or CSV column names, or dictionary field labels, in the example above that are not specific to the dataset must be as given, otherwise the function may throw an exception or return an incorrect figure. The figure height and width parameters can be set using the ``height`` and ``width`` parameters, but it may be more convenient to let Plotly handle this using the figure layout `autosize `_ parameter. Refer to the :py:func:`~isaricanalytics.visualisation.fig_sunburst` function docstring for more information. .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.218 seconds) .. _sphx_glr_download_sources_visualisation_bar_line.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: bar_line.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: bar_line.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: bar_line.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_