Light Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Plotting order of features #1223

Open
Open
Plotting order of features#1223

Description

Hi, I am experiencing the following issue (using tmap version 4.2 just installed from r-universe):

library(tmap)

FAF5_flows <- readRDS("misc/FAF5_flows.rds") |>
dplyr::arrange(flows)

tm_basemap("CartoDB.Positron", zoom = 4) +
tm_shape(FAF5_flows) +
tm_lines(col = "flows",
col.scale = tm_scale_continuous_sqrt(values = "brewer.yl_or_rd",
values.range = c(0.1, 0.9),
value.na = "grey"),
col.legend = tm_legend("PSL Flows", position = c("left", "bottom"),
frame = FALSE, text.size = 0.8, title.size = 1,
item.height = 2, na.show = FALSE, bg.alpha = 0.7),
lwd = "flows",
lwd.scale = tm_scale_continuous_log(values.scale = 2),
lwd.legend = tm_legend_hide()) +
tm_layout(frame = FALSE, outer.margins = 0)

Created on 2026-02-07 with reprex v2.1.1

I want to creat a clean plot where the important links with large flows are on top, but no matter what I do dplyr::arrange(flows) or dplyr::arrange(desc(flows)), or adding tm_plot_order("lwd"/"col", reverse = FALSE/TRUE) to the plot, I always get the unimportant (low flows values) links on top. File can be downloaded here (10 Mb).

Thanks for looking into this and for a great library!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions