graph - Changing Maximum and Minimum Values of Axis/Axes and values of intervals on axes in R -


i trying change values included in, , maximum , minimum values, of plot in r have tried using "axis" function (as advised ?axis in r) isn't working. want values on x axis between 0 , 60, going in intervals of 10 , values on y axis between 0.0 , 0.8 increments of 0.1.

here current code:

pinteractiontwo <- ggplot(new.data.longsleeptime, aes( x=stage_three, y=accuracy))  pinteractiontwo <- pinteractiontwo + xaxis(2, @ = 0, 10, 20, 30, 40, 50, 60, labels = 10, tick = true) pinteractiontwo <- pinteractiontwo + yaxis(1, @ = 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, labels = 0.1, tick = true) pinteractiontwo <- pinteractiontwo + xlab ("time spent in stage 3 (minutes)") + ylab ("accuracy")  + theme_bw() pinteractiontwo <- pinteractiontwo + theme(axis.title.x = element_text(size=20)) + theme(axis.text.x = element_text(size=20)) pinteractiontwo <- pinteractiontwo + theme(axis.title.y = element_text(size=20)) + theme(axis.text.y = element_text(size=20))                                                                               pinteractiontwo <- pinteractiontwo + geom_smooth(colour = "black", method = "lm", size = 1.5, aes(group = 1)) 

pinteractiontwo

this brings graph:

enter image description here

the x axis between 20 , 60 , y axis between 0.5 , 0.8 (not tried specify axis function in code).

i need change axes comparing them graph axes need on same scale.

please can let me know going wrong in code , need change?

you try use scale_x_discrete & scale_y_discrete methods.

xlimits <- seq(0, 60, 10) pinteractiontwo <- pinteractiontwo + scale_x_discrete(limits=xlimits) 

or, jbaums stated, there xlim & ylim methods well.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -