Manual Scale in ggplot2Megan KressOctober 5, 2016
Manual ScaleIf you are want to use ggplot2 to plot two different data frames, you probably want the two data frames to be represented by different colors. Using the geom_point function, you can easily assign different colors to the different sets of data, but creating a legend for two different data frames in one ggplot is more less intuitive. The code below explains how to take two data frames and plot them together with a legend that explains the colors for each of the data sets. This code uses teh scale_colour_manual function from ggplot2.
R Code
0 Comments
Leave a Reply. |
Spatial Ecology @ MSUClick on "Category" below to search for R code compiled by the Zarnetske Spatial & Community Ecology Lab and students in MSU's Spatial Ecology graduate course (FOR870/FW870) Category
All
Archive
October 2016
|