I tried to plot Jakarta's map based on the district.
fig, ax = plt.subplots(1, figsize=(4.5,10))
jakarta_mandiri_planar.plot(ax=ax, column='Kecamatan', legend=True, legend_kwds={'loc':'center left'})
leg= ax.get_legend()
leg.set_bbox_to_anchor((1.04, 0.5))
I plotted the legend on the right of the map, but I think it's too long. Can I make the legend into two or three columns? If so, how?
Use the ncols
keyword:
df.plot(column="NAME", cmap="tab20", legend=True, figsize=(8,8))
df.plot(column="NAME", cmap="tab20", legend=True, figsize=(10,10),
legend_kwds={"ncols":2, "loc":"lower left"})