# How to plot bar chart starting from non-zero y-axis?

**URL:** <https://discourse.julialang.org/t/how-to-plot-bar-chart-starting-from-non-zero-y-axis/49215>\
**Category:** General Usage\
**Tags:** question, statsplots\
**Created:** [October 29, 2020, 2:20am UTC](https://discourse.julialang.org/t/how-to-plot-bar-chart-starting-from-non-zero-y-axis/49215 "2020-10-29T02:20:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manu\_Francis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/manu_francis/32/10010_2.png) [@Manu\_Francis](https://discourse.julialang.org/u/Manu_Francis)\
**Post date:** [October 29, 2020, 2:20am UTC](https://discourse.julialang.org/t/how-to-plot-bar-chart-starting-from-non-zero-y-axis/49215/1 "2020-10-29T02:20:31Z")

</div>

Hi,

I am trying to plot a bar chart as below:

```julia
using StatsPlots
bar([4,5,6],fillcolor=[:red,:green,:blue],fillalpha=[0.2,0.4,0.6], group=["a","b","c"])

```

![test](https://global.discourse-cdn.com/julialang/original/3X/2/7/2750f8cc9d52894e01a85610afcd8f78133d42d6.png)  
But this plot is starting from Y-axis zero. However, I am looking to plot Y-axis `3`. Moreover, instead of x-axis values, I want the labels to correspond to each bar.

How can I plot based on my requirements?

Thanks in Advance!  
Manu

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [October 29, 2020, 7:34am UTC](https://discourse.julialang.org/t/how-to-plot-bar-chart-starting-from-non-zero-y-axis/49215/2 "2020-10-29T07:34:42Z")

</div>

You want `ylim = (3, 6)` and `xticks = (1:3, string.('a':'c'))`

(NB I’m currently seeing a weird error where if I use `xticks` as above as a kwarg in the `bar` call it doesn’t plot the first two ticks, but if I do `xticks!(1:3, string.('a':'c'))` after the `bar` call it works, and if I include an extra label which isn’t shown - `xticks = (1:4, string.('a':'d'))` - in the `bar` call it also works - if you can reproduce this I’ll open an issue)

---

<div class="post-metadata">

**Author:** ![Manu\_Francis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/manu_francis/32/10010_2.png) [@Manu\_Francis](https://discourse.julialang.org/u/Manu_Francis)\
**Post date:** [October 29, 2020, 11:07am UTC](https://discourse.julialang.org/t/how-to-plot-bar-chart-starting-from-non-zero-y-axis/49215/3 "2020-10-29T11:07:18Z")

</div>

@nilshg: Thanks for your reply. It is working with the following code:  
`bar([4,5,6],fillcolor=[:red,:green,:blue],fillalpha=[0.2,0.4,0.6], ylim = (3, 6), xticks=(1:3, ("a","b","c")))`
