1. define gradient private palette and pick up 5 colors.
my_palette <- colorRampPalette(c("#FF0000","#FFFF00","#00FF00","#00FFFF","#0000FF"))
plot_col <- my_palette(5)[5:1]
plot_col <- my_palette(5)[5:1]
2.pick up 5 colors from the standard palette "Spectral".
RColorBrewer::brewer.pal(5,"Spectral")[5:1]
3.display sample
barplot(rep(1,15), col=my_palette(15), axes=FALSE)
barplot(rep(1,11), col=RColorBrewer::brewer.pal(11,"Spectral")[11:1], axes=FALSE)
*note that spectral max color num is 11.
3. define private palette
my_palette <- colorRampPalette(c("#FF0000","#FFFF00","#00FF00","#00FFFF","#0000FF"))
# create 47 colors from my_palette.
g <- g + scale_fill_manual(name='regions',values=my_palette(47),labels=pref_jp)
# can't use scale_fill_hue with 'values=' parameter.
0 件のコメント:
コメントを投稿