【问题标题】:How do I amend my x axis increments and y axis format on my plot?如何修改我的绘图上的 x 轴增量和 y 轴格式?
【发布时间】:2021-03-19 23:08:55
【问题描述】:

我有一个看起来像这样的情节:

我的代码在这里:

df <- read_excel("Desktop/test.xlsx")
                                                                           
tidydf <- df

ggplot(tidydf, aes(Genome_size, `Trio_number`, color = Group)) +
     geom_point() +
     ylab("") +
     theme_dotplot

我该怎么做:

  1. 使 y 轴以 1 为增量上升。所以 1 , 2 , 3。
  2. 将 x 轴设为整数形式,如 1991579。

【问题讨论】:

标签: r ggplot2 plot graph


【解决方案1】:

使用scale_y_continuous:

scale_y_continuous(breaks = seq(0,3, by = 1)

scales 包和comma 函数与scale_x_continuous 一起使用:

library(scales)
scale_x_continuous(labels = comma)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-06-08
    • 2017-11-02
    • 2021-12-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-08
    相关资源
    最近更新 更多