I cant figure out how to plot the difference between two variables, female and male, I want to make a dotplot of female - male.
my attempts so far are:
MyData$earn_diff <- MyData$female - MyData$male
gf_point( ~(female - male), data=MyData)
gf_point( ~(myData$female - myData$male)
both plots resulted in Error: Invalid formula type for gf_point
.
The issue is that
ggformula::gf_point
provides a formula interface forgeom_point
and hence requires both anx
and ay
aesthetic aka a two sided formula, using1 ~ ...
orfactor(1) ~ ...
will do: