Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature-idea]: zcol count parameter #495

Open
sonicseamus opened this issue Nov 20, 2024 · 1 comment
Open

[feature-idea]: zcol count parameter #495

sonicseamus opened this issue Nov 20, 2024 · 1 comment

Comments

@sonicseamus
Copy link

sonicseamus commented Nov 20, 2024

I often have datasets where I would like to visualize the number of occurrences of my zcol variable ("name" in this example), e.g.

Geometry name
(1, 1) "a"
(1, 2) "b"
(1, 3) "c"
(1, 4) "d"
(1, 3) "c"
(1, 1) "a"

and what I want displayed by mapview is really the summarized dataframe:

Geometry name count
(1, 1) "a" 2
(1, 2) "b" 1
(1, 3) "c" 2
(1, 4) "d" 1

where the new "count" column is the one visualized on a scale with zcol. However, it should still display the "name" column when I mouse over the data points for ease of identification.

I could accomplish something close to this by using mapview(df |> dplyr::count(name), zcol = "n", label = "name"), but it might be more intuitive if it could be implemented as a one-step function within the mapview call, perhaps something like mapview(df, zcol = "name", count = TRUE).

@tim-salabim
Copy link
Member

I don't think that fits the scope of mapview. You'd need to create that count object/dataframe yourself before mapviewing it. Otherwise, where will this end? We could also have a e.g. frequency argument and so on... Or am I misunderstanding your request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants