Open hraftery opened 3 years ago
Ah, I knew I would break something with making a fix with only a sliver of experience with the package. Turns out my fix breaks for animate_multiple_plots
, not because the legend is a funny figure element rather than part of the axes, but because animate_multiple_plots
re-plots. My fix blows away the legend
argument for good, so it is not good.
Here's a fix that preserves the original argument for subsequent plotting, but only applies to the first frame each time.
97a98,104
> # Added by HR211011. If the user passes "legend=True", only apply to first frame.
> self.kwargs_without_legend = self.kwargs.copy()
> try:
> self.kwargs_without_legend.pop("legend")
> except KeyError:
> pass
>
182c189
< **self.kwargs,
---
> **(self.kwargs if i==0 else self.kwargs_without_legend),
Describe the bug Creating a GeoDataFrame using
geopandas
in a format suitable forplot_animated
applies amatplotlib
colour map to each frame. Inmatplotlib
, to display the colour map on the graph you turn on the "legend". This can be done by passinglegend=True
as an argument to theplot
method.pandas_alive
permits supplying extra arguments toplot_animated
which are passed on toplot
. Unfortunately,matplotlib
draws the colour map legend as another axis, so when used inplot_animated
, each successive frame gets an additional colour map, ruining the effect.To Reproduce This is as per the documention, with the addition of
legend=True
Expected behavior The legend to appear in the animation, as it does for a single call to
plot
.Screenshots
Additional context The following diff on
pandas_alive/geocharts.py
fixes the issue: