Skip to content

Legends of geom_map mistake between size and stroke, and do not obey shape #534

Closed
@ghost

Description

When using geom_map to plot points on a map, the figure panel itself looks perfectly correct. However, the legend seems to mistake the size with the stroke argument. Also, the legend always uses squares for the shape, no matter what value is passed to the shape argument

Here is an example:

import pandas as pd
import geopandas as gpd
import plotnine as p9

df = pd.DataFrame({"x": [0, 1, 2], "y": [2, 1, 0], "group": ["A", "B", "A"]})
geo_df = gpd.GeoDataFrame(df, geometry=gpd.points_from_xy(df.x, df.y))

# Create a plot using geom_map
(
    p9.ggplot(geo_df)
    + p9.geom_map(p9.aes(fill="group"), size=4, stroke=0.5, shape="v")
    + p9.labs(title="Plotted by geom_map")
)

# Create a plot using geom_point (for comparison)
(
    p9.ggplot(df)
    + p9.geom_point(p9.aes(x="x", y="y", fill="group"), size=4, stroke=0.5, shape="v")
    + p9.labs(title="Plotted by geom_point")
)

geom_map

geom_point

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions