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

ggsegJHU visualisation problem #1

Open
crojrj opened this issue Feb 16, 2022 · 3 comments
Open

ggsegJHU visualisation problem #1

crojrj opened this issue Feb 16, 2022 · 3 comments

Comments

@crojrj
Copy link

crojrj commented Feb 16, 2022

I am getting following error:
Error in CPL_geos_is_empty(st_geometry(x)) :
Evaluation error: IllegalArgumentException: Points of LinearRing do not form a closed linestring.

After trying this:
plot(jhu) +
theme(legend.position = "bottom",
legend.text = element_text(size = 7)) +
guides(fill = guide_legend(ncol = 2))

@npenzel
Copy link

npenzel commented Mar 28, 2022

Hi,
I am having the same problem. Did you find a solution by now?
Best, Nora

@crojrj
Copy link
Author

crojrj commented Mar 30, 2022

Worked for me:
p2 <- ggplot(data=jhu$data$geometry) + geom_sf(aes(fill=jhu$data$region))
p2 <- p2 + theme(legend.position = "bottom",
legend.text = element_text(size = 7)) +
guides(fill = guide_legend(ncol = 2))

just replace fill with your data.

@crojrj
Copy link
Author

crojrj commented Mar 30, 2022

this line also might be needed:
jhu$data$geometry <- st_sf(st_cast(jhu$data$geometry, "POLYGON"))

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