I want to customized the y axis to a certain number, but the distance in the y axis should not be changed accordingly like below figure. I tried different way, but failed. Basically, when I use the axis(2, yseries), the y range will be changed.
The core I tried is like this:
yseries <- c(10,
20,
40,
80,
160,
320,
640,
1280)
gm <- c(760, 640)
barplot(gm, xaxt = "n", yaxt = "n")
# Y-axis
axis(2, at = yseries)
You can see the y axis is different from the attached figure (where the y ranges from 10 to 1280, but the distance in the y axis is not changed in this figure. I also want to make this kind of figure). Can you help me to figure out?
Thanks,
This is the figure I want to replicate it in y axis
>Solution :
You can set the range of the y axis in the plot command, and use a log scale to get equal distances between multiples as follows:
barplot(gm, xaxt = "n", yaxt = "n", log="y", ylim = range(yseries))
axis(2, at = yseries,las=1)
