I have some (synthetic) stochastic data generated from a model with two parameters (e.g., I'm generating many numbers from a negative binomial distribution with parameters $n$ and $p$ --- that's close enough to what I'm doing). One parameter is continuous (non-negative reals) and the other takes positive integer values.

I calculate the probability density for the original parameters based on the observed data with standard techniques.

Then I want to visualize this density. At present I'm using contour plots. I don't like them because they suggest that both directions are continuous. In the plots I show, the horizontal axis takes just the discrete values 1, ..., 10. (ignore the dashed and dotted lines and focus on the contour lines). The contour lines seem to allow for values between these discrete values.

Is there a better way I can visualize this data? (bonus if you can say how to visualize them in Python, but I can probably figure that out myself).

enter image description here


Here are three ways to emphasize the discreteness of n.

  1. Draw your contour lines as step lines (flat for each integer and connected by vertical lines)
  2. Draw a heatmap colored by the result with rectangles that as small in the p dimension and 1-sized (or separated) in the n dimension.
  3. Plot the result versus p (both continuous) with a separate line for each n value: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.