dexplo / dataframe_image

A python package for embedding pandas DataFrames as images into pdf and markdown documents
https://dexplo.org/dataframe_image
MIT License
282 stars 41 forks source link

Superscript text not exported properly #42

Closed moyscode closed 1 year ago

moyscode commented 2 years ago

I have a data-frame with some Superscript text crate with the code [cm\N{SUPERSCRIPT THREE}/min] . grafik

However when i export this df as a image with the code below.

import dataframe_image as dfi
dfi.export(styled_df, "resultTable.png"))

It does not get exported properly (pic below). There a weird straight line like character instead of Superscript grafik

Is there workaround for this?

tdpetrou commented 2 years ago

Can you create the superscript without latex? How about using the unicode superscript ³

moyscode commented 2 years ago

I did that too with [cm\u00b3/min] instead of [cm\N{SUPERSCRIPT THREE}/min]. Even with this approach, the table looks correct in Jupyter notebook but after saving it as .png with dataframe_image, the same weird straight line like character is there instead of Superscript.

tdpetrou commented 2 years ago

Can you use the literal character ³ instead of the unicode?

moyscode commented 2 years ago

Same result even with character ³. The same weird straight line like character is there instead of Superscript in the exported .png file.

moyscode commented 2 years ago

Any fix or workaround for this issue?

moyscode commented 2 years ago

Any fix or workaround for this issue?

PaleNeutron commented 1 year ago
converters = ["chrome", "selenium", "matplotlib", "html2image", "playwright"]
for c in converters:
    df_latex = pd.DataFrame(["cm³/mm²"])
    dfi.export(
        df_latex,
        f"c.png",
        table_conversion=c,
    )

Following 5 images are test result. I can not reproduce the bug.

test_superscript chrome test_superscript playwright test_superscript html2image test_superscript matplotlib test_superscript selenium