Open ajpelu opened 1 month ago
Hi @ajpelu , what about this example below?
The main idea is to first apply the transformation to the data and then use it to plot:
library(plotbiomes)
library(ggplot2)
data(Whittaker_biomes)
# Transform cm to mm in data (or whatever transformation you may have), then do the custom plotting
Whittaker_biomes$precp_mm <- Whittaker_biomes$precp_cm * 10
plot_1 <- ggplot() +
# add biome polygons
geom_polygon(data = Whittaker_biomes,
aes(x = temp_c,
y = precp_mm,
fill = biome),
# adjust polygon borders
colour = "gray98",
size = 1) +
# fill the polygons with predefined colors
scale_fill_manual(name = "Whittaker biomes",
breaks = names(Ricklefs_colors),
labels = names(Ricklefs_colors),
values = Ricklefs_colors) +
scale_x_continuous(expression("Temperature " ( degree*C))) +
scale_y_continuous('Precipitation (mm)') +
theme_bw()
plot_1
Ok, Thanks @valentinitnelav. It works.
hi @valentinitnelav Thanks for your pkg. Is there any way to customize the axis (change the labels of the axis, or the units)? For instance, I'm interested in plot the precipitation axis in mm not in cm. Is there any way to do it? I tried this, but it does not work
I got the message:
Any advice? Thanks