1

I have a plot and would like to emphazise the low-value regions to see how the values change there. I was thinking of using a gamma-function (gamma<1), such that y = x^(gamma), with x being the old value and y being the new value. This ensures to strengthen the lower values and make the high values less important. My problem is that then also my colorbar is changed, although I would like to have the old values, that are x = y^(1/gamma).
The pcolormesh function can solve this problem.
Since I am using discrete data, I would prefer the contourf function. Here is my code:

umu = [0.99999,0.99452,0.98481,0.96593,0.93969,0.90631,0.86603,0.81915,0.76604,0.70711,
       0.64279,0.57358,0.50000,0.42262,0.34202,0.25882,0.17365,0.08716,0.00000]    
umu=umu[::-1]
umu = np.multiply(umu,-1)
umu = arccos(umu)  
umu = pi-umu 

phi = np.arange(0,375,15)
phi = phi*pi/180
   
vmin, vmax = 0, max_DoP 
levels = np.linspace(vmin,vmax,100)

max_DoP = max(DoP)

fig = figure(figsize=(8,8))
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True)
contourf(phi*pi/180, umu*180/pi, DoP, cmap=cm.jet, levels=levels, vmax=vmax, vmin=vmin)
plt.rc('font', size=32)
ax.grid(linewidth=2)
ax.xaxis.set_tick_params(pad=28)
plt.colorbar(orientation="vertical",fraction=0.09,anchor=(2.0,0.0))
savefig('DoP.png')

Plot

DoP is a (19*25)-matrix containing values from 0 to 55 that is read in from an Excel file.

Do you have an idea how I can have the transformed y values in the plot with the old x values at the colorbar?
Thanks for your help!

Yannick
  • 11
  • 2
  • what are your values for max_DoP and DoP? I'm trying to re-create your problem. -Thanks – personaltest25 Sep 14 '21 at 08:51
  • @personaltest25 Thanks for your answer! I edited my post and added the azimuth and zenith angles for the polar plot. The DoP is a 19*25 matrix containing values from 0 to 55. – Yannick Sep 14 '21 at 10:24

0 Answers0