-
-
Notifications
You must be signed in to change notification settings - Fork 420
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
Development/plot dist comparison warning #1688
Merged
OriolAbril
merged 31 commits into
arviz-devs:main
from
alexisperakis:development/plot_dist_comparison_warning
Mar 4, 2022
Merged
Changes from 24 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
876dcc6
Add warning status for plot_dist_comparison method [WIP]
alexisperakis 9721102
Changes to the warning
alexisperakis 260e2e7
Change comparison variable for warning over the limit subplots
alexisperakis fde9f77
Fix a typo at distcomparisonplot.py, fix axes.shape(2, 3) at test_plo…
alexisperakis 7c2b569
Add + 1 in the if statement of the warnings
alexisperakis 079cf5e
DElete .DS_Store, alter .gitignore
alexisperakis 2553ad5
Delete .DS_Store
alexisperakis 49ce2fe
Fix the counting of the elements of each sublist
alexisperakis 62a7a67
Change total subplots to compare with len plots
alexisperakis ee8c9d1
Nested list truncated #1688
alexisperakis ab06cd2
Add warning status for plot_dist_comparison method [WIP]
alexisperakis ae55486
Changes to the warning
alexisperakis ebe83e5
Change comparison variable for warning over the limit subplots
alexisperakis 7faa75b
Fix a typo at distcomparisonplot.py, fix axes.shape(2, 3) at test_plo…
alexisperakis d0d7a30
Add + 1 in the if statement of the warnings
alexisperakis d5d805b
DElete .DS_Store, alter .gitignore
alexisperakis 4864849
Delete .DS_Store
alexisperakis ed73a13
Fix the counting of the elements of each sublist
alexisperakis e7f6a97
Change total subplots to compare with len plots
alexisperakis f596483
Nested list truncated #1688
alexisperakis c59c6fe
Fix formating
alexisperakis bf376f1
Resolve conflicts
alexisperakis d54e336
Correct total subplots counting
alexisperakis 9911abc
Black reformation
alexisperakis fcefcfd
Fix warning message
alexisperakis 3a63dbe
Add change to changelog #1688
alexisperakis a5a6060
Fix a typo in changelog
alexisperakis bf598b9
Fix git conflicts
alexisperakis 92f9947
Merge branch 'main' of https://github.com/arviz-devs/arviz into devel…
alexisperakis 56fc92c
Merge remote-tracking branch 'upstream/main' into development/plot_di…
OriolAbril 9a2a1f1
fix changelog
OriolAbril File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
"""Density Comparison plot.""" | ||
import warnings | ||
from ..labels import BaseLabeller | ||
from ..rcparams import rcParams | ||
from ..utils import _var_names, get_coords | ||
from .plot_utils import get_plotting_function | ||
from ..sel_utils import xarray_var_iter | ||
from ..sel_utils import xarray_var_iter, xarray_sel_iter | ||
|
||
|
||
def plot_dist_comparison( | ||
|
@@ -134,6 +135,19 @@ def plot_dist_comparison( | |
for data, var in zip(datasets, var_names) | ||
] | ||
|
||
total_plots = sum( | ||
1 for _ in xarray_sel_iter(datasets[0], var_names=var_names[0], combined=True) | ||
) | ||
maxplots = len(dc_plotters[0]) * (len(groups) + 1) | ||
|
||
if total_plots > rcParams["plot.max_subplots"]: | ||
warnings.warn( | ||
"rcParams['plot.max_subplots'] ({max_plots}) is smaller than the number " | ||
"of variables to plot ({len_plotters}), generating only {max_plots} " | ||
"plots".format(max_plots=maxplots, len_plotters=total_plots), | ||
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. This needs to be updated, not sure what is the best way to do so, but somehow. Here are the things that need to somehow be changed:
|
||
UserWarning, | ||
) | ||
|
||
nvars = len(dc_plotters[0]) | ||
ngroups = len(groups) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I forgot to multiply in the sample code. This counts the number of variables which needs to be multiplied by
(len(groups) + 1)
to be equal to the total number of subplots that would be needed if we weren't truncating the lists of plotters (also read the next comment about the warning message).