Currently we have the following parametrisation for rectangles:
geom_tile() has x, y, width and height.
geom_rect() has xmin, xmax, ymin and ymax.
If you know two of the x or y related aesthetics, you can compute the rest regardless of which two are known. For example, if you know xmin and width, you can compute xmax = xmin + width.
Being able to abitrarily pick two aesthetics with the others imputed allows for more flexibility. For example the following two options for visualising the presidential dataset are both horrifying.
Using geom_rect() option, you're forced to manually resolve a discrete y into a continuous y and hack a continuous scale to look like a discrete scale:
In the above cases, the ideal parameterisation is xmin = start, xmax = end, y = name, height = 0.8, but this currently isn't possible. Besides this, sometimes you might also wish to use mixed parameters and use, for example, ymin and height together.
Currently we have the following parametrisation for rectangles:
geom_tile()
hasx
,y
,width
andheight
.geom_rect()
hasxmin
,xmax
,ymin
andymax
.If you know two of the
x
ory
related aesthetics, you can compute the rest regardless of which two are known. For example, if you knowxmin
andwidth
, you can computexmax = xmin + width
. Being able to abitrarily pick two aesthetics with the others imputed allows for more flexibility. For example the following two options for visualising thepresidential
dataset are both horrifying.Using
geom_rect()
option, you're forced to manually resolve a discretey
into a continuousy
and hack a continuous scale to look like a discrete scale:Using the
geom_tile()
option you're forced to reparametrise the intervals, which can be a real pain for some classed objects like dates.Created on 2024-04-24 with reprex v2.1.0
In the above cases, the ideal parameterisation is
xmin = start, xmax = end, y = name, height = 0.8
, but this currently isn't possible. Besides this, sometimes you might also wish to use mixed parameters and use, for example,ymin
andheight
together.