.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "11_demos\python_packages\seaborn\demo_bivariate.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_11_demos_python_packages_seaborn_demo_bivariate.py: Bivariate ============ .. GENERATED FROM PYTHON SOURCE LINES 5-24 .. image-sg:: /11_demos/python_packages/seaborn/images/sphx_glr_demo_bivariate_001.png :alt: demo bivariate :srcset: /11_demos/python_packages/seaborn/images/sphx_glr_demo_bivariate_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none | .. code-block:: Python import numpy as np import seaborn as sns import matplotlib.pyplot as plt sns.set_theme(style="dark") # Simulate data from a bivariate Gaussian n = 10000 mean = [0, 0] cov = [(2, 0.4), (0.4, 0.2)] rng = np.random.RandomState(0) x, y = rng.multivariate_normal(mean, cov, n).T # Draw a combo histogram and scatterplot with density contours f, ax = plt.subplots(figsize=(6, 6)) sns.scatterplot(x=x, y=y, s=5, color=".15") sns.histplot(x=x, y=y, bins=50, pthresh=0.1, cmap="mako") sns.kdeplot(x=x, y=y, levels=5, color="w", linewidths=1) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 15.003 seconds) .. _sphx_glr_download_11_demos_python_packages_seaborn_demo_bivariate.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: demo_bivariate.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: demo_bivariate.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: demo_bivariate.zip `