ggplot(sun.spct) +
geom_line() +
scale_x_wl_continuous(sec.axis = sec_axis_w_number())
# Secondary axes can be added to plots built with autoplot() methods
autoplot(sun.spct) +
scale_x_wl_continuous(sec.axis = sec_axis_w_number())
# Using 'ggplot2' scale
ggplot(sun.spct) +
geom_line() +
scale_x_continuous(name = w_length_label(),
sec.axis = sec_axis_w_number())
# change scale multipliers, SI defined
ggplot(sun.spct) +
geom_line() +
scale_x_wl_continuous(-6, sec.axis = sec_axis_w_number(-3))
# change scale multipliers, not SI defined (best avoided)
ggplot(sun.spct) +
geom_line() +
scale_x_wl_continuous(-8, sec.axis = sec_axis_w_number(-4))
# Change quantity name to Spanish
ggplot(sun.spct) +
geom_line() +
scale_x_wl_continuous(label.text = "Longitud de onda,",
sec.axis = sec_axis_w_frequency(label.text = "Frecuencia,"))
# Frequency in secondary axis
ggplot(sun.spct) +
geom_line() +
scale_x_wl_continuous(sec.axis = sec_axis_w_frequency())
# Energy (per photon) in atto joules
ggplot(sun.spct) +
geom_line() +
scale_x_wl_continuous(sec.axis = sec_axis_energy_J())
# Energy (per photon) in electron volts
ggplot(sun.spct) +
geom_line() +
scale_x_wl_continuous(sec.axis = sec_axis_energy_eV())
# Secondary axis with wavelength using a different scale factor
ggplot(sun.spct) +
geom_line() +
scale_x_wl_continuous(sec.axis = sec_axis_wl(-6))
# Secondary axes can be added to plots built with autoplot() methods
autoplot(sun.spct) +
scale_x_wl_continuous(sec.axis = sec_axis_wl(-6))
Run the code above in your browser using DataLab