My dataframe is as follows
sos eos dataset site year
171 280 PhenoCam Pheno_alligator 2016
130 275 PhenoCam Pheno_alligator 2017
149 277 PhenoCam Pheno_harvard2 2016
156 259 Landsat Landsat_alligator 2016
157 247 Landsat Landsat_alligator 2017
134 294 Landsat Landsat_harvard2 2016
154 286 MODIS MODIS_alligator 2016
and the data continues with 1000+ entries. There are four datasets total in dataframe site_type, with three years (2016, 2017, 2018). I want to make a scatterplot in ggplot of PhenoCam vs Landsat, using their sos values but can't figure out how to properly set the aes
to get PhenoCam sos as the y-axis values and Landsat sos as the x-axis values. This scatterplot will be used to show RMSE and R, so, for example, sos for Pheno_alligator year 2016 needs to plot against Landsat_alligator year 2016.
I know normally the code would be something like this
ggplot(site_type, aes(Landsat, PhenoCam)) +
geom_point()
but the fact that they are in the same column with multiple things going on is throwing me off. I will be making 6 scatterplots total, (PhenoCam vs each dataset for both sos and eos) but only need guidance on one. Thank you!
eos
to provide an ID ? if so, you can reshape your data into a longer formatdf %>% pivot_wider(-eos, names_from = dataset, values_from = sos)
– dc37