You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just discovered plotgardener and think it's an amazing package which is going to save me a lot of time when generating multi-panel plots!
I'm also excited that it works with ggplot out of the box, but had and idea / request which would solve a lot of my frustrations: It would great if it was possible to separate ggplot components (plot, axes, legend, title/labs) and be able to place them as individual components using your framework. I often find myself cutting out a legend and moving it around because it's distorting the layout or it can be shared by multiple plots.
Thanks again for creating this cool package!
PJ
The text was updated successfully, but these errors were encountered:
Thank you for checking out the package and for this awesome idea! We have always played with the idea of having more flexibility with ggplot2, so this would be a great addition. I would love to discuss further how you would envision the implementation of this feature. For example, would one function pull out the desired ggplot component and then this be input to plotGG? Or would it be preferable to have all functionality in one function call (maybe with additional parameters to specifically place the separate elements)? If you have any additional thoughts/contributing code, please let me and my fellow plotgardener developers know in this thread!
I took some time to try and explore this a bit more and it seems the cowplot package already took a stab at this, but unfortunately because they work on a relative scale, it's very hard to get it to fit on the absolute scale that makes plotgardener so great. I have created a reprex below to show you what I mean, but as you can see I had to perform a lot of trickery to get this working, and it would be great if there was a way to make this more intuitive.
library(ggplot2)
library(cowplot)
library(tidyr)
library(plotgardener)
# AIM: Try and put a ggplot legend with dimensions 1x1.5 inch at# absolute position 1,1 on a plotgardener plot#Original ggplotmyPlot<- ggplot(iris %>% pivot_longer(-Species),
aes(x=Species, y=value, fill=name)) +
geom_bar(position='dodge', stat='identity')
myPlot
# Modify legend in preparation for absolute plotting (trial and error values)myPlot=myPlot+
theme(
legend.key.height= unit(0.33, "inch"),
legend.key.width= unit(0.27, "inch"),
legend.margin= margin(-0.2)
)
#Extract legend with cowplot::get_legendplotLegend<- get_legend(myPlot)
#Try and plot with plotgardener at position 1,1 with width of 1 and height of 1.5
pageCreate(width=3, height=3, default.units="inches")
plotGG(plot=plotLegend,
x=1, y=1,width=1, height=1.5)
#> gg[gg1]
Hello,
I just discovered plotgardener and think it's an amazing package which is going to save me a lot of time when generating multi-panel plots!
I'm also excited that it works with ggplot out of the box, but had and idea / request which would solve a lot of my frustrations: It would great if it was possible to separate ggplot components (plot, axes, legend, title/labs) and be able to place them as individual components using your framework. I often find myself cutting out a legend and moving it around because it's distorting the layout or it can be shared by multiple plots.
Thanks again for creating this cool package!
PJ
The text was updated successfully, but these errors were encountered: