ponnhide / patchworklib

Patchwork for matplotlib: A subplot manager for intuitive layouts in matplotlib, seaborn, and plotnine.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The position of the title cannot be set in plotnine.

CaoTianze opened this issue · comments

Hi ponnhide. I want to set the title to the left. This is used to tag the image.

from plotnine import ggplot, geom_point, aes, ggtitle, theme, element_text
from plotnine.data import mtcars
import patchworklib as pw
ggplot(mtcars, aes('wt', 'mpg', color='factor(gear)'))+ geom_point()+ggtitle('A')+theme(plot_title=element_text(size=30,ha='left'))
ggplot(mtcars, aes('wt', 'mpg', color='factor(gear)'))+ geom_point()+ggtitle('B')+theme(plot_title=element_text(size=30,ha='left'))
A=ggplot(mtcars, aes('wt', 'mpg', color='factor(gear)'))+ geom_point()+ggtitle('A')+theme(plot_title=element_text(size=30,ha='left'))
B=ggplot(mtcars, aes('wt', 'mpg', color='factor(gear)'))+ geom_point()+ggtitle('B')+theme(plot_title=element_text(size=30,ha='left'))
section1=pw.load_ggplot(A)|pw.load_ggplot(B)
section1.savefig()

However, the title can be left in plotnine. but it is still in the center in patchworklib.

I experienced the same problem. After calling pw.load_ggplot, all titles are in the center.
patchworklib 0.5.2
plotnine 0.10.1
matplotlib 3.6.3