Try out Plot Composition in plotnine #929
Replies: 4 comments 3 replies
-
Beta Was this translation helpful? Give feedback.
-
Very nice, is there any documentation at all? Even if its just in code. I would love to test it, but I dont know exactly what to test from a first glance. |
Beta Was this translation helpful? Give feedback.
-
I was playing around with the new composition. First of all: Very nice feature. I was not able to figure out how to change the relative height of plots though if I have many rows. Also I found one small bug where faceting will influence the label position poorly: This works well: from plotnine import *
from plotnine.data import mtcars
p1 = ggplot(mtcars) + geom_point(aes("wt", "mpg")) + labs(tag="a)")
p2 = ggplot(mtcars) + geom_boxplot(aes("wt", "disp", group = "gear")) + labs(tag="b)") + facet_grid("gear ~ .")
p3 = ggplot(mtcars) + geom_smooth(aes("disp", "qsec")) + labs(tag="c)")
(p1 | p2 | p3) But here the labels are misaligned: from plotnine import *
from plotnine.data import mtcars
p1 = ggplot(mtcars) + geom_point(aes("wt", "mpg")) + labs(tag="a)")
p2 = ggplot(mtcars) + geom_boxplot(aes("wt", "disp", group = "gear")) + labs(tag="b)") + facet_grid(". ~ gear")
p3 = ggplot(mtcars) + geom_smooth(aes("disp", "qsec")) + labs(tag="c)")
(p1 | p2 | p3) Thanks again, and hope my report helps you make this composition feature even better. |
Beta Was this translation helpful? Give feedback.
-
Awesome, thanks! I had tried with |
Beta Was this translation helpful? Give feedback.
-
We're working on plot composition (inspired by patchwork) for the next release of plotnine (v0.15.0), and it's now available for early testing! This feature allows you to combine multiple plots into one by placing them side by side, or stacking them using a simple algebra.
Here is an example
If you'd like to try it out before the official release, you can install the development version with:
This will give you the latest
v0.15.0.dev*
v0.15.0a*
~ version.I'm especially looking for feedback as this feature evolves, feel free to share:
Give it a spin and share your thoughts below 👇.
Beta Was this translation helpful? Give feedback.
All reactions