1
私はこの1つのように見えるデータフレーム持っている:私は「ピラミッド」を作りたかったので、私はネガにNさんのいくつかを作るために必要なggplot2棒グラフの負のx軸の区切り(ラベル)を正の値に変更するにはどうすればよいですか?
df <- structure(list(gender = c("male", "male", "male", "female", "female",
"female", "male", "male", "male", "male", "male", "female", "female",
"female"), agegroup = c("-24", "25-34", "45-54", "-24", "25-34",
"35-44", "-24", "25-34", "35-44", "65-", "unknown", "-24", "25-34",
"35-44"), N = c(-2, -4, -1, 3, 4, 1, -3, -14, -1, -1, -2, 3,
3, 1), N2 = c(2, 4, 1, 3, 4, 1, 3, 14, 1, 1, 2, 3, 3, 1), location = c("here",
"here", "here", "here", "here", "here", "there", "there", "there",
"there", "there", "there", "there", "there")), .Names = c("gender",
"agegroup", "N", "N2", "location"), row.names = c(NA, 14L), class = "data.frame")
を。このように:
ggplot(biofile2, aes(x = agegroup, y = N , fill = gender),color=gender) +
geom_bar(stat="identity", size=.3, position="identity")+
facet_wrap(~ location,ncol=2)+
coord_flip()
私は意図したようです。残されているのは、-10と-5をポジティブに戻すことだけです。プロットの外観を変えずにこれを行う方法はありますか?
@Axemanのおかげ!どのラベルが事前にわかっていなければ、プログラムでラベルを変更する方法はありますか? – rdatasculptor
@Axeman、これを回答として追加すると、私はそれを受け入れることになります。再度、感謝します! – rdatasculptor