フォーク、助けてください。すべてを試しました。さまざまなオプションを使いました。要因として、残念ながら...何も動作、scale_fill_manualとscale_fill_gradientと、なし:(ggplotパレットの問題を修正する - グラデーションボックスプロットを作成するには?
私は
income.boxplot <- ggplot(income.by.state, aes(x = State, y = Estimate)) +
geom_boxplot() +
coord_flip() + scale_x_discrete(limits = rev(levels(income$State))) +
labs(title = "Median household income by state",
subtitle = "Source: 2011-2015 American Community Survey") +
theme(plot.title = element_text(hjust = 0.5)) +
labs(x = "State",
y = "Median household income",
fill = "Median household income") +
theme_fivethirtyeight() +
theme(axis.line.x = element_line(size = .5, colour = "black"),
axis.title = element_text(size = 14),
legend.position = "right",
legend.direction = "vertical",
legend.box = "vertical",
legend.key.size = unit(0.7, "cm"),
legend.text = element_text(size = 10),
text = element_text(family = "OfficinaSanITC-Book"),
plot.title = element_text(family = "OfficinaSanITC-Book"))
income.boxplot
。完璧に見えますが、私はそれのためのパレットを作成することはできません。低所得のオレンジ色のオレンジ色を欲しがり、高/青の色にグラデーションを描いてみたい
いつか私にはがあります。エラー(x = State、y = Estimate):未使用の引数(y = Est iMateの)等
私のデータは
1 Ziebach County Median Household Income ($) South Dakota 35119
2 Zavala County Median Household Income ($) Texas 26672
3 Zapata County Median Household Income ($) Texas 32162
4 Yuma County Median Household Income ($) Colorado 43105
アップデートのように見えます!
私は何かを見つけました。 しかし、のcolor = as.integer(Estimate)、group = Estimationでこれを実行しようとしたときに、それが悪くなりました。それで何とか可能です。
更新2!
このPrintScreenを私の望ましい結果を示していますが、これは、私はタブローに慣れていないんだけど、それはそれではない勾配そのもののように見えるのではなく、着色されている点があることをタブロー
あなたはggplotのための 'AES()'内側= Estimate'を埋める '含まれていましたか?そうでなければ 'scale_fill_XXX()'関数はどのマッピングを使うべきか分からないでしょう。また、ここでは、状態を要素に変換することは適切ではないと私は考えています。 –
関連性があります:https://stackoverflow.com/questions/42494885/fill-boxplot-color-based-on-value-gradient – www
@ Z.Lin、私はしましたが、それは問題を解決していない伝説を作成しました。 – Oleksiy