# How to log10 scale on bar plot y axis with Makie

**URL:** https://discourse.julialang.org/t/how-to-log10-scale-on-bar-plot-y-axis-with-makie/87200
**Category:** General Usage
**Tags:** question, plotting, makie, plot
**Created:** [September 13, 2022, 10:15am UTC](https://discourse.julialang.org/t/how-to-log10-scale-on-bar-plot-y-axis-with-makie/87200 "2022-09-13T10:15:41Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Hester](https://avatars.discourse-cdn.com/v4/letter/h/ce7236/32.png) [@Hester](https://discourse.julialang.org/u/Hester)
#### Post date: [September 13, 2022, 10:15am UTC](https://discourse.julialang.org/t/how-to-log10-scale-on-bar-plot-y-axis-with-makie/87200/1 "2022-09-13T10:15:41Z")

</div>

I am trying to display a bar plot with a log10 scale in the y axis, but I get the error `Found invalid x-limits (0.0f0, 125.0f0) for scale log10 which is defined on the interval 0.0..Inf (open)` despite my data not containing any zeros.

Here is the code that produces the error:

```julia
f = Figure()
xs = [1,2,3,4]
ys = [2,5,3,100]
ax = Axis(f[1,1],
    yscale = log10)
barplot!(ax,xs,ys)
display(f)

```

This works fine without the `yscale` :

```julia
f = Figure()
xs = [1,2,3,4]
ys = [2,5,3,100]
ax = Axis(f[1,1],)
   # yscale = log10)
barplot!(ax,xs,ys)
display(f)

```

 ![test](https://global.discourse-cdn.com/julialang/original/3X/5/3/53c7528ff28149a0b528b4cc51ba628fec747685.png)

Please help!

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [September 14, 2022, 10:42am UTC](https://discourse.julialang.org/t/how-to-log10-scale-on-bar-plot-y-axis-with-makie/87200/2 "2022-09-14T10:42:46Z")

</div>

Your data doesn’t contain zero, but by default a barplot is drawn from `offset = 0` to your values, so that’s where the 0 comes from. It’s tricky because the projection part of the rendering system doesn’t care how you think barplots should behave on a high level, it just sees the coordinates of the polygon vertices. But as your plot can’t start at 0 with log axis, you have to decide what should happen. Either you let the barplot start at some value \> 0 or you pick a different axis scale. This exact issue with barplots is also mentioned in the docs here [Axis](https://docs.makie.org/stable/examples/blocks/axis/index.html#pseudolog_and_symlog_scales)

---

<div class="post-metadata">

### Author: ![Hester](https://avatars.discourse-cdn.com/v4/letter/h/ce7236/32.png) [@Hester](https://discourse.julialang.org/u/Hester)
#### Post date: [September 14, 2022, 2:27pm UTC](https://discourse.julialang.org/t/how-to-log10-scale-on-bar-plot-y-axis-with-makie/87200/3 "2022-09-14T14:27:15Z")

</div>

Hi Jules, thank you that docs link has sorted it!
