Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can calculate a histogram (2D) of the x, y values using numpy's <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram2d.html" rel="nofollow noreferrer">histogram2d</a> method. Then you plot the array that is true for all non-zero bins and false for all zero bins. You can control the resolution of the histogram using the <code>bins</code> parameter. This method returns a tuple of 3 arrays: the 2D histogram and two 1D arrays corresponding the bin steps along each 'edge' (x then y). You can control the step values using the <code>range</code> parameter.</p> <p>For example:</p> <pre><code>import matplotlib.pyplot as plt import numpy as np np.random.seed(101) x = np.random.normal(0,1,10000) y = np.random.normal(0,1,10000) hist,xedge,yedge= np.histogram2d(x,y,bins=100,range=[[-4,4],[-4,4]]) plt.imshow(hist==0, origin='lower', cmap=plt.gray(), extent=[xedge[0],xedge[-1],yedge[0],yedge[-1]]) plt.savefig('hist2d.png') plt.show() </code></pre> <p>This results in:</p> <p><img src="https://i.stack.imgur.com/HjK0b.png" alt="enter image description here"></p> <p>The black points show where you have any data, the white points are where there is no data. The histogram is presented using the <code>imshow</code> method, which is used to plot images or matrices. By default it set's the origin to the top left, so you will either want to change the parameter <code>origin='lower'</code>, or you want to appropriately adjust the <code>extent</code> parameter, which controls the range values: [intial x, final x, initial y, final y]. You can control the color scheme by adjusting the <a href="http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.colormaps" rel="nofollow noreferrer">color map</a>.</p> <p>As @joaquin mentions in the comments, you can also simply plot <code>imshow(hist)</code> to see the full range of values (heatmap), rather than 0 or 1.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload