Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to use matplotlib to make a "3D cloud plot"?

I have a chart that I made - it's a 3D scatterplot, with 2000 data points plotted per colour. Please see chart below:

enter image description here

I used matplotlib's 3D scatter plot to make this.

I was wondering if there's a way to make this into a "cloud" plot of sorts? Sort of like a bounding cloud/box that envelopes where all (or the majority) of the blue or green points lie. My goal is to visualize the separation between the two colours. Granted, that is possible now, but I thought maybe a "cloud" plot might be clearer?

As I was unable to find anything on these kinds of plots using raw data, I have yet to code anything up.

like image 541
ericmjl Avatar asked Nov 28 '25 09:11

ericmjl


1 Answers

Not exactly a cloud, but more of an idea: you may use scipy.interpolate.interp2d, to interpolate your data on denser mesh. Then plot the data with:

  • larger marker size: say s=200
  • lower alpha, say alpha=.1
  • a color-map which changes to white in the middle, say cmap='PRGn'

then

 ax.scatter(xs, ys, zs, c=zs, marker='D', s=200, alpha=.1, cmap='PRGn')

would give you this:

cloud

like image 80
behzad.nouri Avatar answered Nov 30 '25 00:11

behzad.nouri