0

I have two numpy array 'x' and 'y'. I get this scatter plot using 'matplotlib.pyplot.scatter(x,y)'.

enter image description here

Now, how can I get a matrix with binary values (1,0) that matches the scatter plot?

The matrix should be constructed as follows: if circle then 1 else 0

yatu
  • 86,083
  • 12
  • 84
  • 139
enne
  • 105
  • 1
  • 9
  • Could you better explain `if circle then 1 else 0`? – yatu Jun 20 '19 at 18:16
  • I mean a matrix that has value 1 at the coordinates where we see the dots. As if it were an image but instead of having value between 0 and 255 I only need 0 and 1 depending on the presence of the dot – enne Jun 20 '19 at 18:19
  • 1
    What you want is a 2D histogram. Have a look at https://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram2d.html. – user545424 Jun 20 '19 at 18:36
  • Thanks a lot. It works. – enne Jun 20 '19 at 19:08

0 Answers0