Using ggplot I want to plot straight lines of the form ax + by + c = 0, where the three parameters are generated by my code. If neither a nor b are zero, ggplot requires me to use geom_abline
but if a = 0 or b = 0, I'd need to use geom_vline
or geom_hline
respectively.
It is messy to have to test a=0 and b=0 to select the right geom. What I'd really like is a geom like this:
geom_line(x_param = a, y_param = b, const = c)
but it does not seem to exist.
Is there a non-messy solution to my problem?