0

I have a scatter plot plt.scatter(x, y, z) where x, y and z are 1D arrays. The sum of z over all (x,y) points adds to unity.

enter image description here

How would I create confidence contours such that the contours enclose sums of 0.95 and 0.68 respectively?

Here is a visual I pulled off the web illustrating what I'm going for, if the contours in the image represented the total value of z enclosed to be 0.95 and 0.68.

enter image description here

astromonerd
  • 907
  • 1
  • 15
  • 32
  • 3
    A good place to start is searching... e.g. [make contour of scatter](http://stackoverflow.com/questions/18764814/make-contour-of-scatter) – DilithiumMatrix Dec 22 '15 at 01:57
  • The contour approach as described in the documentation does not work because I am not interested in the contours of the values, but in the contours of the sums of the values. Or if it does, then I could not find it in the documentation, which is why I asked the question here. My needs were met by making another scatter plot with the sums of the values. I'm still not sure how I would superimpose contours from the summed scatter plot over the un-summed scatter plot. – astromonerd Jan 06 '16 at 22:25
  • That's what contours ***are*** - they enclose a certain fraction of the total. They are defined by the constant-value of the function which they are drawn at, so if you want `95%`, then you need to calculate the height of the function within which `95%` is enclosed (around the medians). If you are still having trouble with that, it might be more appropriate for the statistics stack exchange site (it doesn't have to do with the programming per se, its about the math). – DilithiumMatrix Jan 07 '16 at 02:46
  • It may be a technical definition between fields: I agree that contours are constant-values of a function, though not necessarily constant-values of fractions enclosed. A better way I could have asked my question would have been to ask if there were any built in functions to transform the Z array containing values into a Z array containing fractions. But in the end it was as simple as normalizing and cumsum'ing the array and then following the procedure as described in the link you provided. – astromonerd Jan 08 '16 at 00:37

0 Answers0