Skip to content

Unable to add usmap$layer to ggplot object #43

@SvbZ3r0

Description

@SvbZ3r0

Describe the bug
As I understand it, currently the only way to have county data and state data in the same map is to create the maps separately, extract their layers and add it to a single ggplot object.
However, this method throws an error.

Simplest code to reproduce

ggplot() +
  plot_usmap()$layers[[1]]

Error

Error in FUN(X[[i]], ...) : object 'x' not found

Environment:

  • Windows 10 x64
  • R v4.0.3
  • ggplot2_3.3.2
  • usmap_0.5.1

Additional info
This method is also the only way to add multiple levels of data on the same map. So this should be looked into regardless of #26

Metadata

Metadata

Assignees

Labels

bugA bug or issue that should be resolved

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions