Bug: plot() returns Plot dataclass, not (fig, ax) — breaks documented usage pattern
Author: ardjo-sCreated Aug 21, 2026Updated Aug 21, 2026
Bug: plot() returns Plot dataclass, not (fig, ax) — breaks documented usage pattern
Describe the bug
plot() returns a Plot dataclass, but older documentation, tutorials, and many community examples show fig, ax = prettymaps.plot(...), which raises a TypeError.
To reproduce
fig, ax = prettymaps.plot("Paris, France", radius=1200)
# → TypeError: cannot unpack non-sequence Plot objectExpected behavior
Either the documented usage should match the actual return type, or backward compatibility should be maintained.
Root cause
draw.py line 1263:
@dataclass
class Plot:
geodataframes: Dict[str, gp.GeoDataFrame]
fig: matplotlib.figure.Figure
ax: matplotlib.axes.Axes
background: BaseGeometry
keypoints: gp.GeoDataFrame
# ...
plot = Plot(gdfs, fig, ax, background, keypoints)
return plotSuggested fix
- Update README and all examples to use
plot = prettymaps.plot(...)thenplot.fig.savefig(...). - Consider adding backward-compatible unpacking via
__iter__on thePlotclass:
def __iter__(self):
yield self.fig
yield self.ax- Document the
Plotdataclass fields in the README.
Environment
- prettymaps v1.4.2
- Python 3.10.18 (Homebrew)
- macOS 15, ARM64
Source: marceloprates/prettymaps