gpt4 book ai didi

R [ggplot2] 如何设置刻度大小?

转载 作者:行者123 更新时间:2023-12-04 10:37:17 25 4
gpt4 key购买 nike

我正在尝试设置刻度大小,但是当我指定 axis.ticks 参数时,刻度在两个轴上都变为水平。例如

data <- data.frame(x =c(1:10), y = c(1:10) )
ggplot(data, aes(x, y)) +
geom_point() +
theme(axis.ticks = element_line(size = 5))

http://prnt.sc/dlwv0i

并且角度参数不起作用。

ggplot2 版本 2.2.0.9000

任何帮助,将不胜感激。

最佳答案

你可以这样做:

ggplot(data, aes(x,y)) + 
geom_point() +
theme(axis.ticks.length=unit(.25, "cm"))
这是来自 https://ggplot2.tidyverse.org/reference/theme.html

关于R [ggplot2] 如何设置刻度大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41251330/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com