Open jdanbrown opened 8 years ago
Here's an illustration using the sample mpg
data, but it's less compelling because the data happens to be less aligned on axis ticks:
python | R |
---|---|
ggplot(mpg, aes(x='displ', y='hwy')) + \
geom_point() + \
facet_wrap(x='class', scales='free')
|
ggplot(mpg, aes(displ, hwy)) +
geom_point() +
facet_wrap(~class, scales='free')
|
ggplot(mpg, aes(x='displ', y='hwy')) + \
geom_point()
|
ggplot(mpg, aes(displ, hwy)) +
geom_point()
|
Python ggplot (left) adds excessive padding—I'm guessing because it computes tick-aligned limits—whereas R ggplot2 (right) more nicely computes tighter default limits that aren't tick aligned:
It's straightforward to write a layer that computes "tight" limits, but the code I came up with doesn't layer well with
facet(scales='free')
since the data is computes from is the data across all facets, and even then its computed limits appear to only apply to the last facet (#517):Is there a good approach to improving this? Figured I'd ask for pointers before diving too deep into the faceting code.