這是我的第一篇文章!
只是想知道如何洗掉圖表上方的這些標題:

這是圖表的代碼!
我想我將不得不使用類似的東西:
p theme(axis.title.x = element_blank(), axis.title.y = element_blank())
ggplot(data=bike_data_v4)
geom_bar(mapping = aes(x=day_of_week,fill=member_casual))
scale_x_discrete(limits = c("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"),
labels = c("Sun","Mon","Tue","Wed","Thu","Fri","Sat")) #the discrete lines show how I rearranges the x-axis labels to go from sun-sat and be renamed to shorter text
facet_wrap(~member_casual)
labs(title="Weekly Rider Differences by Cyclist Type", subtitle="Members vs. Casual Riders",
x = "Day of the Week",
y = "Number of Overall Rides",
caption="Data Provided by Google Capstone Project")
scale_y_continuous(limits=c(0,500000), labels = scales::comma) #this combined scale_y_continuous(limits=c(0,500000) AND scale_y_continuous(labels=comma)
theme_fivethirtyeight()
labs(fill='Rider Type')
theme(axis.title = element_text())
uj5u.com熱心網友回復:
您正在尋找strip.text選項。
library(tidyverse)
iris |>
ggplot(aes(x = Sepal.Length, y = Petal.Length))
geom_point()
facet_wrap(~ Species)
theme(strip.text = element_blank())

uj5u.com熱心網友回復:
我最終更改了最底部的代碼!添加 strip.text = element_blank())
現在條形圖如下所示:
ggplot(data=bike_data_v4)
geom_bar(mapping = aes(x=day_of_week,fill=member_casual))
scale_x_discrete(limits = c("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"),
labels = c("Sun","Mon","Tue","Wed","Thu","Fri","Sat")) #the discrete lines show how I rearranges the x-axis labels to go from sun-sat and be renamed to shorter text
facet_wrap(~member_casual)
theme(strip.text = element_blank())
labs(title="Weekly Rider Differences by Cyclist Type", subtitle="Members vs. Casual Riders",
x = "Day of the Week",
y = "Number of Overall Rides",
caption="Data Provided by Google Capstone Project")
scale_y_continuous(limits=c(0,500000), labels = scales::comma) #this combined scale_y_continuous(limits=c(0,500000) AND scale_y_continuous(labels=comma)
theme_fivethirtyeight(base_size = 12, base_family = "sans")
labs(fill='Rider Type')
theme(axis.title = element_text(), strip.text = element_blank())
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/471574.html
