tdaverse / ggtda

ggplot2 extension to visualize persistent homology
https://tdaverse.github.io/ggtda/
GNU General Public License v3.0
21 stars 6 forks source link

convenience layer to draw a diagonal #39

Closed corybrunson closed 3 years ago

corybrunson commented 3 years ago

Examples currently use + geom_abline(intercept = 0, slope = 1) to draw a diagonal, which requires extraneous detail since the purpose will almost always be to draw a ray emanating from the origin with slope 1. The convenience ggproto GeomDiagonal in this branch packages these settings into the simple + geom_diagonal() layer.

I deliberately made one visual change from geom_abline(), not because i think it's an improvement but because i want the decision to be explicit: Whereas geom_abline() fills the plotting window, geom_diagonal() begins at the origin and does not extend into the third quadrant, since strictly speaking it has no meaning outside Quadrant I. In published papers, the diagonal line almost always fills the plotting window, but this may be due as much to convenience as to choice. Still, i slightly prefer the diagonal line that extends into the third quadrant, though only because it just looks strange otherwise.

Do you have a preference @rrrlw? It seems silly to me to make it a user option, since i think it basically wouldn't matter to most users. Either way, though, this issue is now here for anyone to reopen in future. : )

rrrlw commented 3 years ago

To make sure I understand correctly: if users wanted a diagonal only in quadrant 1, they’d use geom_diagonal; if users wanted a diagonal to fill the plotting window, they’d use geom_abline? (So both options are available)

Tbh, I don’t have a strong preference regarding the diagonal. (PS - code itself looks good and ready to merge)

rrrlw commented 3 years ago

I think I agree with your point that it’s silly to make it an explicit option (e.g. with a parameter in geom_diagonal). Plus, both options are technically do-able, albeit with a different geom, so I think the current form works.