

.. _sphx_glr_gallery_lines_bars_and_markers_scatter_profile.py:


===============
Scatter Profile
===============

Generate a scatterplot.


=====   =======   =============   =============
N       Classic   Base renderer   Ext renderer
=====   =======   =============   =============
20      0.22      0.14            0.14
100     0.16      0.14            0.13
1000    0.45      0.26            0.17
10000   3.30      1.31            0.53
50000   19.30     6.53            1.98
=====   =======   =============   =============





.. image:: /gallery/lines_bars_and_markers/images/sphx_glr_scatter_profile_001.png
    :align: center


.. rst-class:: sphx-glr-script-out

 Out::

    20 symbols in 0.03 s
    100 symbols in 0.00 s
    1000 symbols in 0.01 s
    10000 symbols in 0.02 s
    50000 symbols in 0.08 s




|


.. code-block:: python

    from __future__ import print_function  # only needed for python 2.x
    import matplotlib.pyplot as plt
    import numpy as np

    import time

    # Fixing random state for reproducibility
    np.random.seed(19680801)


    for N in (20, 100, 1000, 10000, 50000):
        tstart = time.time()
        x = 0.9 * np.random.rand(N)
        y = 0.9 * np.random.rand(N)
        s = 20 * np.random.rand(N)
        plt.scatter(x, y, s)
        print('%d symbols in %1.2f s' % (N, time.time() - tstart))

**Total running time of the script:** ( 0 minutes  0.144 seconds)



.. container:: sphx-glr-footer


  .. container:: sphx-glr-download

     :download:`Download Python source code: scatter_profile.py <scatter_profile.py>`



  .. container:: sphx-glr-download

     :download:`Download Jupyter notebook: scatter_profile.ipynb <scatter_profile.ipynb>`

.. rst-class:: sphx-glr-signature

    `Generated by Sphinx-Gallery <https://sphinx-gallery.readthedocs.io>`_
