-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Addition of RC parameters #4218
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
Conversation
@@ -3050,6 +3050,10 @@ def boxplot(self, x, notch=False, sym=None, vert=True, whis=1.5, | |||
|
|||
.. plot:: mpl_examples/statistics/boxplot_demo.py | |||
""" | |||
if not rcParams['boxplot.whiskers']==1.5: |
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.
pep8 issue (space around ==
)
@@ -3616,7 +3690,8 @@ def scatter(self, x, y, s=20, c=None, marker='o', cmap=None, norm=None, | |||
if facecolors is not None: | |||
c = facecolors | |||
else: | |||
c = 'b' # the original default | |||
color_cycle = self._get_lines.color_cycle |
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.
👎 on scatter using color cycle. This has come up before and the consensus was that scatter should be independent of color cycle because it is as scalar mappable. One of two reasons to use scatter
over a plot
with no line is if you want to map the color of the markers to an array (the other is to scale the size of the markers (and maybe the rotation?)).
This is also an major API break, if we do want to make scatter
sometimes hook into the color cycle it should be done on the color_overhaul
branch for the 2.0 release.
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.
Alright, I did not know about that.
v = float(s) | ||
return v | ||
except: | ||
raise ValueError('not a float') |
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.
This should say "not a valid wisker value ['range', float, (float, float)]" or something to that effect.
I'm not sure why the last Travis build failed in 2.7 without args... Any idea? |
I kicked it to restart, smelled like a transient failure On Wed, Jun 17, 2015, 16:51 Gilles Marin notifications@github.com wrote:
|
It passes now. |
@@ -3050,11 +3050,41 @@ def boxplot(self, x, notch=False, sym=None, vert=True, whis=1.5, | |||
|
|||
.. plot:: mpl_examples/statistics/boxplot_demo.py | |||
""" | |||
if not rcParams['boxplot.whiskers'] == 1.5: |
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.
this probably needs a comment explaining why this is being done to prevent future developers from "fixing" this. Also, why the "not" instead of "!="?
# If defined in matplotlibrc, apply the value from rc file | ||
# Overridden if argument is passed | ||
if rcParams['boxplot.whiskers'] != 1.5: | ||
whis = rcParams['boxplot.whiskers'] |
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.
If I understand this correctly, then a bad situation can arise. If someone has an rc file with a different value for boxplot.whiskers
, but explicitly passes in a value for whis
, then the rcfile's value takes precedence. That would be incorrect. Why not set the default value of whis
to None
and test for that?
I have similar concerns for bootstrap
because it completely ignores the possibility that the user explicitly sets some value for it.
@@ -2889,11 +2889,11 @@ def xywhere(xs, ys, mask): | |||
|
|||
return errorbar_container # (l0, caplines, barcols) | |||
|
|||
def boxplot(self, x, notch=False, sym=None, vert=True, whis=1.5, | |||
positions=None, widths=None, patch_artist=False, | |||
def boxplot(self, x, notch=None, sym=None, vert=None, whis=1.5, |
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 think you meant to change whis=None
Can you add tests that for all of this? I think a single 5x5 grid png will give enough to cover all of the rcparams Can you add the tests of the 'default' values in another PR based on current master (so that if this PR changes the defaults we will know)? |
You want me to write tests for all the added rc, or only the boxplot ones? |
At least the boxplot ones, but if you want to do the other ones as well that would be awesome 👍 Yes, I mean a 5x5 grid of axes. If you can cover all of the rcparams in less that is fine too (5x5 was just the first size that popped into my head, not something carefully considered). And yes, the idea behind the baseline test is to verify that this does not change anything unless the user explicitly asks for things to be changed (which the last round of changes to boxplot did which was less than great). Now that I type this out, can you start by checking that we do not already have this test? |
I checked already for the last test. There is a basic one, but it includes |
Yes, doing it with a single function + single image is the idea. I would def _rctest_bxp_helper(ax, rc_dict):
with rccontext(rc_dict):
ax.boxplot(...)
def test_all_the_boxplot_rcparams():
list_of_rcdicts = [ ]
arr_of_axes = plt.subplots(5, 5).ravel()
for ax, rc_dict in zip(arr_of_axes, list_of_rcdicts):
_rctest_bxp_helper(ax, rc_dict) On Thu, Jul 2, 2015 at 3:26 PM Gilles Marin notifications@github.com
|
ping @Mrngilles , this needs a rebase. This also blocks #4669. |
Added xtick.position and ytick.position to rcsetup.py trying to fix Travis CI failure on 2.6 Removed x-y position parameter from rc default dic Added style rcParam + stylesheet recursion scatter, fill_between and fill_betweenx use color_cycle Added rcParameters for boxplot + validations functions Added rcParameter to choose grid axis display Comment tweaks added boxplot.flierprops + line length fixes fix: unable to get substyles from path or URL removed boxplot.fliersymbol because not needed Fixed boxplot checks spine removing modified + removed : from docstring removed color_cycle from scatter, fill_between, fill_betweenx Original behaviour of axes.grid + working rc axes.grid.orientation Fixed the get_substyles function to accept dictionnaries Fix PEP8 + OrderedDict issues in Travis Modified how we get rcParams in the boxplot method tried fixing test issues + pep8 fix travis for patch_artist linestyle issue removed the style rcParam to put it in an other PR used setdefault function + validation function + Error message fixed pep8 error fixed pep8 error (again) Comments and style fixes Fixed whiskers and bootstrap rcParams use Added tests for boxplot rc parameters and fixes added spine rc parameter test added test for axes.grid.axis rc parameter + typo fix in spines test Typo fix
Rebased. Hope this works, but the tests should at least be okay |
I guess the test had an other unexpected issue... I'm not sure if that's my code or if the problem was already there, but it seems it already happened before. |
Looks like the last test failure was unrelated issue. I have restarted the test |
meanline=False, showmeans=False, showcaps=True, | ||
showbox=True, showfliers=True, boxprops=None, labels=None, | ||
meanline=None, showmeans=None, showcaps=None, | ||
showbox=None, showfliers=None, boxprops=None, labels=None, |
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 think the doc string (below) needs update to reflect these changes
It looks good to me, I think this only needs an updated docstring for boxplot to reflect the changes |
ENH: Addition of RC parameters
@olgabot @Mrngilles Thanks! |
Ended the work from PR 2702, and added other RC parameters.
What was done :
style
RC parameter: you can import recursively styles from an other stylesheetscatter
,fill_between
,fill_betweenx
usecolor_cycle
boxplot
parameters, and the associated validation functions when necessary.x
,y
, orboth
grid.