how to draw the graph in R?

后端 未结 2 401
情歌与酒
情歌与酒 2021-01-26 06:13

I can get photo11 with the following code,how can i fix my code to change photo1 into photo2?

x = seq(0.5, 0.9, length = 200)
y = dnorm(x,0.7,0.0458)
plot(x, y,         


        
2条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-26 06:42

    This will do it. xaxt='n', ann=FALSE removes the x-axis and annotations. axis(...) puts the x-axis only at the specified points. mtext() will put marginal text on the bottom axis.

    x <- seq(0.5, 0.9, length = 200)
    y <- dnorm(x,0.7,0.0458)
    plot(x, y, type="l", xaxt='n', ann=FALSE)
    axis(1, at=c(0.7, 0.8))
    mtext("my_x_lab", 1, at=0.9, line=2)
    

    example

提交回复
热议问题