R axis.text不改变角度
我知道为了改变x轴的角度,我们应该使用R axis.text不改变角度,r,ggplot2,axis,R,Ggplot2,Axis,我知道为了改变x轴的角度,我们应该使用theme()和axis.text.x=element\u text(size=1,angle=90) 对于绘图,我使用了geom_col,因为我的x轴不是一个连续变量,只是类别。谁能告诉我我做错了什么或错过了什么?对于精通R和ggplot的用户来说,一定有一些东西是显而易见的!谢谢大家! data("diamonds") example_df <- diamonds[unique(diamonds$clarity), ] ggplot(exampl
theme()和axis.text.x=element\u text(size=1,angle=90)
对于绘图,我使用了geom_col
,因为我的x轴不是一个连续变量,只是类别。谁能告诉我我做错了什么或错过了什么?对于精通R
和ggplot
的用户来说,一定有一些东西是显而易见的!谢谢大家!
data("diamonds")
example_df <- diamonds[unique(diamonds$clarity), ]
ggplot(example_df, aes(reorder(clarity, -carat, sum), carat)) +
geom_col() +
xlab("clarity")+
ylab("carat") +
theme(axis.text.x=element_text(size=1, angle=45)) +
geom_hline(yintercept=0.2, linetype="dashed", color = "red") +
ggtitle("test") +
theme_bw()
数据(“钻石”)
示例_df在末尾调用theme\u bw()
将重置先前添加的所有theme
更改。只有最后一个值仍然存在。只需更改设置值的顺序即可
ggplot(example_df, aes(reorder(clarity, -carat, sum), carat)) +
geom_col() +
xlab("clarity")+
ylab("carat") +
geom_hline(yintercept=0.2, linetype="dashed", color = "red") +
ggtitle("test") +
theme_bw() +
theme(axis.text.x=element_text(size=1, angle=45))
在末尾调用theme\u bw()
将重置先前添加的所有theme
更改。只有最后一个值仍然存在。只需更改设置值的顺序即可
ggplot(example_df, aes(reorder(clarity, -carat, sum), carat)) +
geom_col() +
xlab("clarity")+
ylab("carat") +
geom_hline(yintercept=0.2, linetype="dashed", color = "red") +
ggtitle("test") +
theme_bw() +
theme(axis.text.x=element_text(size=1, angle=45))
谢谢你!!!我以前就有过这个问题,我改变了订单,让它开始工作。但我真的不知道是theme\u bw()
的顺序导致了这个问题。非常感谢!谢谢你!!!我以前就有过这个问题,我改变了订单,让它开始工作。但我真的不知道是theme\u bw()
的顺序导致了这个问题。非常感谢!