は私のデータとコードです:なぜggplot2はfacet_gridを使ってプロットを分割できませんでしたか?ここ
a <- data.frame(Original = c("Full", "Full", "T0", "T0"),
Classified = c("Full", "T0", "Full", "T0"),
Value = c(0.69, 0.31, 0.32, 0.68),
Text = c("69%", "31%", "32%", "68%"))
ggplot(data = a, aes(x=Classified, y=Original, fill=Value)) +
geom_tile()+
geom_text (aes (label=Text), size = 15)+
scale_fill_gradient(low="light blue", high="purple")+
facet_grid (Original~Classified, space = "free", switch = "y")+
theme_bw()+
ggtitle ("ADS")+
theme (panel.background = element_blank())+
theme (plot.background = element_blank())+
theme (panel.grid.major = element_line(colour = "white"))+
ylab ("Percentage of Tokens")+
theme (strip.text = element_text(size = 23))+
theme (axis.title = element_text (size = 25))+
theme(plot.title = element_text(size=25))+
theme (legend.position = "none")+
theme (axis.title.x = element_blank())
それは次のようSTHを生成するのはなぜ? 4つのパネルの4つのプロットを完全に埋める必要があります。
あなたのコード 'facet_grid(Original〜Classified、space =" free "、switch =" y "、scales =" free ")のfacet instedにこれを使ってください。ファセットグリッドはすべてのプロットで同じスケールを使用しており、これが表示されたプロットを取得している理由です。 –
まさに、facet_gridにscales = 'free'を追加する必要があります。 –