Skip to content

adjust_text move all labels out of the graph #899

@aborruso

Description

@aborruso

Hi,
I'm using this input geojson and this code

geo_df['center'] = geo_df.geometry.centroid
geo_df['center_lon'] = geo_df.center.x
geo_df['center_lat'] = geo_df.center.y

(
    ggplot(geo_df)
    + geom_map(aes(fill="costo_per_km2"), color="black", size=0.1)
    + scale_fill_cmap(cmap_name="YlOrRd")
    + geom_label(
        aes("center_lon", "center_lat", label="DEN_REGIONE"),
        size=6,
        color="black",
        boxcolor="white",
        label_size=0.7,
        label_padding=0.25,
        adjust_text={"max_move": 1}
    )
    + labs(fill="Costo €/km²")
    + theme(
        panel_background=element_rect(fill="white"),
        panel_grid=element_blank(),
        axis_text=element_blank(),
        axis_ticks=element_blank(),
        axis_title=element_blank(),
    )
)

I would like to not have the labels overlap. But when I add adjust_text the labels all go out of the graph.
This seems like a bug.

Thanks

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions