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

Column size calculation needs to be user adjustable. #113

Open
Erotemic opened this issue May 8, 2024 · 1 comment
Open

Column size calculation needs to be user adjustable. #113

Erotemic opened this issue May 8, 2024 · 1 comment

Comments

@Erotemic
Copy link

Erotemic commented May 8, 2024

It looks like there are some heuristics in the code that computes column sizes when rendering the HTML to an image. The following MWE shows the issue I'm running into:

import dataframe_image as dfi
import pandas as pd

text = '{"Eval 21":{"pipe":"BAS+SC","bas_pxl.model.channels":"(L8,PD,S2,WV):BGR","bas_pxl.package_fpath":"Drop8_Median10GSD_allsensors_<tuned>_V7_epoch187_step2632","bas_poly.thresh":0.35,"bas_poly.time_thresh":0.8},"Eval 21b":{"pipe":"BAS","bas_pxl.model.channels":"(L8,PD,S2,WV):BGR","bas_pxl.package_fpath":"Drop8_ARA_Median10GSD_allsensors_pointannsv1_v1_epoch56_step4788","bas_poly.thresh":0.39,"bas_poly.time_thresh":0.75}}'
df = pd.read_json(text)
fpath = 'foo.png'
dfi.export(
    df.style,
    fpath,
    table_conversion='matplotlib',
    fontsize=12,
    max_rows=-1,
    dpi=None,
)
import subprocess
subprocess.call(f'eog {fpath}', shell=True)

This results in a column being cutoff:

foo

If I mess with the fontsize I can get it to work reasonably well. But it would be nicer to either fix the heuristics to work in this case (which may not be possible, I've glanced at them, but haven't seen if they attempt to always well-size the columns), or give the user some means to adjust the multiplier used on each column or something like that.

I'd like to put in a fix for this, but I need feedback on what the right API should be.

@PaleNeutron
Copy link
Collaborator

If you mean the second cell of index column is cutoff, I think you could refer this fix #90

I fix bold column header width but I'm not should if it applied to all cell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants