我希望下图中的Y轴从0到100,间隔为10。
我已经尝试了各种方法来做到这一点,但(ylim,scale_y_continuous等),但不断得到错误消息。
library(ggplot2)
library(dplyr)
library(readr)
library(janitor)
library(RColorBrewer)
library(forcats)
#Create data frame
df <- data.frame(Year = c("2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020", "2021", "2022"),
ExpeditedDrugsProportion = c(51, 48, 66, 60, 73, 61, 73, 60, 68, 74, 65)
)
df$ExpeditedDrugsProportion <- as.factor(df$ExpeditedDrugsProportion)
#Create plot, labels etc.
ExpeditedApprovals_graph <- ggplot(df, aes(x = Year, y = ExpeditedDrugsProportion)) +
geom_point() +
labs(title = "",
x = "Year",
y = "Proportion of newly approved drugs expedited (%)") +
theme_classic(base_size = 20)
ExpeditedApprovals_graph
1条答案
按热度按时间kokeuurv1#
不要将x轴变量转换为因子,它适用于
scale_y_continuous
: