.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_statistics.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_auto_examples_plot_statistics.py: Tutorial 02: Plot of statistical data ========================================= Example script to plot statistical maps, e.g. from correlation analysis .. GENERATED FROM PYTHON SOURCE LINES 6-61 .. code-block:: Python from surface_plot import plot_stats import numpy as np outdir = 'data/correlation/test_figures' clobber = False # Load data pval_left = np.loadtxt('https://www.dropbox.com/s/re39ocqymw63gqo/left.pval?dl=1', skiprows=1) pval_right = np.loadtxt('https://www.dropbox.com/s/a73z66wmori6vtj/right.pval?dl=1', skiprows=1) tval_left = np.loadtxt('https://www.dropbox.com/s/tv5fei9w37x7lw5/left.tval?dl=1', skiprows=1) tval_right = np.loadtxt('https://www.dropbox.com/s/as9hfcezvfm9ux8/right.tval?dl=1', skiprows=1) tval = {'left': tval_left, 'right': tval_right} pval = {'left': pval_left, 'right': pval_right} # Define degrees of freedom (specific to the example data) df = 19 # Define statistic threshold p_threshold = 0.01 # --- Plot p-values --- for cbar_loc in ['left', 'bottom', None]: # Plot two-tailed pval (i.e. without knowing wheter its is right- or left tailed) output = f'{outdir}/pval_twotailed_cbar_{cbar_loc}_p{p_threshold}.pdf' plot_stats.plot_pval(pval, output, p_threshold=p_threshold, cbar_loc=cbar_loc, clobber=clobber) # Plot seperate one-tailed pval (i.e. one plot with right tail (positive) and one plot with left tail (negative)) output = f'{outdir}/pval_onetailed_cbar_{cbar_loc}_p{p_threshold}.pdf' plot_stats.plot_pval(pval, output, tval=tval, p_threshold=p_threshold, cbar_loc=cbar_loc, clobber=clobber) # --- Plot t-values --- t_threshold = 2.5 p_threshold = 0.01 cbar_loc = 'left' # Plot t-values with automatic limits output = f'{outdir}/tval_autolim_cbar_{cbar_loc}_t{t_threshold}.pdf' plot_stats.plot_tval(tval, output, t_threshold=t_threshold, cbar_loc=cbar_loc, clobber=clobber) # Plot t-values with predetermined limits t_lim = [-3, 3] output = f'{outdir}/tval_withlim_cbar_{cbar_loc}_t{t_threshold}.pdf' plot_stats.plot_tval(tval, output, t_lim=t_lim, t_threshold=0, cbar_loc=cbar_loc, clobber=clobber) # Plot t-values with p_threshold and calculated p-values output = f'{outdir}/tval_withpval_cbar_{cbar_loc}_p{p_threshold}.pdf' plot_stats.plot_tval(tval, output, p_threshold=p_threshold, pval=pval, cbar_loc=cbar_loc, clobber=clobber) # Plot t-values with p_threshold and df, two-tailed output = f'{outdir}/tval_withdf_twotailed_cbar_{cbar_loc}_p{p_threshold}.pdf' plot_stats.plot_tval(tval, output, p_threshold=p_threshold, df=df, cbar_loc=cbar_loc, clobber=clobber) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 7.972 seconds) .. _sphx_glr_download_auto_examples_plot_statistics.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_statistics.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_statistics.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_statistics.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_