[matplotlib-devel] Patch: set capsize of errorbar via matplotlibrc

2012-08-09 Thread Hans Dembinski

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 bars
 
 ### PATCHES
 # Patches are graphical objects that fill 2D space, like polygons or
-- 
1.7.9.5

--
Live Security Virtual Conference
Exclusive live event will cover all the w

Re: [matplotlib-devel] bad link on matplotlib website

2012-08-09 Thread Benjamin Root
On Mon, Aug 6, 2012 at 5:51 PM, Michael Droettboom  wrote:

>  On 08/06/2012 02:10 PM, Benjamin Root wrote:
>
>
>
> On Tue, Dec 6, 2011 at 4:15 PM, Jim Hunziker  wrote:
>
>> I'm not sure if this is the right place to report this, but the link
>> to Python(x, y) on
>> http://matplotlib.sourceforge.net/users/installing.html points to a
>> page that no longer exists.
>>
>> --
>> Jim Hunziker
>>
>>
> Starting to go back over my backlog of emails.  I can confirm that this is
> the case.
>
> I assume we should just link to:
>
>   http://www.pythonxy.com/
>
> Correct?  If so, I can fix this in the repository.
>
> Mike
>
>
Yeah, I think so.  Not sure why we linked to the foreward before.

Ben Root
--
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