[R] How can I make the legend in ggplot2 the same height as my plot?

Kristi Glover kristi.glover at hotmail.com
Thu Jul 6 00:13:03 CEST 2017


Hi R Users,

I tried to increase the legend height in ggplot2, but it did not respond at all using the follwoing code. Do you have any suggestions for me?



dat<-data.frame(temperature)

P1<-ggplot(dat, aes(X, Y))

Scenario1<-P1+geom_point(aes(colour = value), size = 1)+ theme_bw()+ theme(axis.text.x = element_blank(),axis.text.y = element_blank())

Scenario1<-Scenario1+facet_wrap(~variable, ncol=2)+scale_color_gradientn(colours = rainbow(48))

Scenario1+guides(fill = guide_colorbar(bar width = 1.5, barheight = unit(10, "mm")))


Thanks,

KG


	[[alternative HTML version deleted]]



More information about the R-help mailing list