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

added colormaps, figure size control and facets to support subquestio… #52

Merged
merged 15 commits into from
Jun 5, 2024

Conversation

nikhil153
Copy link
Contributor

@nikhil153 nikhil153 commented Jun 3, 2024

text labels on either side of the x-axis for ‘above-threshold’ and below-threshold’, regardless of whether bar plot is showing all outcomes

This is going to be tricky with plotly express. So currently just showing the labels inside the bar.

Add thicker line to differentiate above-threshold from below-threshold, for both the binarized and non-binarized version of the stacked bar plot

Changing single border doesn't seem to be easy either... currently added an option to control all the line widths of the bar plot.

@nikhil153 nikhil153 requested a review from alyssadai June 3, 2024 21:59
@alyssadai
Copy link
Collaborator

alyssadai commented Jun 3, 2024

Hi @nikhil153, thanks a lot for your work on this.

To make reviewing this easier, would you mind incorporating your changes into the make_stacked_bar_plots.py script you created last time? https://github.com/neurodatascience/us_climate_emotions_map/blob/main/climate_emotions_map/make_stacked_bar_plots.py

I think in your last PR I refactored this script a little bit, but you can replace the script contents directly with the contents of your Jupyter notebook if that's easier, and I can help refactor again as needed.

Also, for this:

Changing single border doesn't seem to be easy either... currently added an option to control all the line widths of the bar plot

I think our best bet might be to just plot a vertical line at that the right x value, separate from the bars themselves. Can help w/ trying to implement this if needed

@nikhil153
Copy link
Contributor Author

@alyssadai - updated the python script!

@alyssadai
Copy link
Collaborator

alyssadai commented Jun 5, 2024

New changes added:

  • Subquestions have a fixed custom order = descending endorsement of the 3+ outcome
  • Stacked bars now display outcome labels (e.g. "Moderately agree") with text wrapping for <50% bars + custom hover boxes
  • Facet titles display full text for subquestion and are hidden when there is only one subquestion
  • Minor adjustments to figure/facet layout to work in app when all bars are visible
  • data_loader.py updated to not interpret NaNs in data dictionaries to preserve "None"

Re lines between bars: after investigating a bit, this should be doable via a custom go.layout.Shape, but would require quite a bit of additional logic as the line height must be manually adjusted and change depending on height of the bar, and whether party stratify is turned on. Not implementing for now, as recommended by Nikhil.

@alyssadai alyssadai merged commit 380290b into main Jun 5, 2024
1 check passed
@alyssadai alyssadai deleted the stacked_bars_with_facets branch June 5, 2024 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants