Skip to content

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

Closed

Description

@ericopatto

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.

Activity

  1. yutannihilation commented on Dec 1, 2020

    @yutannihilation
    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)

  2. added
    good first issue ❤️
    on Dec 2, 2020
  3. added a commit that references this issue on Dec 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationgood first issue ❤️

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions