ImSoErgodic / py-upset

A pure-python implementation of the UpSet suite of visualisation methods by Lex, Gehlenborg et al.
314 stars 57 forks source link

How can I control the scientific notation that appears as labels on the bars? #17

Open VincentLa14 opened 7 years ago

popher commented 7 years ago

The 'hack' solution is to edit visualisation.py (in the package).

Edit lines 382 and 385, changing the "%.2g" to a "%.0f" (line 382) and style='sci' to 'plain', and comment out everything after 'y' (line 385).

381for x, y in zip(self.x_values, inters_sizes): 382ax.text(x, y + label_vertical_gap, "%.0f" % y, 383rotation=90, ha='center', va='bottom',size=14)

385ax.ticklabel_format(style='plain', axis='y')#, scilimits=(0, 4))

This will force it to present the vertical bar plot labels as integers. Repeat the second part on 297 if you want to format the "Set Size" part (lower left corner of figure).

I think there will be a way to do it without editing the package, by getting the figure object and changing the tick formatter, but I struggled with that.

Best solution would be a kwarg the user could pass to define if they want scientific or not at the first stage.