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

python
fig, ax = prettymaps.plot("Paris, France", radius=1200)
# → TypeError: cannot unpack non-sequence Plot object

Expected behavior

Either the documented usage should match the actual return type, or backward compatibility should be maintained.

Root cause

draw.py line 1263:

python
@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 plot

Suggested fix

  1. Update README and all examples to use plot = prettymaps.plot(...) then plot.fig.savefig(...).
  2. Consider adding backward-compatible unpacking via __iter__ on the Plot class:
python
def __iter__(self):
    yield self.fig
    yield self.ax
  1. Document the Plot dataclass fields in the README.

Environment

  • prettymaps v1.4.2
  • Python 3.10.18 (Homebrew)
  • macOS 15, ARM64

Source: marceloprates/prettymaps