0

I need to map two separate data sets, methane and ethane emissions, on the same map using ggmap. Here's a head of the data:

    DateTime     CH4(ppm)      C2H6(ppb) Latitude Longitude
1 2021-08-03 07:44:03 2.17380  -9.98494 44.26121 -88.40225
2 2021-08-03 07:44:03 2.16387  -9.39870 44.26121 -88.40225
3 2021-08-03 07:44:03 2.17527  -8.66678 44.26121 -88.40225
4 2021-08-03 07:44:03 2.17296 -10.03360 44.26121 -88.40225
5 2021-08-03 07:44:03 2.17209  -8.59478 44.26121 -88.40225
6 2021-08-03 07:44:03 2.17254  -8.43455 44.26121 -88.40225

My attempt thus far has been to try to separate the data into two different data frames with the following code:

Methane_Data <- aeris_data[,-c(1:33,35:45)] %>% 
  mutate(species = "Methane")
colnames(Methane_Data) <- c("Concentration", "Latitude", "Longitude", "Species")

Ethane_Data <-  aeris_data[,-c(1:35,37:45)] %>% 
  mutate(species = "Ethane")
colnames(Ethane_Data) <- c("Concentration", "Latitude", "Longitude", "Species") 

and then attempting to rbind them like this:

Species_Data <- rbind(Methane_Data, Ethane_Data) 

However, this only produces a map with one giant emissions scale that combines two different units (ppb and ppm), and understandably so. I just don't know how to go about this code other than this.

For reference, here's the map code I'm using:

Map <- get_map(location=c(lon=map_long, lat=map_lat), source="google", maptype="satellite", zoom=map_zoom)

Map_Plot <-ggmap(Map, extent = "panel", ylab = "Latitude", xlab = "Longitude")

Map_Plot + geom_point(data = Species_Data, aes(x = as.numeric(Longitude), y = as.numeric(Latitude), color = Concentration), size = 1, alpha = 0.5) +
  scale_colour_gradientn(colours = myPalette(100), name = map_color_units_ethane) +
  labs( y = "Latitude", x = "Longitude", title = "Ethane 08-03-2021") + 
  theme(plot.title = element_text(size = rel(2))) + 
  theme(axis.title.x = element_text(size = rel(1.5))) +
  theme(axis.text.x = element_text(size = rel(1))) +
  theme(axis.ticks.length = unit(1, "cm")) +
  theme(axis.text.y = element_text(size = rel(1))) +   
  theme(axis.title.y = element_text(size = rel(1.5), angle = 90)) +
  theme(legend.position = c(1.3, .5))

Thanks to anyone who can help.

Seanie_13
  • 21
  • 6
  • How do you plan to plot two different datasets? Facets, [two color legends](https://stackoverflow.com/a/18350495/3048453), or do you have some other approach? – David Aug 04 '21 at 13:44
  • The plan is two different color legends, which is another issue with what I tried. – Seanie_13 Aug 04 '21 at 13:45

0 Answers0