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

**URL:** <https://discourse.julialang.org/t/plots-jl-change-formating-of-logscale-ticks-to-normal-formatting/79733>\
**Category:** Visualization\
**Tags:** plots\
**Created:** [April 20, 2022, 11:44am UTC](https://discourse.julialang.org/t/plots-jl-change-formating-of-logscale-ticks-to-normal-formatting/79733 "2022-04-20T11:44:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![loonatick-src](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/loonatick-src/32/32248_2.png) [@loonatick-src](https://discourse.julialang.org/u/loonatick-src)\
**Post date:** [April 20, 2022, 11:44am UTC](https://discourse.julialang.org/t/plots-jl-change-formating-of-logscale-ticks-to-normal-formatting/79733/1 "2022-04-20T11:44:23Z")

</div>

Consider the following plot

```julia
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.

[![View of the plot](https://global.discourse-cdn.com/julialang/original/3X/4/6/46b1ad44dc7c57c0b87ce8dae69df03e9ae47ed5.png)](https://i.stack.imgur.com/6nmqt.png)

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.

[![With](https://global.discourse-cdn.com/julialang/original/3X/9/c/9c8f3dcd82ffa191ad95e7e7814712f5b0638ea1.png)](https://i.stack.imgur.com/ORx7M.png)

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](https://docs.juliaplots.org/latest/generated/supported/#Scales) in the documentation, but could not anything else that might help.

Crossposted from [StackOverflow](https://stackoverflow.com/questions/71938377/plots-jl-change-formating-of-logscale-ticks-to-normal-formatting)

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [April 20, 2022, 12:01pm UTC](https://discourse.julialang.org/t/plots-jl-change-formating-of-logscale-ticks-to-normal-formatting/79733/2 "2022-04-20T12:01:49Z")

</div>

Replace your last line by:

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

```

And let us know if it suits you.

---

<div class="post-metadata">

**Author:** ![loonatick-src](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/loonatick-src/32/32248_2.png) [@loonatick-src](https://discourse.julialang.org/u/loonatick-src)\
**Post date:** [April 20, 2022, 12:08pm UTC](https://discourse.julialang.org/t/plots-jl-change-formating-of-logscale-ticks-to-normal-formatting/79733/3 "2022-04-20T12:08:33Z")

</div>

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