Multiple axes related questions

Hello,

Please consider my attached examples. hw3.py nicely produces multiple axes electromagnetic spectrum with solar and terrestrial radiation plotted using Planck’s function. However, the major and minor ticks placements are not nice in those plots and I have decided to use the new axis_grid1 interface. In the original hw3.py I do multiple plots of desired unit (e.g. wavelength to wavenumber etc…) I am quite sure that the units shown in the hw3.py are correctly converted. Now I am planning to produce these conversions with mpl transformations. Then test1-hw3.py comes into view once again.

Can someone possibly (JJ) give little hint here as to converting from wavelength to wavenumber using Affine2D and correctly see the ticks located as the main x-axis.

I do lots of extra lines to get this one working properly in the hw3.py as shown below:

multi x-axes

first wavenumber in cm^-1

parx = ax1.twiny()

parx.axis[“top”].set_visible(False)

offset = 0, -60

new_axisline = parx.get_grid_helper().new_fixed_axis

parx.axis[“bottom”] = new_axisline(loc=“bottom”, axes=parx, offset=offset)

parx.axis[“bottom”].label.set_visible(True)

parx.axis[“bottom”].label.set_text(u"Wavenumber, cm⁻¹")

parx.axis[“bottom”].label.set_fontsize(16)

line1, = parx.plot(1/(wavelength[1:]*100), np.ones(len(wavelength[1:])))

line1.set_visible(0)

parx.set_xlim(xmin=1e10,xmax=1/1e6)

parx.set_xscale(‘log’)

Thanks.

hw3.py (8.54 KB)

test1-hw3.py (2.33 KB)

···


Gökhan