cyipt / actdev

ActDev - Active travel provision and potential in planned and proposed development sites
https://actdev.cyipt.bike
7 stars 3 forks source link

Colourscheme for transport modes #112

Closed Robinlovelace closed 3 years ago

Robinlovelace commented 3 years ago

This is really a design issue but opening here as the code used to address it in the first instance, via pngs, will likely live in this repo.

Here are some colourschemes!

Which do you like best/worst? Any ideas welcome, especially if they come with updates to the code below.

```r # Aim: highlight different colourscheme options for pngs of infographics # run from route directory of actdev repo setwd("~/cyipt/actdev") source("code/mode-split-summary.R") ggplot(all_dist, aes(fill = name, y = value, x = distance_band)) + geom_bar(position = "stack", stat = "identity") + scale_fill_manual(values = c("blue", "green", "purple", "red")) + labs(y = "", x = "Distance band (km)", fill = "") + theme_minimal() ggplot(all_dist, aes(fill = name, y = value, x = distance_band)) + geom_bar(position = "stack", stat = "identity") + scale_fill_manual(values = c("darkblue", "blue", "purple", "red")) + labs(y = "", x = "Distance band (km)", fill = "") + theme_minimal() # alternative palette - see # https://www.colourlovers.com/palette/4790872/DianaSpringCrocus cols = c("#698203", "#9FC1DA", "#D9BEDF", "#D38521", "#698203", "#9FC1DA", "#D9BEDF", "#D38521") ggplot(all_dist, aes(fill = name, y = value, x = distance_band)) + geom_bar(position = "stack", stat = "identity") + scale_fill_manual(values = cols) + labs(y = "", x = "Distance band (km)", fill = "") + theme_minimal() # https://www.colourlovers.com/palette/92095/Giant_Goldfish cols = names(read.csv(text = "#69D2E7,#A7DBD8,#E0E4CC,#F38630,#FA6900,#69D2E7,#A7DBD8,#E0E4CC", check.names = F)) cols = cols[-3] ggplot(all_dist, aes(fill = name, y = value, x = distance_band)) + geom_bar(position = "stack", stat = "identity") + scale_fill_manual(values = cols) + labs(y = "", x = "Distance band (km)", fill = "") + theme_minimal() # with grey background ggplot(all_dist, aes(fill = name, y = value, x = distance_band)) + geom_bar(position = "stack", stat = "identity") + scale_fill_manual(values = cols) + labs(y = "", x = "Distance band (km)", fill = "") + theme_minimal() + theme(plot.background = element_rect(fill = "#434343")) # with transparent background g = ggplot(all_dist, aes(fill = name, y = value, x = distance_band)) + geom_bar(position = "stack", stat = "identity") + scale_fill_manual(values = cols) + labs(y = "", x = "Distance band (km)", fill = "") + theme_minimal() ggsave(filename = "test.png", width = 4, height = 3, dpi = 100, plot = g2, bg = "transparent") i = magick::image_read("test.png") i i2 = magick::image_background(i, color = "purple") i2 ```
Robinlovelace commented 3 years ago
# Aim: highlight different colourscheme options for pngs of infographics

# run from route directory of actdev repo
setwd("~/cyipt/actdev")
source("code/mode-split-summary.R")

ggplot(all_dist, aes(fill = name, y = value, x = distance_band)) +
  geom_bar(position = "stack", stat = "identity") +
  scale_fill_manual(values = c("blue", "green", "purple", "red")) +
  labs(y = "", x = "Distance band (km)", fill = "") +
  theme_minimal()

ggplot(all_dist, aes(fill = name, y = value, x = distance_band)) +
  geom_bar(position = "stack", stat = "identity") +
  scale_fill_manual(values = c("darkblue", "blue", "purple", "red")) +
  labs(y = "", x = "Distance band (km)", fill = "") +
  theme_minimal()

