Here is a patch to add linestyles to patches.py. I have tried it with
unfilled step histograms (important for b/w print and colour blind
people).
What do you think?
Cheers,
Olle
Index: patches.py
===================================================================
--- patches.py (revision 5595)
+++ patches.py (working copy)
@@ -54,6 +54,7 @@
edgecolor=None,
facecolor=None,
linewidth=None,
+ linestyle=None,
antialiased = None,
hatch = None,
fill=True,
@@ -66,11 +67,13 @@
artist.Artist.__init__(self)
if linewidth is None: linewidth = mpl.rcParams['patch.linewidth']
+ if linestyle is None: linestyle = "solid"
if antialiased is None: antialiased = mpl.rcParams['patch.antialiased']
self.set_edgecolor(edgecolor)
self.set_facecolor(facecolor)
self.set_linewidth(linewidth)
+ self.set_linestyle(linestyle)
self.set_antialiased(antialiased)
self.set_hatch(hatch)
self.fill = fill
@@ -117,6 +120,7 @@
self.set_fill(other.get_fill())
self.set_hatch(other.get_hatch())
self.set_linewidth(other.get_linewidth())
+ self.set_linestyle(other.get_linestyle)
self.set_transform(other.get_data_transform())
self.set_figure(other.get_figure())
self.set_alpha(other.get_alpha())
@@ -148,6 +152,10 @@
def get_linewidth(self):
return self._linewidth
get_lw = get_linewidth
+
+ def get_linestyle(self):
+ return self._linestyle
+ get_ls = get_linestyle
def set_antialiased(self, aa):
"""
@@ -188,7 +196,17 @@
if w is None: w = mpl.rcParams['patch.linewidth']
self._linewidth = w
set_lw = set_linewidth
+
+ def set_linestyle(self, ls):
+ """
+ Set the patch linestyle
+ ACCEPTS: ['solid' | 'dashed' | 'dashdot' | 'dotted']
+ """
+ if ls is None: ls = "solid"
+ self._linestyle = ls
+ set_ls = set_linestyle
+
def set_fill(self, b):
"""
Set whether to fill the patch
@@ -240,6 +258,7 @@
else:
gc.set_foreground(self._edgecolor)
gc.set_linewidth(self._linewidth)
+ gc.set_linestyle(self._linestyle)
gc.set_alpha(self._alpha)
gc.set_antialiased(self._antialiased)
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel