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 reproducible example)? It will help us help you if we can be sure we're all working with/looking at the same stuff.
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.
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:
You can also use seq() for a finer control, e.g. of the step size.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.