-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
bugSomething isn't workingSomething isn't working
Description
There is a dualx funcitonality that could be very useful in labelling the wavelength and wavenumber simultaneously. Here is an example from a paper:
The x-axis at the bottom shows the wavenumber (cycle per km) while the one at the top shows the wavelength (km), as wavenumber = 1 / wavelength.
I tried this with the following simple codes:
import ultraplot as uplt
import numpy as np
import xarray as xr
data = xr.DataArray(np.random.randn(100)+2, dims=['wn'], coords={'wn':np.logspace(-2, 2, 100)})
fig, axes = uplt.subplots(figsize=(5,4))
ax = axes[0]
ax.plot(data)
ax.set_xscale('log')
ax.set_yscale('log')
ax.format(xformatter='log')
ax.set_xlabel('wavenumber (cycle per km)')
ax.dualx(
lambda x: 1 / x,
label="length scale (km)",
formatter="log",
grid=True,
color='k',
gridcolor='k',
)which shows
It is a bit strange to me that the two x-axes do not align exactly. Just want to know how to do this correctly. Thanks very much.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working