plotnine
plotnine copied to clipboard
Problem with 'space' argument of facet_grid.
In the example below, the space argument is set to 'free'. We thus expect that heights of panels should vary. It seems they are fixed leading to rows with varying heigth.
Thanks a lot for this very nice port of ggplot2 and for helping.
Best
from plotnine import ggplot, aes, geom_tile, facet_grid
from plotnine.data import mpg
ggplot(mpg, aes(x='model', y='class')) + geom_tile(aes(fill='cty')) + facet_grid('trans ~ drv', scales="free_y", space="free")
The space parameter is currently being ignored. Related to #46.
I had read the documentation and seen that this argument was not properly supported. But it was not clear to which extend it was... This is really problematic in the case of my project which aims at migrating R code producing faceted heatmaps into Python... I will have a look to #46 and related posts to see whether there is any hope to see such a feature implemented in the near future in matplotlib... Thanks.
Hi, Do you plan to support this argument in the upcoming releases ?
The code that deals with facet arrangement and spacing is delicate and finicky, and #46 will not be resolved soon. I'll a little more to see whether the space parameter can be implemented without breaking stuff or creating too much of a mess.
@has2k1 If it's hard to do automatically without a proper layout manager, would it be a good compromise to allow users to specify some multipliers for the panels manually e.g. space={'x': [1,1.5,1], 'y': [2,1]} for a 2x3 facet grid, where the values represent the ratios of panels compared to the default widths? (That'd be similar to the panel spacing option that we already have)
That'd be hugely useful to me, since space='free' is literally the only reason why I fall back to the R implementation when I need it.
Good idea, I will look into it.
On 30/01/21, Gökçen Eraslan wrote:
@has2k1 If it's hard to do automatically without a proper layout manager, would it be a good compromise to allow users to specify some ratios for the panels manually e.g.
space={'x': [1,1.5,1], 'y': [2,1]}for a 2x3 facet grid, where the values represent the ratios of panels compared to the default widths?That'd be hugely useful to me, since space='free' is literally the only reason why I fall back to the R implementation when I need it.
-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/has2k1/plotnine/issues/157#issuecomment-770231177