如何修改绘图中的 x 轴增量和 y 轴格式?

时间:2021-03-19 23:08:55

标签: r ggplot2 plot graph

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

enter image description here

我的代码在这里:

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。

1 个答案:

答案 0 :(得分: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)
相关问题