r - Categorical axis to Continuous ggplot -
i trying create heat map, each tile month. if use dates data date type, lines on image not acceptable.
so solution has been to treat date factor
the problem axis not presentable. there way merge 2 plots x axis first plot, tiles second plot?
ggplot(df, aes(x = factor(var2), y = factor(desc(var1)), fill = value)) +
as reproducible example:
df <- read.table("","var1","var2","value","col" "1",2001-01-31,2001-01-31,-0.0118511587908436,"blue" "2",2001-02-28,2001-01-31,0,"white" "3",2001-03-30,2001-01-31,0,"white" "4",2001-04-30,2001-01-31,0,"white" "5",2001-05-31,2001-01-31,0,"white" "6",2001-06-29,2001-01-31,0,"white") ggplot(dff, aes(x = factor(var2), y = factor(desc(var1)), fill = col)) + geom_tile() + scale_x_discrete(breaks=pretty(p$var2))
use dates manually remove grid. can adding + theme(panel.grid = element_blank())
plot.
Comments
Post a Comment