## matplotlib-users

 [Matplotlib-users] Logscale on polar plot and alpha as an array From: Pim Schellart - 2010-05-04 16:19:11 ```Hi Everyone, I am currently building an interactive display using matplotlib but I need the following two options. 1. Setting the r axis of a polar plot to logaritmic scale. 2. Setting alpha for each point individually (preferably by giving alpha an array of the same length as the data containing a value between zero and one). Is this currently possible and if not which alternative approach do you recommend. The display needs to plot about a thousand points (using scatter at the moment) roughly updating every second with older points fading away (lower value of alpha). Kind regards, Pim Schellart ```
 Re: [Matplotlib-users] Logscale on polar plot and alpha as an array From: Michael Droettboom - 2010-05-04 16:34:01 ```Pim Schellart wrote: > Hi Everyone, > > I am currently building an interactive display using matplotlib but I > need the following two options. > 1. Setting the r axis of a polar plot to logaritmic scale. > axis.set_rscale('log') > 2. Setting alpha for each point individually (preferably by giving > alpha an array of the same length as the data containing a value > between zero and one). > Is this currently possible and if not which alternative approach do > you recommend. > You can't give alpha an array, but you can create an Nx4 RGBA array (which will let you control the color individually, too). For example: r = np.arange(0, 3.0, 0.01) theta = 2*np.pi*r c = np.zeros((len(r), 4)) c[:,0:3] = (1, 0, 0) # red c[:,3] = np.arange(0, 1.0, 1.0 / len(r)) ax.scatter(theta, r, c=c, lw=0) > The display needs to plot about a thousand points (using scatter at > the moment) roughly updating every second with older points fading > away (lower value of alpha). > Scatter is pretty heavily optimized in the *Agg backends, but not so much in the others. Make sure you are using Agg and IIRC this level of performance should be possible (depending on machine etc., of course). Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA ```