# Incorrect plot for small values

**URL:** https://discourse.julialang.org/t/incorrect-plot-for-small-values/87254
**Category:** General Usage
**Tags:** plots
**Created:** [September 14, 2022, 6:29am UTC](https://discourse.julialang.org/t/incorrect-plot-for-small-values/87254 "2022-09-14T06:29:37Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jishnub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jishnub/32/33620_2.png) [@jishnub](https://discourse.julialang.org/u/jishnub)
#### Post date: [September 14, 2022, 6:29am UTC](https://discourse.julialang.org/t/incorrect-plot-for-small-values/87254/1 "2022-09-14T06:29:37Z")

</div>

I’m a bit puzzled by what’s happening here, is this a known issue?

```julia
(@v1.8) pkg> st -m Plots
Status `~/.julia/environments/v1.8/Manifest.toml`
  [91a5bcdd] Plots v1.33.0

julia> using Plots

julia> r = range(-1, 1, length=10);

julia> plot(r, r*1e-20)

```

This produces  
 ![plot](https://global.discourse-cdn.com/julialang/original/3X/f/3/f3522ed70c99543b8e1e5b14152e4c59a2fd56de.png)

Why is the plot seemingly zero?  
This doesn’t happen if I use `PyPlot`, in which case I obtain a line as expected

---

<div class="post-metadata">

### Author: ![jishnub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jishnub/32/33620_2.png) [@jishnub](https://discourse.julialang.org/u/jishnub)
#### Post date: [September 14, 2022, 6:38am UTC](https://discourse.julialang.org/t/incorrect-plot-for-small-values/87254/2 "2022-09-14T06:38:33Z")

</div>

Evidently, it’s a poorly chosen default `ylim`. The following makes this look as expected

```julia
julia> plot(r, r*1e-20, ylim=extrema(r*1e-20))

```

---

<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: [September 14, 2022, 3:52pm UTC](https://discourse.julialang.org/t/incorrect-plot-for-small-values/87254/3 "2022-09-14T15:52:05Z")

</div>

A tip, if you will, for better formatting of y-axis labels. To your solution add the keyword argument:  
`yformatter=x->round(x,sigdigits=2)`

---

<div class="post-metadata">

### Author: ![jishnub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jishnub/32/33620_2.png) [@jishnub](https://discourse.julialang.org/u/jishnub)
#### Post date: [September 14, 2022, 4:27pm UTC](https://discourse.julialang.org/t/incorrect-plot-for-small-values/87254/4 "2022-09-14T16:27:22Z")

</div>

I wonder if the default settings could be improved
