当前位置: 首页 > 程序语言 >如何更改坐标轴刻度

如何更改坐标轴刻度

作者 monitor2885
来源: 小木虫 300 6 举报帖子
+关注

x <- c(1:10)
y <- round(runif(10,min = 80 , max = 100))
plot(x,y,type = 'l',ylim = c(60,100))
如何让x轴,每1画一个刻度,让y轴,每10画一个刻度。

如何更改坐标轴刻度 返回小木虫查看更多

今日热帖
  • 精华评论
  • zhangchencn

    用ggplot2这个包,看包作者写的书

  • monitor2885

    引用回帖:
    3楼: Originally posted by zhangchencn at 2017-12-14 22:23:54
    用ggplot2这个包,看包作者写的书

    如何更改坐标轴刻度-1

    怎么回事呀

  • deephill

    没有安装 ggplot 这个包,还是 ggplot2。

  • monitor2885

    引用回帖:
    3楼: Originally posted by zhangchencn at 2017-12-14 22:23:54
    用ggplot2这个包,看包作者写的书

    就用plot能不能实现我的要求,定义坐标轴刻度

  • lvchengrui

    require(ggplot2)
    df <- data.frame(x <- c(1:10),
                                y <- round(runif(10,min = 80 , max = 100)))

    ggplot(df, aes(x = x, y = y)) +
        geom_line() +
        scale_x_continuous(breaks = seq(1,10), limits = c(1,10)) +
        scale_y_continuous(breaks = seq(60, 100, by = 10), limits = c(60, 100))

猜你喜欢
下载小木虫APP
与700万科研达人随时交流
  • 二维码
  • IOS
  • 安卓