[R] ggplot2 customizing a plot
istazahn at gmail.com
Wed Feb 20 16:54:13 CET 2013
On Wed, Feb 20, 2013 at 9:33 AM, Alaios <alaios at yahoo.com> wrote:
> Dear all,
> I want some help improve my ggplot as following:
> Make the plottable area with grid, so is easy one to see where each box refers to x and y values.
I don't think you can easily move the grid to the front, but you can
make the tiles transparent so the grid can be seen through them by
setting the alpha < 1.
> Add a color bar but with fixed values, that I want to specify.
> How I can do those two?
p<- ggplot(tdm, aes(x = Var2, y = Var1, fill = factor(value))) +
labs(x = "MHz", y = "Threshold", fill = "Duty Cycle") +
scale_fill_manual(values=c("red", "blue", "green", "purple",
"orange", "pink", "tan", "violet", "yellow"))
> Before is some code what I have tried so far.
> tdm <- melt(DataToPlot)
> p<- ggplot(tdm, aes(x = Var2, y = Var1, fill = factor(value))) +
> labs(x = "MHz", y = "Threshold", fill = "Duty Cycle") +
> geom_raster() +
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help