pdvega icon indicating copy to clipboard operation
pdvega copied to clipboard

How to turn off legend when there are too many columns?

Open BlackArbsCEO opened this issue 7 years ago • 1 comments

Trying to plot a df with 25 columns using the vgplot method results in a legend that extends the graph vertically. How can we implement the pandas plotting behavior of:

df.plot(legend=False)

BlackArbsCEO avatar Feb 02 '18 20:02 BlackArbsCEO

That would require setting the 'legend' property of the associated encoding to None:

data = pd.DataFrame({'x': np.arange(5),
                     'y': np.arange(0, 10, 2)})
plot = data.vgplot.line()
plot.spec['encoding']['color']['legend'] = None
plot.display

vega 1

We could definitely tie this to a legend=False argument in the plot methods.

jakevdp avatar Feb 03 '18 13:02 jakevdp