SourceForge logo
SourceForge logo
Menu

matplotlib-devel — matplotlib developers

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
(1)
Nov
(33)
Dec
(20)
2004 Jan
(7)
Feb
(44)
Mar
(51)
Apr
(43)
May
(43)
Jun
(36)
Jul
(61)
Aug
(44)
Sep
(25)
Oct
(82)
Nov
(97)
Dec
(47)
2005 Jan
(77)
Feb
(143)
Mar
(42)
Apr
(31)
May
(93)
Jun
(93)
Jul
(35)
Aug
(78)
Sep
(56)
Oct
(44)
Nov
(72)
Dec
(75)
2006 Jan
(116)
Feb
(99)
Mar
(181)
Apr
(171)
May
(112)
Jun
(86)
Jul
(91)
Aug
(111)
Sep
(77)
Oct
(72)
Nov
(57)
Dec
(51)
2007 Jan
(64)
Feb
(116)
Mar
(70)
Apr
(74)
May
(53)
Jun
(40)
Jul
(519)
Aug
(151)
Sep
(132)
Oct
(74)
Nov
(282)
Dec
(190)
2008 Jan
(141)
Feb
(67)
Mar
(69)
Apr
(96)
May
(227)
Jun
(404)
Jul
(399)
Aug
(96)
Sep
(120)
Oct
(205)
Nov
(126)
Dec
(261)
2009 Jan
(136)
Feb
(136)
Mar
(119)
Apr
(124)
May
(155)
Jun
(98)
Jul
(136)
Aug
(292)
Sep
(174)
Oct
(126)
Nov
(126)
Dec
(79)
2010 Jan
(109)
Feb
(83)
Mar
(139)
Apr
(91)
May
(79)
Jun
(164)
Jul
(184)
Aug
(146)
Sep
(163)
Oct
(128)
Nov
(70)
Dec
(73)
2011 Jan
(235)
Feb
(165)
Mar
(147)
Apr
(86)
May
(74)
Jun
(118)
Jul
(65)
Aug
(75)
Sep
(162)
Oct
(94)
Nov
(48)
Dec
(44)
2012 Jan
(49)
Feb
(40)
Mar
(88)
Apr
(35)
May
(52)
Jun
(69)
Jul
(90)
Aug
(123)
Sep
(112)
Oct
(120)
Nov
(105)
Dec
(116)
2013 Jan
(76)
Feb
(26)
Mar
(78)
Apr
(43)
May
(61)
Jun
(53)
Jul
(147)
Aug
(85)
Sep
(83)
Oct
(122)
Nov
(18)
Dec
(27)
2014 Jan
(58)
Feb
(25)
Mar
(49)
Apr
(17)
May
(29)
Jun
(39)
Jul
(53)
Aug
(52)
Sep
(35)
Oct
(47)
Nov
(110)
Dec
(27)
2015 Jan
(50)
Feb
(93)
Mar
(96)
Apr
(30)
May
(55)
Jun
(83)
Jul
(44)
Aug
(8)
Sep
(5)
Oct
Nov
(1)
Dec
(1)
2016 Jan
Feb
Mar
(1)
Apr
May
Jun
(2)
Jul
Aug
(3)
Sep
(1)
Oct
(3)
Nov
Dec
2017 Jan
Feb
(5)
Mar
Apr
May
Jun
Jul
(3)
Aug
Sep
(7)
Oct
Nov
Dec
2018 Jan
Feb
Mar
Apr
May
Jun
Jul
(2)
Aug
Sep
Oct
Nov
Dec
S M T W T F S


1
2
3
(2)
4
5
6
7
8
9
(2)
10
(5)
11
12
(1)
13
14
15
(3)
16
17
(3)
18
(9)
19
20
(2)
21
22
23
(7)
24
(4)
25
(1)
26
27
28
(1)
29
(1)
30
31
(12)


Showing 2 results of 2

From: Eric F. <ef...@ha...> - 2007年05月20日 23:41:58
John Hunter wrote:
[...]
> Yes, we've often talked about using traits here and elsewhere but the
> idea has languished because it has never made it to the top of
> anyone's priority queue. I just added examples/rc_traits.py, which is
> the example code I wrote some time ago when I was exploring how to use
> traits for rc and other mpl properties. I'll also post it again here
> in case someone wants to run with it.
Apart from the (significant) questions of time and priorities, I backed 
off a couple times from investigating traits because the enthought 
package does not seem to be a nice, clean, easily-installable chunk as 
it stands, and because the last time I looked at it, it used its own 
numerix support for arrays; I suspect it still does. And there is 
always the concern about adding yet another learning curve to mpl 
development; so I still don't know whether it would be a net benefit if 
the other impediments were removed.
Eric
From: John H. <jd...@gm...> - 2007年05月20日 13:57:28
On 5/18/07, Darren Dale <dd...@co...> wrote:
> > Using some dedicated class-instance instead of a dict would allow for:
> > - automatic conistency checks on setting
> > - possibly even change propagation (likely faster and certainly less
> > error prone if done right: I'm not sure how many places rcParams dependent
> > results apart from the tex-stuff are cached and should be recomputed when
> > certain params change, but obviously an push/'event'-based solutin could be
> > faster than pull/polling)
> This sounds like a good proposal to me. Some other devs had considered using
> the traits package to address some of these points. Maybe they will comment.
>
> > 2. It also seems to me that having some custom config file format rather
> > than just (a literal-only subset of) python is suboptimal. Why make people
> > learn another and more limited syntax when python literals are already
> > familiar and both more powerful and easier to use
>
> If someone donated a nickel for every time I have seen this argument on the
> mailing list, we might have enough money to buy John a doughnut.
Yes, we've often talked about using traits here and elsewhere but the
idea has languished because it has never made it to the top of
anyone's priority queue. I just added examples/rc_traits.py, which is
the example code I wrote some time ago when I was exploring how to use
traits for rc and other mpl properties. I'll also post it again here
in case someone wants to run with it.
# I spent some time working on matplotlib rc properties as enthought
# traits as a precursor to porting matplotlib properties to traits.
# Here is some example code showing how to define some representative rc
# properties and construct a matplotlib artist using traits. Because
# matplotlib ships with enthought traits already, you can run this
# script with just matplotlib. Unfortunately, we do not ship the ex UI
# component so you can't test that part. I'm a bit of a traits newbie
# so there are probably better ways to do what I have done below.
import sys, os, re
import matplotlib.enthought.traits as traits
from matplotlib.cbook import is_string_like
from matplotlib.artist import Artist
doprint = True
flexible_true_trait = traits.Trait(
 True,
 { 'true': True, 't': True, 'yes': True, 'y': True, 'on': True, True: True,
 'false': False, 'f': False, 'no': False, 'n': False, 'off':
False, False: False
 } )
flexible_false_trait = traits.Trait( False, flexible_true_trait )
colors = {
 'c' : '#00bfbf',
 'b' : '#0000ff',
 'g' : '#008000',
 'k' : '#000000',
 'm' : '#bf00bf',
 'r' : '#ff0000',
 'w' : '#ffffff',
 'y' : '#bfbf00',
 'gold' : '#FFD700',
 'peachpuff' : '#FFDAB9',
 'navajowhite' : '#FFDEAD',
 }
def hex2color(s):
 "Convert hex string (like html uses, eg, #efefef) to a r,g,b tuple"
 return tuple([int(n, 16)/255.0 for n in (s[1:3], s[3:5], s[5:7])])
class RGBA(traits.HasTraits):
 # r,g,b,a in the range 0-1 with default color 0,0,0,1 (black)
 r = traits.Range(0., 1., 0.)
 g = traits.Range(0., 1., 0.)
 b = traits.Range(0., 1., 0.)
 a = traits.Range(0., 1., 1.)
 def __init__(self, r=0., g=0., b=0., a=1.):
 self.r = r
 self.g = g
 self.b = b
 self.a = a
 def __repr__(self):
 return 'r,g,b,a = (%1.2f, %1.2f, %1.2f, %1.2f)'%\
 (self.r, self.g, self.b, self.a)
def tuple_to_rgba(ob, name, val):
 tup = [float(x) for x in val]
 if len(tup)==3:
 r,g,b = tup
 return RGBA(r,g,b)
 elif len(tup)==4:
 r,g,b,a = tup
 return RGBA(r,g,b,a)
 else:
 raise ValueError
tuple_to_rgba.info = 'a RGB or RGBA tuple of floats'
def hex_to_rgba(ob, name, val):
 rgx = re.compile('^#[0-9A-Fa-f]{6}$')
 if not is_string_like(val):
 raise TypeError
 if rgx.match(val) is None:
 raise ValueError
 r,g,b = hex2color(val)
 return RGBA(r,g,b,1.0)
hex_to_rgba.info = 'a hex color string'
def colorname_to_rgba(ob, name, val):
 hex = colors[val.lower()]
 r,g,b = hex2color(hex)
 return RGBA(r,g,b,1.0)
colorname_to_rgba.info = 'a named color'
def float_to_rgba(ob, name, val):
 val = float(val)
 return RGBA(val, val, val, 1.)
float_to_rgba.info = 'a grayscale intensity'
Color = traits.Trait(RGBA(), float_to_rgba, colorname_to_rgba, RGBA,
 hex_to_rgba, tuple_to_rgba)
def file_exists(ob, name, val):
 fh = file(val, 'r')
 return val
def path_exists(ob, name, val):
 os.path.exists(val)
linestyles = ('-', '--', '-.', ':', 'steps', 'None')
TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN = range(4)
linemarkers = (None, '.', ',', 'o', '^', 'v', '<', '>', 's',
 '+', 'x', 'd', 'D', '|', '_', 'h', 'H',
 'p', '1', '2', '3', '4',
 TICKLEFT,
 TICKRIGHT,
 TICKUP,
 TICKDOWN,
 'None'
 )
class LineRC(traits.HasTraits):
 linewidth = traits.Float(0.5)
 linestyle = traits.Trait(*linestyles)
 color = Color
 marker = traits.Trait(*linemarkers)
 markerfacecolor = Color
 markeredgecolor = Color
 markeredgewidth = traits.Float(0.5)
 markersize = traits.Float(6)
 antialiased = flexible_true_trait
 data_clipping = flexible_false_trait
class PatchRC(traits.HasTraits):
 linewidth = traits.Float(1.0)
 facecolor = Color
 edgecolor = Color
 antialiased = flexible_true_trait
timezones = 'UTC', 'US/Central', 'ES/Eastern' # fixme: and many more
backends = ('GTKAgg', 'Cairo', 'FltkAgg', 'GD', 'GDK', 'GTK', 'Agg',
 'GTKCairo', 'Paint', 'PS', 'SVG', 'Template', 'TkAgg',
 'WX')
class RC(traits.HasTraits):
 backend = traits.Trait(*backends)
 numerix = traits.Trait('Numeric', 'numarray')
 interactive = flexible_false_trait
 toolbar = traits.Trait('toolbar2', 'classic', None)
 timezone = traits.Trait(*timezones)
 lines = traits.Trait(LineRC())
 patch = traits.Trait(PatchRC())
rc = RC()
rc.lines.color = 'r'
if doprint:
 print 'RC'
 rc.print_traits()
 print 'RC lines'
 rc.lines.print_traits()
 print 'RC patches'
 rc.patch.print_traits()
class Patch(Artist, traits.HasTraits):
 linewidth = traits.Float(0.5)
 facecolor = Color
 fc = facecolor
 edgecolor = Color
 fill = flexible_true_trait
 def __init__(self,
 edgecolor=None,
 facecolor=None,
 linewidth=None,
 antialiased = None,
 fill=1,
 **kwargs
 ):
 Artist.__init__(self)
 if edgecolor is None: edgecolor = rc.patch.edgecolor
 if facecolor is None: facecolor = rc.patch.facecolor
 if linewidth is None: linewidth = rc.patch.linewidth
 if antialiased is None: antialiased = rc.patch.antialiased
 self.edgecolor = edgecolor
 self.facecolor = facecolor
 self.linewidth = linewidth
 self.antialiased = antialiased
 self.fill = fill
p = Patch()
p.facecolor = '#bfbf00'
p.edgecolor = 'gold'
p.facecolor = (1,.5,.5,.25)
p.facecolor = 0.25
p.fill = 'f'
print 'p.facecolor', type(p.facecolor), p.facecolor
print 'p.fill', type(p.fill), p.fill
if p.fill_: print 'fill'
else: print 'no fill'
if doprint:
 print
 print 'Patch'
 p.print_traits()

Showing 2 results of 2

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /