title: Python Matplotlib nonlinear scaling in contour plot
body: <p>I'm having some trouble visualizing a certain dataset that I have in a contour plot. The issue is that I have a bunch of datapoints (X,Y,Z) for which the Z values range from about 2 to 0, where a lot of the interesting features are located in the 0 to 0.3 range. Using a normal scaling, they are very difficult to see, as illustrated in this image:</p>
  
  <p><img src="https://i.stack.imgur.com/7O8hH.png" alt="http://i.stack.imgur.com/7O8hH.png"></p>
  
  <p>Now, I have thought about what else to do. Of course there is logarithmic scaling, but then I first need to think about some sort of mapping, and I am not 100% sure how one would do that. Inspired by <a href="https://mathematica.stackexchange.com/questions/36830/logarithmic-scale-in-a-densityplot-and-its-legend">this question</a> one could think of a mapping of the type <code>scaling(x) = Log(x/min)/Log(max/min)</code> which worked reasonably well in that question.</p>
  
  <p>Also interesting was the followup <a href="https://mathematica.stackexchange.com/questions/102132/how-can-i-make-a-density-plot-or-contour-plot-with-an-arbitrary-nonlinear-scal">discussed here</a>.</p>
  
  <p>where they used some sort of <code>ArcSinh</code> scaling function. That seemed to enlarge the small features quite well, proportionally to the whole. </p>
  
  <p>So my question is two fold in a way I suppose. </p>
  
  <ol>
  <li><p>How would one scale the data in my contour plot in such a way that the small amplitude features do not get blown away by the outliers?</p></li>
  <li><p>Would you do it using either of the methods mentioned above, or using something completely different? </p></li>
  </ol>
  
  <p>I am rather new to python and I am constantly amazed by all the things that are already out there, so I am sure there might be a built in way that is better than anything I mentioned above.</p>
  
  <p>For completeness I uploaded the <a href="https://rbfi.io/dl.php?key=/X3sF/ThreeQubitRess44SpecHighResNormalFreqs.npy" rel="nofollow noreferrer">datafile here</a>  (the upload site is robustfiles.com, which a quick google search told me is a trustworthy website to share things like these)</p>
  
  <p>I plotted the above with </p>
  
  <pre><code>data = np.load("D:\SavedData\ThreeQubitRess44SpecHighResNormalFreqs.npy")
  
  fig, (ax1) = plt.subplots(1,figsize=(16,16))    
  cs = ax1.contourf(X, Y, data, 210, alpha=1,cmap='jet')
  fig.colorbar(cs, ax=ax1, shrink=0.9)
  ax1.set_title("Freq vs B")
  ax1.set_ylabel('Frequency (GHz)'); ax1.set_xlabel('B (arb.)')
  </code></pre>