You might want to try out different plotting backends. Some might already do what you want - though you might have to use backend-specific code to get that to work.
Example: inspectdr() backend
InspectDR already does scientific notation that way. Actually, it displays using what is called “engineering notation” by default: it only displays powers that are multiples of 3 (…, x10^-6, x10^-3, x10^-0, x10^3, x10^6, …). But you can switch it to real “scientific notation” and display intermediate powers (like x10^4) as well.
Here are a few examples:
SI labels
Note that the bottom plot was configured to display time using so-called “SI notation” instead of “engineering notation”. The x-axis label is set to “n” - which, of course is equivalent to x10^-9.
Configuring axis labels
The bottom-most plot uses a “plot template” called transientplot()
(defined in src/templates.jl). It is used to overwrite the default “engineering notation” in order to display SI units through the NumericIO.jl module:
plot.layout[:format_xtick] = TickLabelStyle(NumericIO.UEXPONENT_SI)
plot.layout[:format_ytick] = TickLabelStyle(NumericIO.UEXPONENT_SI)
Note that there are other formats available, including different versions of engineering/scientific formats that can display the multiplication factor as one of the following:
E-3
x10-3
×10⁻³
(Using UTF8 characters (more aesthetically pleasing)
I prefer the UTF8 notation of course, but some fonts do not include the glyphs for superscript numbers, so you can switch to less aesthetically pleasing alternatives, if need be.
Configuring axis labels: Part 2
You can also set defaults for how InspectDR displays tick axis labels in Julia’s config file, ~/.julia/config/startup.jl
:
DEFAULTS_INSPECTDR = Dict(
:notation_x => :SI, #Change x-axis notation (:SI/:SCI/:ENG)
:notation_y => :SI, #Change y-axis notation (:SI/:SCI/:ENG)
But you have less control using this technique.