に基づいて、列間の変化距離Iは、以下のバープロット有する:geom_bar、可変
library(ggplot2)
df<- data.frame(type = c("a","a","a","b","b","b","c","c","c","d","d","d","e","e","e"),
percentage = c(0.3,0.3,0.4,0.2,0.1,0.7,0.3,0.3,0.4,0.8,0.1,0.1,0.3,0.05,0.65),
size = c(4,4,4,1,1,1,0.5,0.5,0.5,1,1,1,1,1,1),
class = as.factor(c(1,2,3,1,2,3,1,2,3,1,2,3,1,2,3)))
ggplot(df, aes(x=type, y=percentage, width=size/3)) +
geom_bar(aes(fill = class), stat="identity") +
theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust=0.3, size=10.)) +
scale_x_discrete(name="type") +
scale_y_continuous(name="Percentage",labels=scales::percent) +
theme(plot.title = element_text(hjust = 0.5)) +
scale_fill_discrete(name = "")
列(又はX-目盛り)が等間隔れます。
私は列がない平等、
ディスクリートスケールは一の単位離隔定義によるものです。おそらくあなた自身の大規模なxスケールを定義し、ブレークとラベルを調整する必要があります。 – Axeman
ありがとう@アックスマン、それは私が望むように動作します。 –