# alternative palette - see
# https://www.colourlovers.com/palette/4790872/DianaSpringCrocus
cols = c("#698203", "#9FC1DA", "#D9BEDF", "#D38521", "#698203", "#9FC1DA", "#D9BEDF", "#D38521")
ggplot(all_dist, aes(fill = name, y = value, x = distance_band)) +
  geom_bar(position = "stack", stat = "identity") +
  scale_fill_manual(values = cols) +
  labs(y = "", x = "Distance band (km)", fill = "") +
  theme_minimal()

# https://www.colourlovers.com/palette/92095/Giant_Goldfish
cols = names(read.csv(text = "#69D2E7,#A7DBD8,#E0E4CC,#F38630,#FA6900,#69D2E7,#A7DBD8,#E0E4CC", check.names = F))
cols = cols[-3]
ggplot(all_dist, aes(fill = name, y = value, x = distance_band)) +
  geom_bar(position = "stack", stat = "identity") +
  scale_fill_manual(values = cols) +
  labs(y = "", x = "Distance band (km)", fill = "") +
  theme_minimal()

# with grey background
ggplot(all_dist, aes(fill = name, y = value, x = distance_band)) +
  geom_bar(position = "stack", stat = "identity") +
  scale_fill_manual(values = cols) +
  labs(y = "", x = "Distance band (km)", fill = "") +
  theme_minimal() +
  theme(plot.background = element_rect(fill = "#434343"))

# with transparent background
g = ggplot(all_dist, aes(fill = name, y = value, x = distance_band)) +
  geom_bar(position = "stack", stat = "identity") +
  scale_fill_manual(values = cols) +
  labs(y = "", x = "Distance band (km)", fill = "") +
  theme_minimal()
ggsave(filename = "test.png", width = 4, height = 3, dpi = 100, plot = g2, bg = "transparent")
# i = magick::image_read("test.png")
# i
# i2 = magick::image_background(i, color = "purple")
# i2

Created on 2021-02-25 by the reprex package (v1.0.0)

Robinlovelace commented 3 years ago

Of those I my updated preference is this:

https://www.colourlovers.com/palette/92095/Giant_Goldfish

image

Thoughts and other palettes from @Siequnu and others welcome (note the background is transparent I think).

Robinlovelace commented 3 years ago

Another consideration: integration with A/B Street. This is what it would look like with those colours:

...

dabreegster commented 3 years ago

integration with A/B Street

And inversely, abst's color scheme is customizable (we have a day and night mode already) -- we can make it look like the rest of the actdev UI.

Robinlovelace commented 3 years ago

Thanks Dustin, yes I guess you could also change the colours your side. Any preferences from those above? I'm going to try with these colours now to see how the barplot looks: https://github.com/a-b-street/abstreet/blob/e0fd8dd369e2285300d165a0e36a329b4d1d6f12/map_gui/src/colors.rs#L242-L245

Robinlovelace commented 3 years ago

Groovy!

cols = c("#A32015", "#5D9630", "#12409D", "#DF8C3D")
g = ggplot(all_dist, aes(fill = name, y = value, x = distance_band)) +
  geom_bar(position = "stack", stat = "identity") +
  scale_fill_manual(values = cols) +
  labs(y = "", x = "Distance band (km)", fill = "") +
  theme_minimal()

image

mvl22 commented 3 years ago

Of those I my updated preference is this:

Other/drive are barely distinguishable in that. I suspect a lot of people won't be able to see that difference.

dabreegster commented 3 years ago

The first looks the most likely to contrast. In day mode, arterials are orange: Screenshot from 2021-02-25 10-01-51 But this can become a rabbit-hole -- the day & night mode color scheme for everything on the map is by no means finalized; it's just the best we've found so far. If we like a particular scheme for the 4 modes, I bet we could adjust the map accordingly.

Siequnu commented 3 years ago

