gpt4 book ai didi

Is it possible to remove the y axis ticks in geom_histogram?(是否可以删除geom_stangraph中的y轴刻度?)

转载 作者:bug小助手 更新时间:2023-10-24 23:21:07 27 4
gpt4 key购买 nike



As in the title, I am plotting a serials of facet plots of histograms. But I do not want the y axis ticks (counts/density) to show up since it looks cluttered. I used the option theme(axis.ticks.y = element_blank()) to remove the y axis ticks but it does not work for geom_histogram.

正如在标题中,我正在绘制一系列直方图的小平面图。但我不希望y轴刻度(计数/密度)显示出来,因为它看起来很混乱。我使用了选项theme(axis.ticks.y = element_blank())来移除y轴的刻度,但它对geom_histogram不起作用。


Here is a simple reproducible example:

下面是一个简单的可重现的例子:


dd <- data.frame(x = c(1:100))

ggplot(dd, aes(x)) + geom_histogram() + theme(axis.ticks.y = element_blank())

Is it just not possible to do this with histogram plots, or is there some other way? Any help would be awesome. Thank you!

使用直方图是不可能做到这一点的,还是有其他方法呢?任何帮助都是很棒的。谢谢!


更多回答

You've removed the ticks, but if you want to remove the text as well them set theme(axis.ticks.y = element_blank(), axis.text.y = element_blank())

您已经删除了勾号,但如果您想要删除文本,请设置主题(axis.ticks.y=Element_Blank(),axis.ext.y=Element_Blank())

Ahhh, I see. Thank you!

啊,我明白了。谢谢!

优秀答案推荐


Add axis.text.y=element_blank() as well:

同时添加axis.ext.y=ELEMENT_BLACK():


ggplot(dd, aes(x)) +
geom_histogram() +
theme(
axis.ticks.y = element_blank(),
axis.text.y = element_blank()
)

ggplot with ticks and text removed


更多回答

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