Adjusting your hexagon plot
Previously, we learned how to give life to simple hexagon plots using ggplot2
and coerce them into plotly
. We took a bunch of default settings rather than customized ones. This recipe is going to show the readers some core parameters to tweak. We could, for example, resize the hexagons and/or choose different color scales and breaks.
Getting ready
In order to make the changes very clear, we're going to elaborate on the previous recipe, so the requirements from it still remain. There's no need to go back, as the following code will fulfill our needs if internet connection is available:
> if( !require(robustbase)){ install.packages('robustbase')} > library(robustbase) > data(NOxEmissions)
Let's roll.
How to do it...
Following code is changing hexagons size and colors:
- We start the same way as in the previous case, but we set up the
binwidth
parameter and call for an object from thescale_fill
group:
> ggplot(data = NOxEmissions, aes( x = LNOx, y = sqrtWS))...