A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ponnhide/patchworklib/issues/37 below:

Doesn't work with Plotnine Seaborn Theme · Issue #37 · ponnhide/patchworklib · GitHub

Hello,
The following code fails when theme_seaborn is used in plotnine:

from plotnine import *
import pandas as pd
import patchworklib as pw
df = pd.DataFrame(columns=['benchmark', 'technique', 'value', 'platform'])
df.loc[0] = ['BO', 'Item1', 3.0, 'A']
df.loc[1] = ['BO', 'Item2', 2.0, 'A']
df.loc[2] = ['BO', 'Item3', 4.0, 'A']
df.loc[3] = ['BO', 'Item1', 5.0, 'B']
df.loc[4] = ['BO', 'Item2', 2.0, 'B']
df.loc[5] = ['BO', 'Item3', 6.0, 'B']
p1=(
    ggplot(df, aes(fill="technique", y="value", x="value")) + theme_seaborn() + 
    geom_col(stat='identity', position='dodge')
)
p1_b = pw.load_ggplot(ggplot=p1, figsize=(5,4))

with the following error:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[56], line 16
     11 df.loc[5] = ['BO', 'Item3', 6.0, 'B']
     12 p1=(
     13     ggplot(df, aes(fill="technique", y="value", x="value")) + theme_seaborn() + 
     14     geom_col(stat='identity', position='dodge')
     15 )
---> 16 p1_b = pw.load_ggplot(ggplot=p1, figsize=(5,4))

File [~/.local/lib/python3.9/site-packages/patchworklib/patchworklib.py:437](https://file+.vscode-resource.vscode-cdn.net/home/zane/projects/LLNL/hpac_performance/2023-02-01_amdgpu/analysis/~/.local/lib/python3.9/site-packages/patchworklib/patchworklib.py:437), in load_ggplot(ggplot, figsize)
    434 ax.change_aspectratio((figsize[0], figsize[1])) 
    436 if StrictVersion(plotnine_version) >= StrictVersion("0.9"):
--> 437     draw_labels(ax, ggplot, gcp) 
    438     draw_legend(ax, ggplot, gcp, figsize)
    439     draw_title(ax,  ggplot, gcp, figsize)

File [~/.local/lib/python3.9/site-packages/patchworklib/patchworklib.py:273](https://file+.vscode-resource.vscode-cdn.net/home/zane/projects/LLNL/hpac_performance/2023-02-01_amdgpu/analysis/~/.local/lib/python3.9/site-packages/patchworklib/patchworklib.py:273), in load_ggplot..draw_labels(bricks, gori, gcp)
    270 gori.figure._themeable['axis_title_x'] = xlabel
    271 gori.figure._themeable['axis_title_y'] = ylabel
--> 273 gori.theme.themeables['axis_title_x'].apply_figure(gori.figure)
    274 for ax in gori.axs:
    275     gori.theme.themeables['axis_title_x'].apply(ax)

KeyError: 'axis_title_x'

But it does work when theme_seaborn() is commented out. It looks like the plotnine seaborn theme doesn't define theme.themeables['axis_title_x'].


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4