-
Notifications
You must be signed in to change notification settings - Fork 16
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
Hexisticker - with regions #386
Merged
RichardMN
merged 11 commits into
epiforecasts:hexisticker
from
RichardMN:hexisticker-regions
Jun 23, 2021
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b849240
qualify covidregionaldata when loading available datasets
sbfnk 3b18401
Merge pull request #385 from epiforecasts/fix_namespace
seabbs a137ddf
Initial work to show regions for countries where we have regional data
RichardMN 57d20c9
Initial work to show regions for countries where we have regional data
RichardMN 88f7116
Merge branch 'hexisticker-regions' of https://github.com/RichardMN/co…
RichardMN a6beb0a
Add link to regional maps
RichardMN 628a22f
Update README.md
RichardMN 5a11397
Fixed separation of countries with level 1 and level 2 data
RichardMN 2815431
Merge remote-tracking branch 'upstream/master' into hexisticker-regions
RichardMN ce0214d
Outlines added to supported countries, palette adjusted, code reorgan…
RichardMN ea6a48e
Change outlines to be lines, reorder display, remove commented code
RichardMN File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we put the borders back in around the countries we have data for? I think this will help make them stand out, particularly for the blue countries against the blue background.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With some meddling I've managed to put borders back in but they're currently red and I've not figured out why.
The polygons provided by the
ne_states
call don't know which of their edges are "external" so there's no straightforward way to draw the outlines of the countries using this geometry.We could try drawing outlines just on some of the countries using the underlying system, and this may be a simpler approach.
The current approach is to draw all countries, then draw the supported countries with a wide outline (I have not figured out how to have an empty fill, sorry), then draw the regions of the supported countries.
Currently the outline of the country is reddish pink and I've not managed to fix that either. I've made some progress but will have to stop for tonight.
edit: If we turn the online layer to just draw edges with a blank fill then the order could be reversed and we’d get the borders between supposed countries drawn as well (and should likely reduce the
size
). My attempts to do this have hit errors regarding continuous and discrete values when I apply a scale so I am missing someggplot
wisdom. It’s also slightly odd how the thickness of lines differs between a rstudio preview and the rendered hexsticker.We could also look at reordering the calls to
bind_rows
andms_simplify
. I don’t think these commute but at the scale we’re dealing with it doesn’t seem to matter.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is wierd. I'm not a fan of the orange borders, ideally these should be black and thinner but if its to much of a hassle I'm happy with it without borders
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we merge into the main hex branch and try and resolve the final tweak there? I agree this is great. If I get the chance I will bang my head into the outline issue as it does seem strange.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've done a slight reordering.
We now convert the countries outlines into lines (instead of polygons) and draw them after we draw the coloured regions. This means that we now draw borders between countries for which we have regional data.
I know we didn't like the orange, so is it ... better? ... that now the border appears to be blue by default? I think there is a simple
ggplot
scale/colour error I am making and I hope someone with more expertise may figure it out, though thespatial_layer
objects are particular in how they approach aesthetics.In any case, I think this is closer and would be happy if this were merged into the mainstream hexsticker branch (and possibly tidied to reduce the proliferation and numbering glitches of options) and then polishing can be done there.
In terms of things which could be done to make it cleaner,
ne_countries
andne_states
appear to have different default scales of the geometries they return, which is why the code simplifies the country outlines down to 4% of original points and the regions only to 50% of original points. Discrepancies only seem to be visible when very closely zoomed in (where regions are drawn over countries with slightly different outlines) but it should be possible to specify the same scale for both and then simplify them by the same factor.