R ggplot:消失的轴线
使用theme_classic()返回预期格式的绘图,但缺少轴线 使用theme_bw()并在其后添加轴线仍然不会显示轴线。例如R ggplot:消失的轴线,r,graphics,ggplot2,R,Graphics,Ggplot2,使用theme_classic()返回预期格式的绘图,但缺少轴线 使用theme_bw()并在其后添加轴线仍然不会显示轴线。例如 qplot(input_data$trait1, input_data$trait2) + theme_bw() + theme(axis.line = element_line(colour = "black", size=10, linetype = 1)) 检查theme_bw()似乎需要将大小和线型从NULL更改为其他值 $ axis.line
qplot(input_data$trait1, input_data$trait2) +
theme_bw() +
theme(axis.line = element_line(colour = "black", size=10, linetype = 1))
检查theme_bw()似乎需要将大小和线型从NULL更改为其他值
$ axis.line :List of 4
..$ colour : chr "black"
..$ size : NULL
..$ linetype: NULL
..$ lineend : NULL
我尝试创建一个新的主题,带有轴线,但未被识别为命令:
theme_classic2 = theme_set (theme_classic())
theme_classic2 = theme_update(axis.line = element_line(colour = "black", size=1,
linetype = 1)
我觉得我可能不小心改变了一些默认设置
请帮忙。这相当令人气愤,更不用说相当尴尬了
两天内同一问题可能重复。我不能重现同样的问题。您的sessionInfo()是什么?@MLavoie会话信息已添加。使用我自己的图形和相同的ggplot2版本,我无法重现您的错误。你能添加(使用dput()数据集的一个子集来重现你的错误吗?啊,不用担心,我猜这是ggplot中的一个bug。通过分别指定axis.line.x和y找到了解决方案。
> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)
locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] tidyr_0.4.0 ggplot2_2.1.0
loaded via a namespace (and not attached):
[1] labeling_0.3 colorspace_1.2-6 scales_0.4.0 magrittr_1.5 R6_2.1.2 assertthat_0.1
[7] plyr_1.8.3 parallel_3.2.3 DBI_0.3.1 tools_3.2.3 gtable_0.2.0 dplyr_0.4.3
[13] Rcpp_0.12.3 grid_3.2.3 munsell_0.4.3