Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

table_conversion='matplotlib' and set_table_styles #106

Open
florentcomte opened this issue Oct 25, 2023 · 3 comments
Open

table_conversion='matplotlib' and set_table_styles #106

florentcomte opened this issue Oct 25, 2023 · 3 comments
Assignees
Labels
bug Something isn't working matplotlib

Comments

@florentcomte
Copy link

Hi,

I created a table with a style and I tried to export in png with the conversion = 'matplotlib'. Unfortunately, I do not see the style in my png.

Thank you for your help.

Here is my code:

import dataframe_image as dfi
import pandas as pd
import numpy as np

col_headers = {
    "selector": ".col_heading, thead",
    "props": "color: white; background-color: #1d5632; \
            font-size: 11px"
    }

        
df = pd.DataFrame(np.random.rand(6, 4))
df_styled = df.style.set_table_styles(styles)
dfi.export(df_styled, 'df_styled.png', table_conversion='matplotlib')

Exported png:
df_styled

df_styled in Jupyter:
Capture d’écran 2023-10-25 à 12 59 15

@PaleNeutron
Copy link
Collaborator

Confirmed, dealing.

@PaleNeutron PaleNeutron added bug Something isn't working matplotlib labels Oct 26, 2023
@PaleNeutron PaleNeutron self-assigned this Oct 26, 2023
@lip99-TW
Copy link

I have a similar issue, the effect of style.bar is not showing up in the image.

df_fmt = df.style.bar(subset=['Prob(%)'], color=["green","red"], align="zero")
dfi.export(df_fmt, pngfile, table_conversion='matplotlib')

@omes11
Copy link

omes11 commented Feb 15, 2024

Bump on this issue... love the package/super cool and useful

I am creating a table with pretty_html_table package and same as posters above its losing all table style properties upon exporting:

desired:

Screenshot 2024-02-15 at 6 19 05 AM

actual:

Screenshot 2024-02-15 at 6 19 31 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working matplotlib
Projects
None yet
Development

No branches or pull requests

4 participants