Search code examples
rplotvisualizationbinningsymmetry

R - Symmetry with hexbin


I plot two hexbin graphs with R (with package 'hexbin') from data file with two columns gr and ug.

The first plot : gr as a function of ug

The second plot : ug as a fonction of gr

Why aren't they perfectly symmetrical?

Thanks in advance


Solution

  • Notice that in both cases the hexagons are oriented to have 2 sides vertical and no sides horizontal. To be perfectly symmetric one of the plots would need to have the rotated hexagons (2 sides horizontal).

    So the binning is slightly different between the 2 graphs and points that are near the boundary in the 1st plot may fall into a different cell (symmetrically) in the 2nd plot. So while the 2 plots are similar overall you will see some minor differences due to how the data is binned.

    This is true in general for plots/techniques that depend on binning continuous data, a slight change to how the binning is done will results in usually minor changes in the results. It is good to do multiple plots with small changes to the options that determine the binning to see how much things change.