dataframe_image icon indicating copy to clipboard operation
dataframe_image copied to clipboard

Export styled dataframe to png not working with matplotlib

Open MetaHG opened this issue 4 years ago • 11 comments

Hello,

I have run the following example code to export a dataframe to a png, using the "matplotlib" table converter.

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

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

The image is exported without errors (only a warning about the helvetica font not being found). However, when opening the image afterwards, the style of the dataframe has disappeared and a simple dataframe without colors is displayed. On the other hand, when using "chrome" as a table converter, the dataframe is correctly exported with its style. Sadly, in the environement in which I am working, chrome is not available and I can't install it there, so this is not an option.

Is this the "expected" behavior when using matplotlib, or should it work like with chrome, i.e. export dataframe colors too?

MetaHG avatar Jan 12 '21 19:01 MetaHG

+1

rgranit avatar Jan 18 '21 15:01 rgranit

Same behaviour here : I do apply a custom style to make some cells bold, but this does not render in the png

albantor30 avatar Feb 15 '21 18:02 albantor30

have same case here. have you got any solution to it?

DaisyLL avatar Jun 05 '21 14:06 DaisyLL

@tdpetrou HI sorry to trouble you. Have you got the porblem same with us . Export styled dataframe to png not working with matplotlib

DaisyLL avatar Jun 05 '21 14:06 DaisyLL

+1

kritiagg avatar Jun 10 '21 19:06 kritiagg

+1

doogfood-snap avatar Nov 03 '21 09:11 doogfood-snap

Same problem here. Using the library on Google Colab, with the Matplotlib convertre all formatting is lost.

paluigi avatar Dec 21 '21 23:12 paluigi

Same

Aks1623 avatar Jul 04 '22 18:07 Aks1623

Same issue here as well. Working on a data notebook platform and only the un-styled matplotlib converter working.

srini047 avatar Jul 25 '22 17:07 srini047

+1

kmyqchy avatar Aug 25 '22 02:08 kmyqchy

Im having the same problem as well

yamiyukiharu avatar Sep 18 '22 09:09 yamiyukiharu

+1

florentcomte avatar Dec 13 '22 10:12 florentcomte

I'll diagnose it later, but it seems a limitation of matplotlib.

PaleNeutron avatar Dec 15 '22 16:12 PaleNeutron

Hi guys, Any updates for the export styled data frame using matplotlib table conversion?

peanutbutter97 avatar Mar 06 '23 10:03 peanutbutter97

Hi @PaleNeutron - any update on that ?

valerianrossigneux avatar Mar 09 '23 05:03 valerianrossigneux

Run into this problem as well

paulhybryant avatar Mar 22 '23 15:03 paulhybryant

Deploying a styled dataframe object using chrome table converter does not work here; produces an image, but only a thin strip of what looks like the very top of the expected image. Deploying the matplotlib table converter does produce an image, but has similar issues to those described above; specifically colour stying disappears.

agftrading avatar Mar 22 '23 17:03 agftrading

Supported now!

PaleNeutron avatar Aug 29 '23 02:08 PaleNeutron

Nice! Thanks a lot. Is it released?

paulhybryant avatar Aug 29 '23 07:08 paulhybryant

@paulhybryant Already released.

PaleNeutron avatar Aug 29 '23 07:08 PaleNeutron

Thanks!

paulhybryant avatar Aug 29 '23 08:08 paulhybryant