.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "plot_types/statistical/density_scatter.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_plot_types_statistical_density_scatter.py: Density Scatter Plot -------------------- The following example shows how to create a density scatter plot. .. GENERATED FROM PYTHON SOURCE LINES 8-44 .. image-sg:: /plot_types/statistical/images/sphx_glr_density_scatter_001.png :alt: Density Scatter Plot :srcset: /plot_types/statistical/images/sphx_glr_density_scatter_001.png :class: sphx-glr-single-img .. code-block:: Python import numpy as np import matplotlib.pyplot as plt from emcpy.plots.plots import Scatter from emcpy.plots.create_plots import CreatePlot, CreateFigure def main(): # Create test data x = np.random.normal(size=1000) y = x * 10 + np.random.normal(size=1000) # Create Scatter object sctr1 = Scatter(x, y) # Add density scatter feature in object sctr1.density_scatter() # Create plot object and add features plot1 = CreatePlot() plot1.plot_layers = [sctr1] plot1.add_title(label='Density Scatter Plot') plot1.add_xlabel(xlabel='X Axis Label') plot1.add_ylabel(ylabel='Y Axis Label') plot1.add_legend() # Create figure fig = CreateFigure() fig.plot_list = [plot1] fig.create_figure() plt.show() if __name__ == '__main__': main() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.077 seconds) .. _sphx_glr_download_plot_types_statistical_density_scatter.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: density_scatter.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: density_scatter.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_