1

I am plotting using this:

myPalette <- colorRampPalette(rev(brewer.pal(10, "Spectral")))
usamap <- map_data("state")
ggplot(data=tmpsub,aes(x=col,y=row,color=m)) + 
  geom_point()+
  scale_colour_gradientn(name = "Test",colours = myPalette(10), limits=c(0,1))+
  geom_polygon( data=usamap, aes(x=long, y=lat,group=group),size=0.3, colour="black",fill=NA)+
  xlab('Longitude')+
  ylab('Latitude')+
  coord_map("albers", lat0=39, lat1=45)+
  theme_bw()+
  theme(legend.position = c(.93,.20),
        panel.grid = element_blank())

To get this map

enter image description here

How can I "shift" the middle portion of the legend upwards? That is, I want the yellow portion (~0.5) to go upwards so that I can have more blue and less red in the figure.

maximusdooku
  • 5,242
  • 10
  • 54
  • 94
  • @pascal Not sure what happened, but all comments and your answer got deleted. – maximusdooku Dec 09 '15 at 07:48
  • I deleted as it doesn't answer your question. –  Dec 09 '15 at 07:49
  • Thank you. It was still helpful as I wasn't aware of that feature. Hope someone can answer this one too. – maximusdooku Dec 09 '15 at 07:50
  • 2
    If I understand you correctly, you may have a look at `values = rescale(...)` argument in `scale_colour_gradientn`, as described e.g. [here](http://stackoverflow.com/questions/20581746/small-value-variation-invisible-using-scale-colour-gradient2/20584038#20584038) and [here](http://stackoverflow.com/questions/21758175/is-it-possible-to-define-the-mid-range-in-scale-fill-gradient2/21758729#21758729). Then you can "increase the resolution" of the scale in a certain range of your values. – Henrik Dec 09 '15 at 07:51
  • Great! I was able to figure it out. Thanks! – maximusdooku Dec 09 '15 at 08:04
  • @maximusdooku OK, great that it worked. Then I close as a dupe. – Henrik Dec 09 '15 at 08:05

0 Answers0