问题描述
我对R图中的文本有疑问。 我的代码是
library("ggplot2")
ggplot(df,aes(x = class,y = Proportion)) +
geom_point(aes(color = class)) +
scale_color_viridis_d() +theme_minimal()+
theme(text=element_text(size=16,face = "plain"))
但是,图中的文本是斜体。我添加“ face =” plain”, 但这没用。 我不知道是什么原因 我将不胜感激。
解决方法
face参数具有4个选项:普通,斜体,粗体和bold.italic。 如果您不希望数字为斜体,则可以删除element_text中的face参数或另一个值“ bold”。
,类class(df$class)
可能是一个因素吗?
mtcars$cyl <- factor(mtcars$cyl)
library("ggplot2")
ggplot(mtcars,aes(x = cyl,y =mpg)) +
geom_point(aes(color = cyl)) +
scale_color_viridis_d() +theme_minimal()+
theme(text=element_text(size=16,face = "plain"))