gt.save()
not rendering dash character correctly ("-")
#630
-
I am trying to render a table as a png, but it seems to be having issues with some negative numbers in the table. When I render the table in a browser with I am creating the table from a pandas data frame table = (
GT(pitcher_report)
.tab_header(title='Pitch Stats') # Table title
.tab_spanner(label='Usage', columns=['Frequency', 'Uses']) # Column group for 'Frequency' and '# uses'
.tab_spanner(label='Velocity (MPH)', columns=['RelSpeed', 'Max']) # Column group for 'Avg velo' and 'Max velo'
.tab_spanner(label='Movement (Inches)', columns=['InducedVertBreak', 'HorzBreak']) # Column group for 'IVB' and 'HB'
.tab_spanner(label='Release (Feet)', columns=['RelHeight', 'RelSide', 'Extension']) # Column group for 'Height', 'Side', and 'Extension'
.cols_label(RelSpeed='Avg', InducedVertBreak='IVB', HorzBreak='HB', RelHeight='Height', RelSide='Side', Extension='Ext', SpinRate='Spin Rate') # Relabeling columns for readability
.tab_stub(rowname_col='TaggedPitchType') # Row labels
.fmt_percent(columns='Frequency') # formatting Frequency as %
.fmt_number(columns=['RelSpeed', 'Max', 'SpinRate'], decimals=1) # formatting columns to 1 decimal place
.fmt_number(columns=['InducedVertBreak', 'HorzBreak'], pattern='{x}"', decimals=1) # formatting inches columns
.fmt_number(columns=['RelHeight', 'RelSide', 'Extension'], pattern="{x}'", decimals=1) # formatting feet columns
.opt_stylize(style=1, color='blue')
)
table.show()
table.save('table.png') Any ideas on why this is happening? Also occasionally, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
As I have continued to play around with it, it seems to be caused by the formatting methods. When I comment out the Again, the issue only appears in the png that gets saved by |
Beta Was this translation helpful? Give feedback.
@nedransfield, could you please try using the latest version, "v0.17.0," to see if the issue is resolved?