[matplotlib-devel] Patch for errorbar, alpha kw did not apply to lines and cap markers
Hi matplotlib developers, this is my first commit to matplotlib. I am using it heavily in a scientific context. I followed the How-to and send you an according patch for what I consider a bug. If it doesn't make sense, please be lenient with me for now, since it my first time. : ) As described in the subject line, I made the alpha keyword in the errorbar command act also on the error bars and not only on the markers. The previous behaviour seemed inconsistent. Cheers, Hans >From 9dc835ea20f87208ae254df06eaf75e79eca8207 Mon Sep 17 00:00:00 2001 From: Hans Dembinski Date: Wed, 6 Jun 2012 17:48:13 +0200 Subject: [PATCH] BF: make alpha keyword apply to error lines and cap markers --- lib/matplotlib/axes.py |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/lib/matplotlib/axes.py b/lib/matplotlib/axes.py index a909a23..2936034 100644 --- a/lib/matplotlib/axes.py +++ b/lib/matplotlib/axes.py @@ -5309,6 +5309,8 @@ class Axes(martist.Artist): lines_kw['lw']=kwargs['lw'] if 'transform' in kwargs: lines_kw['transform'] = kwargs['transform'] +if 'alpha' in kwargs: +lines_kw['alpha'] = kwargs['alpha'] # arrays fine here, they are booleans and hence not units if not iterable(lolims): @@ -5348,6 +5350,8 @@ class Axes(martist.Artist): plot_kw['mew']=kwargs['mew'] if 'transform' in kwargs: plot_kw['transform'] = kwargs['transform'] +if 'alpha' in kwargs: +plot_kw['alpha'] = kwargs['alpha'] if xerr is not None: if (iterable(xerr) and len(xerr)==2 and -- 1.7.4.1 -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] Fwd: Patch for errorbar, alpha kw did not apply to lines and cap markers
Hi again, I send this patch to the mailing list two weeks ago and did not get any response. If you reject it, could you please explain why or how I should improve? Best regards. Original Message Subject: Patch for errorbar, alpha kw did not apply to lines and cap markers Date: Wed, 06 Jun 2012 17:57:31 +0200 From: Hans Dembinski To: [email protected] Hi matplotlib developers, this is my first commit to matplotlib. I am using it heavily in a scientific context. I followed the How-to and send you an according patch for what I consider a bug. If it doesn't make sense, please be lenient with me for now, since it my first time. : ) As described in the subject line, I made the alpha keyword in the errorbar command act also on the error bars and not only on the markers. The previous behaviour seemed inconsistent. Cheers, Hans >From 9dc835ea20f87208ae254df06eaf75e79eca8207 Mon Sep 17 00:00:00 2001 From: Hans Dembinski Date: Wed, 6 Jun 2012 17:48:13 +0200 Subject: [PATCH] BF: make alpha keyword apply to error lines and cap markers --- lib/matplotlib/axes.py |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/lib/matplotlib/axes.py b/lib/matplotlib/axes.py index a909a23..2936034 100644 --- a/lib/matplotlib/axes.py +++ b/lib/matplotlib/axes.py @@ -5309,6 +5309,8 @@ class Axes(martist.Artist): lines_kw['lw']=kwargs['lw'] if 'transform' in kwargs: lines_kw['transform'] = kwargs['transform'] +if 'alpha' in kwargs: +lines_kw['alpha'] = kwargs['alpha'] # arrays fine here, they are booleans and hence not units if not iterable(lolims): @@ -5348,6 +5350,8 @@ class Axes(martist.Artist): plot_kw['mew']=kwargs['mew'] if 'transform' in kwargs: plot_kw['transform'] = kwargs['transform'] +if 'alpha' in kwargs: +plot_kw['alpha'] = kwargs['alpha'] if xerr is not None: if (iterable(xerr) and len(xerr)==2 and -- 1.7.4.1 -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Fwd: Patch for errorbar, alpha kw did not apply to lines and cap markers
Hi! Thanks for the answer! I think the linestyle and the color settings are ok. error bars that are not just lines look very ugly, i would not even dare to make dashed or dotted ones. the color of the error bars can be set separately with elinecolor while the default is to use the color of the markers. Cheers, Hans On 06/22/2012 02:58 PM, Benjamin Root wrote: > > On Fri, Jun 22, 2012 at 5:58 AM, Hans Dembinski <mailto:[email protected]>> wrote: > > Hi again, > > I send this patch to the mailing list two weeks ago and did not get > any response. If you reject it, could you please explain why or how > I should improve? > > Best regards. > > > > Our apologies, there aren't that many of us. I see that you followed > our documentation for submitting a patch: > > http://matplotlib.sourceforge.net/devel/gitwash/patching.html > > Looking at your patch, I think it makes sense to do what you did. I > only wonder if there are any other properties that should be taken care > of here? Color? Linestyle? etc? > > Thoughts? > > Cheers! > Ben Root > > Note to self: we need to update the docs to describe how to do Pull > Requests on GitHub. > -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] Patch: set capsize of errorbar via matplotlibrc
Hi fellow developers,
I am using matplotlib in particle physics where we generally do not plot
the little end caps of error bars. They add no information, but they
make the plot harder to read, especially if it is a busy plot.
In physics, we follow the general aesthetic rule to maximise the "data
to ink ratio", which means that the information should be presented with
a minimum of optical gimmicks.
So, I end up calling errorbar everytime with capsize=0. I argue that
having end caps or not is a global style option, and therefore it makes
sense to put this into matplotlibrc.
I prepared a patch in order to do that and would like you to include it
into the distribution.
Please tell me what you think of it.
>From cbb2df219068a51ee1556a9318b39d19224bc10e Mon Sep 17 00:00:00 2001
From: Hans Dembinski
Date: Thu, 9 Aug 2012 14:02:17 +0200
Subject: [PATCH] get capsize via configuration entry lines.capsize
---
lib/matplotlib/axes.py| 12 +++-
lib/matplotlib/rcsetup.py |1 +
matplotlibrc.template |1 +
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/lib/matplotlib/axes.py b/lib/matplotlib/axes.py
index d2dec62..f29decb 100644
--- a/lib/matplotlib/axes.py
+++ b/lib/matplotlib/axes.py
@@ -4604,7 +4604,7 @@ class Axes(martist.Artist):
*yerr*if not None, will be used to generate
errorbars on the bar chart
*ecolor* specifies the color of any errorbar
- *capsize* (default 3) determines the length in
+ *capsize* determines the length in
points of the error bar caps
*error_kw*dictionary of kwargs to be passed to
errorbar method. *ecolor* and *capsize*
@@ -4652,7 +4652,7 @@ class Axes(martist.Artist):
yerr = kwargs.pop('yerr', None)
error_kw = kwargs.pop('error_kw', dict())
ecolor = kwargs.pop('ecolor', None)
-capsize = kwargs.pop('capsize', 3)
+capsize = kwargs.pop('capsize', None)
error_kw.setdefault('ecolor', ecolor)
error_kw.setdefault('capsize', capsize)
@@ -4882,7 +4882,7 @@ class Axes(martist.Artist):
*yerr*if not None, will be used to generate
errorbars on the bar chart
*ecolor* specifies the color of any errorbar
- *capsize* (default 3) determines the length in
+ *capsize* determines the length in
points of the error bar caps
*align* 'edge' (default) | 'center'
*log* [False|True] False (default) leaves the
@@ -5175,14 +5175,14 @@ class Axes(martist.Artist):
@docstring.dedent_interpd
def errorbar(self, x, y, yerr=None, xerr=None,
- fmt='-', ecolor=None, elinewidth=None, capsize=3,
+ fmt='-', ecolor=None, elinewidth=None, capsize=None,
barsabove=False, lolims=False, uplims=False,
xlolims=False, xuplims=False, errorevery=1, **kwargs):
"""
Call signature::
errorbar(x, y, yerr=None, xerr=None,
- fmt='-', ecolor=None, elinewidth=None, capsize=3,
+ fmt='-', ecolor=None, elinewidth=None, capsize=None,
barsabove=False, lolims=False, uplims=False,
xlolims=False, xuplims=False)
@@ -5337,6 +5337,8 @@ class Axes(martist.Artist):
ys = [thisy for thisy, b in zip(ys, mask) if b]
return xs, ys
+if capsize is None:
+ capsize = rcParams['lines.capsize']
if capsize > 0:
plot_kw = {
diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py
index 6df1d4b..e3d3b85 100644
--- a/lib/matplotlib/rcsetup.py
+++ b/lib/matplotlib/rcsetup.py
@@ -379,6 +379,7 @@ defaultParams = {
'lines.solid_joinstyle' : ['round', validate_joinstyle],
'lines.dash_capstyle' : ['butt', validate_capstyle],
'lines.solid_capstyle' : ['projecting', validate_capstyle],
+'lines.capsize' : [3, validate_int],
# patch props
'patch.linewidth' : [1.0, validate_float], # line width in points
diff --git a/matplotlibrc.template b/matplotlibrc.template
index 6ebaac2..2edde14 100644
--- a/matplotlibrc.template
+++ b/matplotlibrc.template
@@ -69,6 +69,7 @@ backend : %(backend)s
#lines.solid_joinstyle : miter # miter|round|bevel
#lines.solid_capstyle : projecting # butt|round|projecting
#lines.antialiased : True # render lines in antialised (no jaggies)
+#lines.capsize : 3 # size of perpendicular lines at end of error bar
[matplotlib-devel] Fwd: Patch: set capsize of errorbar via matplotlibrc
Dear developers, I submitted a patch a few weeks ago that I think would be useful to have in the matplotlib, but I didn't get any response. I use the library extensively for science work and would like to be able to contribute to this great project. Since I didn't get any responses, I would like to know what you want me to do in order to get my ideas into the project. I cannot commit much time, but I am sure I will find little neat pieces to add every now and then. Please allow me to participate. Original Message Subject: Patch: set capsize of errorbar via matplotlibrc Date: Thu, 09 Aug 2012 14:10:27 +0200 From: Hans Dembinski To: [email protected] Hi fellow developers, I am using matplotlib in particle physics where we generally do not plot the little end caps of error bars. They add no information, but they make the plot harder to read, especially if it is a busy plot. In physics, we follow the general aesthetic rule to maximise the "data to ink ratio", which means that the information should be presented with a minimum of optical gimmicks. So, I end up calling errorbar everytime with capsize=0. I argue that having end caps or not is a global style option, and therefore it makes sense to put this into matplotlibrc. I prepared a patch in order to do that and would like you to include it into the distribution. Please tell me what you think of it. >From cbb2df219068a51ee1556a9318b39d19224bc10e Mon Sep 17 00:00:00 2001 From: Hans Dembinski Date: Thu, 9 Aug 2012 14:02:17 +0200 Subject: [PATCH] get capsize via configuration entry lines.capsize --- lib/matplotlib/axes.py| 12 +++- lib/matplotlib/rcsetup.py |1 + matplotlibrc.template |1 + 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/matplotlib/axes.py b/lib/matplotlib/axes.py index d2dec62..f29decb 100644 --- a/lib/matplotlib/axes.py +++ b/lib/matplotlib/axes.py @@ -4604,7 +4604,7 @@ class Axes(martist.Artist): *yerr*if not None, will be used to generate errorbars on the bar chart *ecolor* specifies the color of any errorbar - *capsize* (default 3) determines the length in + *capsize* determines the length in points of the error bar caps *error_kw*dictionary of kwargs to be passed to errorbar method. *ecolor* and *capsize* @@ -4652,7 +4652,7 @@ class Axes(martist.Artist): yerr = kwargs.pop('yerr', None) error_kw = kwargs.pop('error_kw', dict()) ecolor = kwargs.pop('ecolor', None) -capsize = kwargs.pop('capsize', 3) +capsize = kwargs.pop('capsize', None) error_kw.setdefault('ecolor', ecolor) error_kw.setdefault('capsize', capsize) @@ -4882,7 +4882,7 @@ class Axes(martist.Artist): *yerr*if not None, will be used to generate errorbars on the bar chart *ecolor* specifies the color of any errorbar - *capsize* (default 3) determines the length in + *capsize* determines the length in points of the error bar caps *align* 'edge' (default) | 'center' *log* [False|True] False (default) leaves the @@ -5175,14 +5175,14 @@ class Axes(martist.Artist): @docstring.dedent_interpd def errorbar(self, x, y, yerr=None, xerr=None, - fmt='-', ecolor=None, elinewidth=None, capsize=3, + fmt='-', ecolor=None, elinewidth=None, capsize=None, barsabove=False, lolims=False, uplims=False, xlolims=False, xuplims=False, errorevery=1, **kwargs): """ Call signature:: errorbar(x, y, yerr=None, xerr=None, - fmt='-', ecolor=None, elinewidth=None, capsize=3, + fmt='-', ecolor=None, elinewidth=None, capsize=None, barsabove=False, lolims=False, uplims=False, xlolims=False, xuplims=False) @@ -5337,6 +5337,8 @@ class Axes(martist.Artist): ys = [thisy for thisy, b in zip(ys, mask) if b] return xs, ys +if capsize is None: + capsize = rcParams['lines.capsize'] if capsize > 0: plot_kw = { diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py index 6df1d4b..e3d3b85 100644 --- a/lib/matplotlib/rcsetup.py +++ b/lib/matplotlib/rcsetup.py @@ -379,6 +379,7 @@ defaultParams = { 'lines.solid_joinstyle' : ['round', validate_joinstyle], 'lines.dash_capstyle' : ['butt', validate_capstyle],
Re: [matplotlib-devel] Fwd: Patch: set capsize of errorbar via matplotlibrc
: ) Thanks for the response. On 08/30/2012 08:41 PM, Eric Firing wrote: > Submitting patches as github pull requests is strongly preferred. See > http://matplotlib.sourceforge.net/devel/index.html. > > In the svn days, most devel discussions of proposed changes occurred on > this mailing list, but now attention is much more on github PRs and less > on the mailing list. Okay, I will try that then! >> Please allow me to participate. > > We welcome you--but sometimes we are simply overwhelmed and/or > unorganized, and consequently unresponsive. There is a random aspect to it! I can deal with randomness, in fact, the field of statistics is one of my special interests : D > Regarding your patch: this sounds like it might be a good idea, but I > don't think the rc param should be called lines.capsize because it is > not a general line property, but something specific to errorbars. > "lines.*cap*" refer to completely unrelated general line properties. > > It would be good to get some thoughts from others as to whether to an > "errorbar" or similar category should be added to rcParams, with your > suggestion as the first entry in that category. Maybe we need some > policy guideline as to what should go in rcParams and what should not. You are right, I also thought about that. My first idea was to add an errorbar.* category, but then I saw that also the bar plots (axes.bar(...), axes.barh(...)) use caps. What I am trying to say is that it is not only used by axes.errorbar(...). That's why I put into the lines.* category, but that's certainly open for discussion. Having a policy on what to put into rcParams sounds useful. Best regards, Hans -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] code review: capsize-default
Hi all, I have written a patch in order to set the length of cap lines in errorbar plots via rcParams. I would like to see this feature in the master branch. Please review my code https://github.com/HDembinski/matplotlib/compare/capsize-default Regards, Hans -- Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
