Change major axis grid line intervals in MSchart for R

86 Views Asked by At

I'm using the mschart library in R to create a scatter plot. I want to adjust the interval between the major grid lines. For example, in the image below I would like to set the x axis interval to 0 by 20 to 100 and the y axis interval to 0 to 300 by 100. Is there anyway to do this mschart or do I have to adjust the chart manually?

enter image description here

Here is the code that generated the chart. I was expecting to see a major grid interval or breaks argument in chart_ax_x but there is only arguments for the axis limits.


library(mschart)
n <- 1e3
sigma <- 10
x <- 100*rbeta(n, 3, 4 )
y <- 100 + x + rnorm(n,0, 20)

plot(x, y)


dta <- data.frame(x, y)
dta

sp <- mschart::ms_scatterchart(dta, 'x', 'y')
sp <- mschart::chart_data_size(sp, values = 4) 
sp <- mschart::chart_ax_x(sp, limit_min = 0, limit_max =100)
sp <- mschart::chart_ax_y(sp, limit_min = 0, limit_max =300)

print(sp, preview = TRUE)
0

There are 0 best solutions below