-
Notifications
You must be signed in to change notification settings - Fork 6
Fix to _C filename postfix and change to auto coloring
#262
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
Changes from all commits
a09bcc1
e95d26b
861690d
b9f6204
ce96ef9
26d60c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| shapeName,Population (people),Color,Inset,Label | ||
| Brussels-Capital,1222637,#fbb4ae,, | ||
| Flanders,6698876,#b3cde3,, | ||
| Brussels-Capital,1222637,,, | ||
| Flanders,6698876,,, | ||
| Wallonia,3662495,#ccebc5,, |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,18 +11,12 @@ void InsetState::auto_color() | |
| std::vector<Color> palette; | ||
|
|
||
| if (colors_.size() > 0) { | ||
| // If some colors are already provided, use a different palette | ||
| // From https://colorbrewer2.org/#type=qualitative&scheme=Dark2&n=8 | ||
| std::cerr << "Some but not all colors provided, using Dark color palette." | ||
| // If some but not all of the GeoDivs are colored, use only #f2f2f2 (light | ||
| // gray) to color the rest | ||
| std::cerr << "Some but not all colors provided, assigning #f2f2f2 (light " | ||
| "gray) to uncolored GeoDivs." | ||
| << std::endl; | ||
| palette.emplace_back("#1b9e77"); // aqua green | ||
| palette.emplace_back("#d95f02"); // dark orange | ||
| palette.emplace_back("#7570b3"); // purple | ||
| palette.emplace_back("#e7298a"); // dark pink | ||
| palette.emplace_back("#66a61e"); // olive green | ||
| palette.emplace_back("#e6ab02"); // dark yellow | ||
| palette.emplace_back("#a6761d"); // brown | ||
| palette.emplace_back("#666666"); // dark grey | ||
| palette.emplace_back("#f2f2f2"); // light gray | ||
| } else { | ||
| // Using default palette for now | ||
| // TODO: Accept palette from user | ||
|
|
@@ -48,6 +42,13 @@ void InsetState::auto_color() | |
| if (color_found(gd.id())) | ||
| continue; | ||
|
|
||
| // If there's only one color in palette, color the div with it without | ||
| // checking for color adjacency | ||
| if (palette.size() == 1) { | ||
| insert_color(gd.id(), palette[0]); | ||
| continue; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although I know we used Here is some more discussion on the topic. Generally, if I'd suggest adding the following code snippet below line 19: This way, the |
||
| } | ||
|
|
||
| for (unsigned int i = 0; i < palette.size(); ++i) { | ||
| const Color c = palette[i]; | ||
| bool shared_color = false; | ||
|
|
||
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.
Could you double check what happens without this commit?
I'm worried that we are writing the same figure files twice: once from the
inset_stateloop and once here. In #238, I mentioned the following files are produced:I need you to check whether
_C_inputis the exact same as_input(likewise for_C_outputand_output). If they are the same, then we should not just change the output name for_C_inputbut not write_C_inputat all. On the other hand, if they are different, we'd need to ensure they still have different names so that they are both written, and nothing is overwritten due to having the same name.