Consider the following plot
using Plots
pyplot()
radix_range_xticks = -4:4
radix_range = LinRange(-4, 4, 100)
xs = 2.0 .^ radix_range_xticks
pf = 50.0
bw = 25.0
roofline(x, bw, pf) = min(bw*x, pf)
ys = roofline.(xs, bw, pf)
p = plot(xs, ys; xscale=:log2, yscale=:log10)
xticks!(p, xs)
This results in a plot that looks like this.
The x-ticks and y-ticks both are formatted as exponentials. Adding the keyword argument xformatter=:scientific
does not help, as it just changes the radix instead of the whole number.
So, how can I format the ticks in e.g. scientific notation? I would like to get rid of the base^exponent
notation altogether.
I also tried passing an iterable of String
s to xticks!
, but it does not dispatch on it.
I tried to look here in the documentation, but could not anything else that might help.
Crossposted on the Julia lang discourse here
Passing only an iterable of strings would not work, the plot also needs information about where to place those strings on the x-axis. The following does the job.
Replace the last argument with whatever formatting is required for the ticks.