Plots.jl: Change formating of logscale ticks to normal formatting

Consider the following plot

using Plots

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.

View of the plot

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 Strings 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 from StackOverflow

Replace your last line by:

xticks!(p, xs, string.(xs))

And let us know if it suits you.

It works! Now that I think about it, I should have seen why passing only the strings wouldn’t work.