【问题标题】:Renaming y axis ticks ggplot [duplicate]重命名y轴刻度ggplot [重复]
【发布时间】:2023-03-03 07:15:22
【问题描述】:

我创建了以下情节:enter image description here

这些刻度是自动生成的。

我想将 Y 轴刻度重命名为: 80000 至 1:20:000, 84000 至 1:24:000, 88000 至 1:28:000, 92000 到 1:32:000

这是我的代码:

seby_time<-ggplot(tempi_seb,aes(lap,milliseconds),color=position) + 
geom_point() +
geom_line(color="red")

我尝试了各种解决方案,但没有一个有效。

此作业需要 Geom_line() 或其他类型的“线函数”。

谢谢

【问题讨论】:

标签: r ggplot2 axis-labels


【解决方案1】:

使用scale_y_continuous。这是一个最小的例子

library(ggplot2)

ggplot(iris, aes(x = Petal.Length, y = Sepal.Length)) + geom_point() + 
  scale_y_continuous(breaks = c(5, 7), labels = c("5.0", "7.0"))

【讨论】:

  • 非常感谢,你给了我很大的帮助!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-10-12
  • 2020-05-23
  • 2011-03-29
  • 1970-01-01
  • 2012-03-14
  • 2020-11-20
相关资源
最近更新 更多