As the colour scheme for the UI I suggest walk: #457b9d, bike #90be6d, other #ffd166 and car #fe5f55. The colours are consistent with the modes, present good contrast for a dark background, and match the other UI element colour schemes.

Chart.JS view of how it looks on the site.

Screenshot 2021-02-26 at 02 02 25
Robinlovelace commented 3 years ago

OK other palettes suggestions welcome. Here's the A/B Street one:

image

Robinlovelace commented 3 years ago

As the colour scheme for the UI I suggest walk: #457b9d, bike #90be6d, other #ffd166 and car #fe5f55.

Finally some hex colours, thank you, will try :tada:

Robinlovelace commented 3 years ago

My new fave I think (will look better in png outputs):

image

mvl22 commented 3 years ago

As the colour scheme for the UI I suggest walk: #457b9d, bike #90be6d, other #ffd166 and car #fe5f55. The colours are consistent with the modes, present good contrast for a dark background, and match the other UI element colour schemes.

Yes, that works well in my view.

My new fave I think (will look better in png outputs):

That set of colours looks very clear and pleasing to me. (Are these the same as Patrick's hex set?)

michaelkirk commented 3 years ago

I suggest walk: #457b9d, bike #90be6d, other #ffd166 and car #fe5f55

👍 Looks good to this person with deuteranopia (red/green color blind).

dabreegster commented 3 years ago

I suggest walk: #457b9d, bike #90be6d, other #ffd166 and car #fe5f55

Screenshot from 2021-02-25 10-09-20 Screenshot from 2021-02-25 10-08-58 They look pretty good in day mode, and maybe the only adjustment night mode would need is changing the color of residential buildings.

Robinlovelace commented 3 years ago

(Are these the same as Patrick's hex set?)

Yes, thought that was self evident but good to be specific.

Robinlovelace commented 3 years ago

So I think after a last minute sprint and after much nudging from me, I think we have a final colourscheme for the modes in the ActDev project that can also help with integration. :tada:

Suggest as with #48 that we close this issue when the colourscheme has actually been deployed. Big progress towards closing the bigger issue https://github.com/cyipt/actdev-ui/issues/23.

Robinlovelace commented 3 years ago

Update in for Great Kneighton:

image

See rich diff here: https://github.com/cyipt/actdev/commit/423a466cd42a66872ae3bb0d632bd30440ea6aed?short_path=f7a5e1c#diff-f7a5e1c8ae0d3eee3930d6a429bb35ad2a38aedf00148f9bb409d19bd0c8ea9b

mvl22 commented 3 years ago

Glad we got there on this!

I think this backs up the point made earlier that it's hard to get a final colour scheme for a design until the rest of the design concept has been created - a good colour scheme is an integral part of a design.

Those colours also work nicely in A/B Street - great!

dabreegster commented 3 years ago

I adjusted night mode houses in abst to contrast better. New deployment will look like this: Screenshot from 2021-03-02 16-53-02 Screenshot from 2021-03-02 16-52-00

Robinlovelace commented 3 years ago

Hi @dabreegster it looks good but I think the placement of all the panels at the top creates an unintended regression in terms of usability on small screens. See here:

Peek 2021-03-03 09-27

Reopening this as it's quicker and related but happy for this to be treated as a separate issue.

mvl22 commented 3 years ago

Yes, could you ideally put that somewhere else as that's a generic A/B Street issue, and I can see it generating discussion.

Robinlovelace commented 3 years ago

Is it best in the A/B Street issue tracker? Guess so as I think code in that repo will fix it but will wait for feedback from @dabreegster. Can also see benefits of project-specific issues. Glad you're onboard with small 'atomic' issues @mvl22 ; )

Robinlovelace commented 3 years ago

On that note, they still haven't been implemented in the web app. You happy for me to open an issue on the UI repo @mvl22 ?

mvl22 commented 3 years ago

On that note, they still haven't been implemented in the web app.

Can you clarify more specifically?

Yes, feel free to open an issue over there if it's different to the above.