bioRad
bioRad copied to clipboard
bioRad ggmap objects cannot be customized fully with ggplot
@adokter can you be more precise about which plotting methods or when this happens?
For the plot.scan
method:
library(bioRad)
library(ggplot2)
data(example_scan)
myplot <- plot(example_scan, param = "DBZH") +
theme_bw()
myplot
Similar to plotting ppi:
data(example_scan)
ppi <- project_as_ppi(example_scan)
myplot <- plot(ppi)+
theme_bw()
myplot
Notice:
The output of plot.vp
, plot.vpi
and plot.vpts
are not ggplot objects.
I was thinking specifically of changing the color palette of the plot, which is problematic. i.e. I can't add a statement + scale_fill_gradientn( ....)
to change to color gradient
color gradients are defined here
ok, this works for me (please, no comments on color choice ;-)):
# plot scan
data(example_scan)
myplot <- plot(example_scan, param = "DBZH") +
scale_fill_gradientn(
colours = c(
"black", "grey",
"blue", "darkblue", "green",
"orange"
)
)
myplot
You get a warning about the overwriting of an existing color scale though:
Scale for 'fill' is already present. Adding another scale for 'fill', which will replace the existing scale.
but that is just informative
Really ugly colors though
The problem occurs only with ggmapping, not ggplotting:
my_ppi=project_as_ppi(example_scan)
my_map=basemap(my_ppi)
map(my_ppi,my_map) + scale_fill_gradientn(
colours = c(
"black", "grey",
"blue", "darkblue", "green",
"orange"
)
)
map
command for ppi's is coded here. Could the suppressWarnings()
statement cause the problem?
maybe related to this
The problem is that we use inset_raster
to overlay the data on the map. inset_raster
requires the datapoints to be already hex color values. Therefore in bioRad::map
the data are converted to hex values, after which they can't be modified anymore
Seems to address this we need a different solution than inset_raster
that is equally fast (preferably faster).