toyplot icon indicating copy to clipboard operation
toyplot copied to clipboard

Set default table column widths based on content.

Open kannes opened this issue 8 years ago • 3 comments

data_table = toyplot.data.read_csv("/usr/share/gdal/stateplane.csv")
data_table = data_table[:10]
canvas = toyplot.Canvas()
table = canvas.table(data_table)

gives me

untitled

You can see that there is no visible margin between the STATE and ZONE columns (at the bottom "CALIFORNIAIII" instead of "CALIFORNIAIII" and the headers of PROJ_METHOD DATUM as well as USGS_CODE and EPSG_PCS_CODE overlap.

I know I can manually edit the column widths, but it would be nice if the default was not overlapping, focusing on safe readability.

kannes avatar Jul 31 '17 08:07 kannes

I just realised the output when used directly in a Jupyter Notebook shows what I mean. untitled

kannes avatar Jul 31 '17 08:07 kannes

Until recently we had no way to know the width of column text. Now that we handle all text layout internally, there's no reason not to set the column width based on content.

tshead2 avatar Aug 01 '17 16:08 tshead2

Same goes for default row heights ... it would be nice if row heights were appropriate for their content. The only caveat is that we have to maintain the ability to explicitly size the table.

tshead2 avatar Apr 03 '19 22:04 tshead2