4

I have a scatter plot where I am coloring each data point based on an array:

 plt.scatter(xs,ys,c=av,cmap=plt.cm.hot,s=50,alpha=0.5)

In [96]: xs.shape
Out[96]: (5594,)

In [97]: ys.shape
Out[97]: (5594,)

In [98]: av.shape
Out[98]: (5594,)

and this is the result: Current

Now, I want to keep the color but smooth the data points to get a smoothed scatter plot, something like this (from this post) or this image:

Desired

Comment: I figured that if I can add more points to my xs, ys, zs I can make the scatter plot with more data points, hence, it will look more like a heatmap plot, which is what I want. Now, for every point in xs, ys, zs, I want to add additional points with similar values around original points. Ideally, these additional points should form a normal distribution around actual original points in the xs, ys, zs. Is there a statistical tools to do this task? E.g. How to change [1, 5, 10] to [0.9,0.98,1,1.02,1.1, 4.9,4.98,5,5.02,5.1, 9.9,9.98,10,10.02,10.1] ?

A.Razavi
  • 479
  • 2
  • 8
  • 19

1 Answers1

0

OP: Is there a statistical tools to do this task? E.g. How to change [1, 5, 10] to [0.9,0.98,1,1.02,1.1, 4.9,4.98,5,5.02,5.1, 9.9,9.98,10,10.02,10.1] ?

obs=[1, 5 ,10]

syntheticobs=np.random.normal(0,0.1,(6,3))+obs
synthethicobs

Out[]:array([[ 1.02166209,  5.00716569,  9.96726293],
             [ 0.96727493,  4.94823697, 10.03424305],
             [ 1.10756036,  5.12464335,  9.86776082],
             [ 0.97866246,  5.12743117, 10.06647638],
             [ 0.87842188,  5.00994338, 10.1114983 ],
             [ 1.10728294,  4.82523615, 10.03642462]])
CAPSLOCK
  • 6,243
  • 3
  • 33
  • 56
  • Please expand your answer to include a detailed explanation on how this solves the issue – Sterling Archer Mar 22 '19 at 16:24
  • Well removing the edge will give a smoother feeling to the picture but imho the question isn't really clear.. My guess is either this or OP wants to reduce the "spread" of the colormap. I'm not sure why anyone would want that thou – CAPSLOCK Mar 22 '19 at 21:53