.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "packages/statistics/auto_examples/plot_paired_boxplots.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_packages_statistics_auto_examples_plot_paired_boxplots.py: Boxplots and paired differences ================================================= Plot boxplots for FSIQ, PIQ, and the paired difference between the two: while the spread (error bars) for FSIQ and PIQ are very large, there is a systematic (common) effect due to the subjects. This effect is cancelled out in the difference and the spread of the difference ("paired" by subject) is much smaller than the spread of the individual measures. .. GENERATED FROM PYTHON SOURCE LINES 12-29 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /packages/statistics/auto_examples/images/sphx_glr_plot_paired_boxplots_001.png :alt: plot paired boxplots :srcset: /packages/statistics/auto_examples/images/sphx_glr_plot_paired_boxplots_001.png :class: sphx-glr-multi-img * .. image-sg:: /packages/statistics/auto_examples/images/sphx_glr_plot_paired_boxplots_002.png :alt: plot paired boxplots :srcset: /packages/statistics/auto_examples/images/sphx_glr_plot_paired_boxplots_002.png :class: sphx-glr-multi-img .. code-block:: Python import pandas import matplotlib.pyplot as plt data = pandas.read_csv("brain_size.csv", sep=";", na_values=".") # Box plot of FSIQ and PIQ (different measures od IQ) plt.figure(figsize=(4, 3)) data.boxplot(column=["FSIQ", "PIQ"]) # Boxplot of the difference plt.figure(figsize=(4, 3)) plt.boxplot(data["FSIQ"] - data["PIQ"]) plt.xticks((1,), ("FSIQ - PIQ",)) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.073 seconds) .. _sphx_glr_download_packages_statistics_auto_examples_plot_paired_boxplots.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_paired_boxplots.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_paired_boxplots.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_paired_boxplots.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_