.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_examples\visualization\plot_graphics_table_graph.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__examples_visualization_plot_graphics_table_graph.py: Graphics TableGraph example ============================ .. GENERATED FROM PYTHON SOURCE LINES 5-81 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /_examples/visualization/images/sphx_glr_plot_graphics_table_graph_001.png :alt: Column 0, c1, Column 2 :srcset: /_examples/visualization/images/sphx_glr_plot_graphics_table_graph_001.png :class: sphx-glr-multi-img * .. image-sg:: /_examples/visualization/images/sphx_glr_plot_graphics_table_graph_002.png :alt: 0, 1, Column 2 :srcset: /_examples/visualization/images/sphx_glr_plot_graphics_table_graph_002.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none Data: c0 c1 c2 0 95 83 57 1 8 52 31 2 43 3 89 3 56 57 64 4 92 57 3 5 63 21 74 6 85 2 53 7 63 80 44 8 58 57 10 9 89 41 92 10 29 85 7 11 93 56 90 12 71 55 64 13 76 53 88 14 15 22 56 15 48 18 13 16 28 84 6 17 8 61 54 18 13 89 73 19 74 27 88 | .. code-block:: default :lineno-start: 5 import os import sys import json import copy import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import matplotlib.colors as colors import matplotlib.patches as mpatches import matplotlib.gridspec as gridspec from scipy import interp from matplotlib.colors import ListedColormap from pyamr.graphics.table_graph import TableGraph """ Example of axis configuration ----------------------------- { 'ax': None, 'ax_kwargs': { 'title':'Example 1', 'xlim':None, 'xsym':False, 'xticks':None, 'xline':[{'xv':0.05, 'bg':-1.0, 'cb':'y'}], }, 'cmap_kwargs': { 'vmin':None, 'vmax':None, 'vsym':False, 'cmap':'RdBu_r', 'midpoint':2.5 }, 'scatter_kwargs': { 's':80, 'linewidths':0.75, 'edgecolor':'gray' } } """ # Create data data = np.random.randint(100, size=(20, 3)) dataframe = pd.DataFrame(data) dataframe.columns = ['c0', 'c1', 'c2'] # Show print("\nData:") print(dataframe) # Create column configurations c0 = TableGraph().get_map_config(title='Column 0', cmap='Reds') c2 = TableGraph().get_map_config(title='Column 2', cmap='RdBu_r', midpoint=50, xticks=[20, 40, 60, 80], xline=[{'xv': 25, 'bg': 0}, {'xv': 75, 'bg': 100, 'cb': 'y'}]) # Create configuration config = {} config['c0'] = c0 config[2] = c2 # Example with a DataFrame axes = TableGraph().plot(data=dataframe, configuration=config) plt.tight_layout() # Example with numpy array axes = TableGraph().plot(data=data, configuration=config) plt.tight_layout() # Show. plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.388 seconds) .. _sphx_glr_download__examples_visualization_plot_graphics_table_graph.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_graphics_table_graph.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_graphics_table_graph.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_