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

Likert stacked bar plots #77

Open
MitchellAcoustics opened this issue May 31, 2024 · 0 comments
Open

Likert stacked bar plots #77

MitchellAcoustics opened this issue May 31, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@MitchellAcoustics
Copy link
Owner

Request from a user to add plotting functions for the stacked bar plots I've used in some papers -
image

Should this be more integrated with the SSM work?

This was done before using the following code:

import matplotlib.pyplot as plt
import plot_likert

scales  = paq_likert.categories

fig, (ax1, ax2) = plt.subplots(nrows=1, ncols=2, figsize=(15,6))
plot_likert.plot_likert(data.isd.filter_location_ids("P2").isd.return_paqs(incl_ids=False),
                        scales, 
                        plot_percentage=False,  # show absolute values
                        ax=ax1,  # show on the left-side subplot
                        legend=0,  # hide the legend for the subplot, we'll show a single figure legend instead
                        bar_labels=True,  # show the bar labels
                        title="P2"  # show the location ID as the title
                       );
plot_likert.plot_likert(data.isd.filter_location_ids("P6").isd.return_paqs(incl_ids=False), 
                        scales, 
                        plot_percentage=False,  # show percentage values
                        ax=ax2,  # show on the right-side subplot
                        legend=0,  # hide the legend for the subplot, we'll show a single figure legend instead
                        bar_labels=True,  # show the bar labels
                        title="P6"
                       );

# display a single legend for the whole figure
handles, labels = ax2.get_legend_handles_labels()
fig.legend(handles, labels, bbox_to_anchor=(1.08, .9))
fig.suptitle("Comparison between P2 and P6 at Stockton Waterfront", fontsize=16)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In progress
Development

No branches or pull requests

1 participant