>>>>> "Eric" == Eric Firing <[EMAIL PROTECTED]> writes:
Eric> It raises larger API questions. From the standpoint of Eric> user-level code readability, the present array of marker and Eric> line identifiers (inherited from Matlab) is not good. For Eric> example, why should '-' mean a solid line, but '_' means a Eric> horizontal line marker? What is the difference between '^' Eric> and '2', and how on earth is anyone reading the code Eric> supposed to know what '2' means? The only justification I Eric> can see for the 1- and 2-character codes is their Eric> convenience in interactive use for things like Eric> "plot(x,y,'g.'". I would not want this to go away, but for Eric> non-interactive coding I think longer names, typically Eric> corresponding to the name of the function that generates the I think for interactive use it is important to keep these short characters though you are right, for some of the more arcane ones like 1,2,3,4 it makes no sense since there is no mnemonic. But I see no harm in keeping them for interactive users Eric> This needs either some broader discussion, or a command Eric> decision by John along the lines of "Forget it; it's OK the Eric> way it is, or it is too late to make any change in this part Eric> of the API." As you suggest, what we need to provide is an easy way for people to use long readable names. The easiest way is in set_marker and set_linestyle to do something like (untested sketch) def set_linestyle(self, linestyle): funcname = '_draw_%s'%linestyle func = getattr(self, funcname, None) if callable(func): self._lineFunc = func and ditto for set_marker while still supporting the old mnemonics. We can then advertise any of names available as values in the Line2D._lineStyles and Line2D._markers dictionaries as legitimate values for the linestyle and marker properties. Extra credit for auto-updating the docstring by parsing the dictionary values. In [1]: from matplotlib.lines import Line2D In [2]: print [name[6:] for name in Line2D._markers.values() if name.startswith('_draw_')] ['tickleft', 'tickright', 'tickup', 'tickdown', 'nothing', 'nothing', 'plus', 'pixel', 'point', 'tri_down', 'tri_left', 'tri_up', 'tri_right', 'triangle_left', 'triangle_right', 'nothing', 'diamond', 'hexagon2', 'hline', 'triangle_up', 'thin_diamond', 'hexagon1', 'circle', 'pentagon', 'square', 'triangle_down', 'x', 'vline'] JDH ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel