search for: scale_fill_gradient2

Displaying 7 results from an estimated 7 matches for "scale_fill_gradient2".

Did you mean: scale_fill_gradient
2007 Jul 13
1
Choosing the number of colour breaks in ggplot2
...to choose the number of colour breaks for a gradient scale in the current version of ggplot2? Here is a simple example: --------------------------------------------- x=-10:10 y=-10:10 dat=expand.grid(x=x,y=y) dat$z=dat$x^2+dat$y^2-100 ggplot(dat, mapping=aes(x=x, y=y, fill=z)) + geom_tile() + scale_fill_gradient2() --------------------------------------------- The image shows many (61) colours, but only 5 of them are shown in the legend. How do I change the legend to show, say, 10 colours? -- Karl Ove Hufthammer
2017 Dec 20
2
outlining (highlighting) pixels in ggplot2
...with binary code for which results (pixels) are significant set.seed(4004) sig <- matrix(round(abs(rnorm(15*12)/3)), nrow = 15, ncol = 12) ggplot(m1.melted, aes(x = Month, y = Site, fill = Concentration), autoscale = FALSE, zmin = -1 * zmax1, zmax = zmax1) + geom_tile() + coord_equal() + scale_fill_gradient2(low = "darkred", mid = "white", high = "darkblue", midpoint = 0) [[alternative HTML version deleted]]
2011 Nov 08
3
ggplot2 reorder factors for faceting
...ta is long format for ggplot2 plotData <- as.data.frame(cbind(genes, as.numeric(fcData), as.numeric(times), infection, infType)) hp2 <- ggplot(plotData, aes(factor(times), genes)) + geom_tile(aes(fill = scale(as.numeric(fcData)))) + facet_wrap(~infection, ncol=4) # set scale hp2 <- hp2 + scale_fill_gradient2(name=NULL, low="#0571B0", mid="#F7F7F7", high="#CA0020", midpoint=0, breaks=NULL, labels=NULL, limits=NULL, trans="identity") # set up text (size, colour etc etc) hp2 <- hp2 + labs(x = "Time", y = "") + scale_y_discrete(expand = c(0,...
2017 Dec 20
0
outlining (highlighting) pixels in ggplot2
Hi Eric, you can use an annotate-layer, eg ind<-which(sig>0,arr.ind = T) ggplot(m1.melted, aes(x = Month, y = Site, fill = Concentration), autoscale = FALSE, zmin = -1 * zmax1, zmax = zmax1) + geom_tile() + coord_equal() + scale_fill_gradient2(low = "darkred", mid = "white", high = "darkblue", midpoint = 0) +annotate("rect",ymin=ind[,"row"]-.5,ymax=.5+ind[,"row"], xmin=-.5+ind[,"col"],xmax=.5+ind[,&qu...
2017 Dec 20
1
outlining (highlighting) pixels in ggplot2
I apprecaite the guidance Eik, that works great! I'm also wondering if you have any pointers for how I might stretch the color scale so that the max and min values are the same? Right now, the min is -0.064 and the max is something closer to 0.04. As you can see in what I sent, I tried adding: zmax1 = max(abs(m1)) ggplot(..., autoscale = FALSE, zmin = -1 * zmax1, zmax = zmax1) + ... to
2013 Mar 25
2
Plot Matrix with Data
Hi , I would like to use ggplot2 to plot a matrix as an image. You can copy paste the following Data<-matrix(data=rnorm(900,80,20),nrow=30,ncol=30) lengthOut<-5 Lengths<- 15 library(reshape2) library(ggplot2) tdm <- melt(Data) ggplot(tdm, aes(x = Var2, y = Var1, fill = factor(value)),levels=seq(0,1,by=0.1)) +                   labs(x = "MHz", y =
2013 Jul 18
1
Bland Altman summary stats for all column combinations
...1) { ggplot(subset(melt(cor(x1[sapply(x1,is.numeric)]))[lower.tri(c),],Var1 != Var2), aes(x=Var1,y=Var2,fill=value)) + geom_tile(aes(fill = value),colour = "white") + geom_text(aes(label = sprintf("%1.2f",value)), vjust = 1) + theme_bw() + scale_fill_gradient2(name="R^2",midpoint=0.7,low = "white", high = "red") + xlab(NULL)+ylab(NULL) + theme(axis.text.x=element_blank(),axis.text.y=element_blank(), axis.ticks=element_blank(),panel.border=element_blank()) + ggtitle(x1$Method) + theme(plot.title = element_text(lineheight=1,fa...