1

I have some function f(x,y) --> z

The range of x is small, typically ~0.1 -1

The range of y is large, typically 1e8 - 1e14

The output of the function z also has a large range, from ~ 1e25 - 1e45

What is the best way to plot this function in Python?

Clearly I need some kind of logarithmic axes, but log scaling 3d plots in matplotlib lib is an issue (see here)

I have tried a colorbar plot, e.g.

fig, ax = plt.subplots()
x = np.linspace(1e8,1e14,500)
y = np.linspace(0.01,1,500)
X,Y = np.meshgrid(x,y)
Z = process(X,Y).T
im = plt.imshow(Z,cmap=cm.RdBu,norm=LogNorm())
im.set_interpolation('bilinear')
cb = fig.colorbar(im) 

But the colours tend to 'wash out', e.g. the plot is mostly composed of just one colour and the x/y ticks go weird due to the normalisation which I have not found a way to fix.

Any ideas?

Community
  • 1
  • 1
user1887919
  • 829
  • 2
  • 9
  • 24

0 Answers0