# Plots: precision of numeric labels, default \`xformatter\`, or . .

**URL:** <https://discourse.julialang.org/t/plots-precision-of-numeric-labels-default-xformatter-or/101085>\
**Category:** Visualization\
**Created:** [July 2, 2023, 4:54pm UTC](https://discourse.julialang.org/t/plots-precision-of-numeric-labels-default-xformatter-or/101085 "2023-07-02T16:54:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryofurue](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ryofurue/32/24531_2.png) [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Post date:** [July 2, 2023, 4:54pm UTC](https://discourse.julialang.org/t/plots-precision-of-numeric-labels-default-xformatter-or/101085/1 "2023-07-02T16:54:16Z")

</div>

Basically I want to adjust the number of the significant digits in the numeric labels on the x axis:

```julia
using Plots
using StrFormat
x = 0:1e5:8e6
y = rand(Float64, length(x))
plot(x,y) # -> 2.0 × 10^6
plot(x,y; xformatter=(x -> f"\%.0e(x)")) # -> 2e+06

```

By default, the `plot` command plots beautiful numeric labels often with one extra 0 than necessary; for example, “2.0”, “4.0”, “6.0”, . . . I want them to be “2”, “4”, “6”, . . .

1. Is there a Plot attribute for that? I haven’t found one.
2. What’s the default `xformatter`? If it can be used by the user and if there is an adjustable parameter to it, the user can write something like `xformatter=(x -> defaultformatter(x, precision=1))` ?
3. Is there a string formatter that produces labels like “2 × 10^6” with a “real” superscript “6” ? (One can write such a function that produces a LaTeX string but that would be re-inventing a poorer wheel.)

Apart from this question, I’d like to get hold of the default formatter anyway because that would be useful with `annotate!()`.
