Closed tomgrev closed 4 years ago
I don't know if you still need this. I came across the same problem and I found a solution with the ggnewscale
package: https://eliocamp.github.io/codigo-r/2018/09/multiple-color-and-fill-scales-with-ggplot2/ .
Basically just insert the new_scale("fill")
between the geom_raster
and geom_scatterpie
.
@xzhuo Thanks! Worked like a charm.
Hi,
I am plotting a map using the geom_raster function. Mya data frame "Cruisedf" contains 3 columns: lon, lat and Values. My cooler palette was extracted from the raster of my map generated with dismo.
When I try to plot my pie charts on top of the map created with geom_raster, I have the following error: Error: Discrete value supplied to continuous scale
I could not find another way to have a nice satellite map with the right area on the map that allows me to add pie charts on the map.
Could you help me?
Thanks ggplot()+ geom_raster(data=Cruisedf, aes(x=long,y=lat, fill=Values),show.legend = FALSE)+ scale_fill_gradientn(colors=color_palette)+ labs(title="2015 Arctic Microbiome Sampling Cruise")+ geom_scatterpie(data=CommunityPerc, aes(x=Long,y=Lat), cols=c(Phyla))+ labs(title="2015 Arctic Microbiome Sampling Cruise")