Skip to content

Map_data() documentation has what seems like a typo #4278

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

Closed
ericopatto opened this issue Dec 1, 2020 · 1 comment · Fixed by #4303
Closed

Map_data() documentation has what seems like a typo #4278

ericopatto opened this issue Dec 1, 2020 · 1 comment · Fixed by #4303
Labels
documentation good first issue ❤️ good issue for first-time contributors

Comments

@ericopatto
Copy link

This is not a complicated problem. In the reference page for the function map_data() (here), the example has the following call:

ggplot(choro, aes(long, lat)) +
  geom_polygon(aes(group = group, fill = assault)) +
  coord_map("albers",  at0 = 45.5, lat1 = 29.5)
}

And then later, there is something slightly different.

However, the call coord_map() should have lat0 instead of at0 as an argument (in both examples):

ggplot(choro, aes(long, lat)) +
  geom_polygon(aes(group = group, fill = assault)) +
  coord_map("albers",  lat0 = 45.5, lat1 = 29.5)
}

It works either way, since the name doesn't seem to matter here, but it's rather confusing.

I hope I'm doing this right. I've never used GitHub before, so maybe I'm wrong about something (maybe I'm filing it in the wrong place)... I just think this should be pointed out somewhere.

@yutannihilation
Copy link
Member

Good catch. I too think it's a typo, but it seems it doesn't matter what names we use. These arguments are passed to parameters argument of mapproj::mapproject(), and then converted as a double vector.

https://github.com/cran/mapproj/blob/1307e2c77a8bfa3e41ffe7eee773b487fdc7a195/R/mapproj.r#L46

I don't check the source of the C code, but probably it doesn't use the names, as the example shows unnamed forms:

map("state",proj="albers",par=c(30,40))

A pull request to fix this is welcome, but I would also note that we are moving away from coord_map(). (c.f. #3721)

@yutannihilation yutannihilation added documentation good first issue ❤️ good issue for first-time contributors labels Dec 2, 2020
karawoo pushed a commit that referenced this issue Dec 28, 2020
Co-authored-by: Heath <heathgilham@gmail.com>
sthagen added a commit to sthagen/tidyverse-ggplot2 that referenced this issue Dec 29, 2020
Fixed typo in map_data() documentation (tidyverse#4278) (tidyverse#4303)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation good first issue ❤️ good issue for first-time contributors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants