ImSoErgodic / py-upset

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

Provide parameter for axis object or change plot size in plot function #11

Open cschaerfe opened 7 years ago

cschaerfe commented 7 years ago

I was wondering if there is a way of passing the axis or figure the plot should be created in - similarly to how seaborn handles it? I have not seen anything like this in the code, but was wondering if I missed something - specifically for providing the figuresize etc?

popher commented 6 years ago

If you call the plot function and store it in a variable, you can get access to the figure and axes.

upset = pyu.plot(df_dict)

You can see what 'items' are returned with upset.items() - its a dictionary You can 'get' any of these with upset.get(), i.e. `upset.get('figure') will return the figure.

fig = pyu.plot(df_dict).get('figure')

The axes (4 of them in a normal plot) can be called with

ax = fig.get_axes() Though note this returns a list... You could alternatively get each axes with fig = pyu.plot(df_dict).get(name) where name is one of 'intersection_bars', 'intersection_matrix', 'base_set_size', or 'names'. Additional plots are 'additional' if you have them.

I hope that helps? It could be much more straightforward (like seaborn), I agree.