# y-axis shifted by 1

The 0 should be where now the 1 is on the y-axis. But the dots are in the right place. The large green dot is x = 15 and y = 3.

Probably it's just a stupid mistake. Many thanks for the help!

Hi Yannina, welcome to community.

Could you please turn this into a self-contained reprex (short for **repr**oducible **ex**ample)? It will help us help you if we can be sure we're all working with/looking at the same stuff.

```
install.packages("reprex")
```

If you've never heard of a reprex before, you might want to start by reading the tidyverse.org help page. The reprex dos and don'ts are also useful.

There's also a nice FAQ on how to do a minimal reprex for beginners, below:

## What to do if you run into clipboard problems

If you run into problems with access to your clipboard, you can specify an outfile for the reprex, and then copy and paste the contents into the forum.

```
reprex::reprex(input = "fruits_stringdist.R", outfile = "fruits_stringdist.md")
```

For pointers specific to the community site, check out the reprex FAQ.

To me it seems to be the scale_y_... line.

First: Why do you treat this as discrete? As this is also numeric it might be better scale_y_continous() ?

Second: Try to define the limits as for the x-axis, here limits = c(0,12) - maybe this generates the problem.

Hi Matthias

Thank you very much! Treating the variable on the y-axis as continuous solves indeed this problem. The reason I treated the variable as a factor in the first place was because I wanted the values 1, 2, 3 ... visible on the y-axis (whole numbers) instead of 0, 2.5, 5, 7.5, ... since one can't have 2.5 employees.

But I'm sure there is another way to prevent that...

There is a way to do it, and it is embarrassingly easy.

I added an argument in the scale_y_continuous-line:

...

scale_y_continuous(limits=c(1,12), breaks=1:12)

Well done!

You can also use seq() for a finer control, e.g. of the step size.

scale_y_continuous(limits=c(1,12), breaks=seq(1,12,2))

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.