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

[ENH] Update map graphic #51

Merged

Conversation

michellewang
Copy link
Contributor

Closes #26.

Summary:

  • Picked 2 built-in colormaps, tried to avoid red/blue colours to avoid associations with political parties
    • "Greens" for opinions and "Oranges" for impacts
    • This was pretty arbitrary, and the colours might not play well with the stacked bar plots below the map graphic, so if @koudyk or others have better ideas please share them
  • Added the +/- 10% padding for vmin/vmax
    • At the last meeting we tried forcing a consistent 0-100 and that doesn't work well at all because most questions do not span that entire range
  • Added the margins as @alyssadai suggested

Screenshot for opinion:
Screenshot 2024-06-02 at 6 20 28 PM

Screenshot for weather impact:
Screenshot 2024-06-02 at 6 20 52 PM

@michellewang michellewang requested review from alyssadai and koudyk June 2, 2024 22:21
@alyssadai
Copy link
Collaborator

alyssadai commented Jun 3, 2024

Hey @michellewang, thanks a lot for the PR.

Some notes on aesthetics based on our chat today:

  • If you could have the map plotting func accept a list of colors somehow (alternatively, list or string name of built-in colormap, if you want to be extra fancy) and then generate a LinearSegmentedColormap (?) from it (EDIT: Looks like this isn't even necessary, apparently plotly can handle a list of colors?) to be used for the map, that would be great to work w/ Nikhil's stacked bars

  • For weather impact, I forgot to mention this before before but I think it's reasonable to use the same colormap they use for their weather impact map plots in the manuscript supplementary, which to my eye looks like OrRd
    e.g.

image

@alyssadai
Copy link
Collaborator

Also, just had another thought related to your q about the state labels on the map. One thing you could try if you like is making the text bold, to make it stand out a bit more. Up to you though!

@alyssadai
Copy link
Collaborator

alyssadai commented Jun 5, 2024

Before I forget, here is a custom yellow-red cmap we can use as a default for the opinion data. These are colors from Nikhil's colormap used in the bar charts, with an extra light yellow color (kind of arbitrarily selected) I added for the lower limit:

["#FAE776", "#F9C74F", "#F8961E", "#F3722C", "#F94144"]

@michellewang
Copy link
Contributor Author

@alyssadai with updated colourmaps, bold state labels and different colour for clicked state outline:

(opinion)
Screenshot 2024-06-05 at 2 29 39 PM

(impact)
Screenshot 2024-06-05 at 2 30 18 PM

Copy link
Collaborator

@alyssadai alyssadai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @michellewang, this looks awesome - sorry my review took a while.

Left mostly docstring update suggestions so we easily can find what args/defaults to change if needed.

One non-essential suggestion if you have time (no worries if not): could we change the number of decimals for percentages in the map from 2 to 1, to match the descriptive plots and bar plots?

Feel free to merge when ready 🎉

climate_emotions_map/make_map.py Outdated Show resolved Hide resolved
climate_emotions_map/make_map.py Outdated Show resolved Hide resolved
climate_emotions_map/make_map.py Outdated Show resolved Hide resolved
climate_emotions_map/make_map.py Outdated Show resolved Hide resolved
climate_emotions_map/make_map.py Outdated Show resolved Hide resolved
vmin = df_to_plot[col_gradient].min()
vmax = df_to_plot[col_gradient].max()
vmin = max(0, df_to_plot[col_gradient].min() - colormap_range_padding)
vmax = min(100, df_to_plot[col_gradient].max() + colormap_range_padding)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

neato!!

climate_emotions_map/make_map.py Outdated Show resolved Hide resolved
@michellewang
Copy link
Contributor Author

Thanks @alyssadai for the review :) I made the percentages in the hoverboxes have 1 decimal point and added % to be like the stacked bar plots. Squashing and merging now!

@michellewang michellewang merged commit 7327a29 into neurodatascience:main Jun 7, 2024
1 check passed
@michellewang michellewang deleted the 26/colormap_margins branch June 7, 2024 19:24
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

Successfully merging this pull request may close these issues.

Update default colormap/range for map graphic, and reduce margins
2 participants