Re: [Matplotlib-users] edgecolor with usetex=True, usedistiller='pdf'

2007-09-28 Thread Darren Dale
On Friday 28 September 2007 07:36:23 am John Hunter wrote:
> On 9/27/07, Darren Dale <[EMAIL PROTECTED]> wrote:
> > Hi Eric, John,
> >
> > Have either of you been following this thread?
>
> I am now :-)
>
> As Eric suggests, None is overloaded vis-a-vis color handling, because
> for mpl properties it generally means do the default as defined by rc.
>  For colors people often want to use None for "no color" which is why
> we added support for the string "None".  Does this work in your use
> case Tom?

The above exchange was off-list, we're back on now. I think that would be what 
Tom is looking for, but it doesnt work:

In [1]: plot([1,2])
Out[1]: []

In [2]: savefig('dsd.png', facecolor='None', edgecolor='None')
---
ValueErrorTraceback (most recent call last)

/home/darren/ in ()

/usr/lib64/python2.5/site-packages/matplotlib/pyplot.py in savefig(*args, 
**kwargs)
272 def savefig(*args, **kwargs):
273 fig = gcf()
--> 274 return fig.savefig(*args, **kwargs)
275 if Figure.savefig.__doc__ is not None:
276 savefig.__doc__ = dedent(Figure.savefig.__doc__)

/usr/lib64/python2.5/site-packages/matplotlib/figure.py in savefig(self, 
*args, **kwargs)
768 kwargs[key] = rcParams['savefig.%s'%key]
769
--> 770 self.canvas.print_figure(*args, **kwargs)
771
772 def colorbar(self, mappable, cax=None, **kw):

/usr/lib64/python2.5/site-packages/matplotlib/backends/backend_qt4agg.py in 
print_figure(self, *args, **kwargs)
153 self.update(l, self.renderer.height-t, w, h)
154
155 def print_figure(self, *args, **kwargs):
--> 156 FigureCanvasAgg.print_figure(self, *args, **kwargs)
157 self.draw()

/usr/lib64/python2.5/site-packages/matplotlib/backend_bases.py in 
print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, 
**kwargs)
   1194 edgecolor=edgecolor,
   1195 orientation=orientation,
-> 1196 **kwargs)
   1197 finally:
   1198 self.figure.dpi.set(origDPI)

/usr/lib64/python2.5/site-packages/matplotlib/backends/backend_agg.py in 
print_png(self, filename, *args, **kwargs)
415
416 def print_png(self, filename, *args, **kwargs):
--> 417 self.draw()
418 self.get_renderer()._renderer.write_png(str(filename))
419

/usr/lib64/python2.5/site-packages/matplotlib/backends/backend_qt4agg.py in 
draw(self)
140 if DEBUG: print "FigureCanvasQtAgg.draw", self
141 self.replot = True
--> 142 FigureCanvasAgg.draw(self)
143 self.update()
144

/usr/lib64/python2.5/site-packages/matplotlib/backends/backend_agg.py in 
draw(self)
377
378 self.renderer = self.get_renderer()
--> 379 self.figure.draw(self.renderer)
380
381 def get_renderer(self):

/usr/lib64/python2.5/site-packages/matplotlib/figure.py in draw(self, 
renderer)
586 self.transFigure.freeze()  # eval the lazy objects
587
--> 588 if self.frameon: self.figurePatch.draw(renderer)
589
590 for p in self.patches: p.draw(renderer)

/usr/lib64/python2.5/site-packages/matplotlib/patches.py in draw(self, 
renderer)
198 #renderer.open_group('patch')
199 gc = renderer.new_gc()
--> 200 gc.set_foreground(self._edgecolor)
201 gc.set_linewidth(self._linewidth)
202 gc.set_alpha(self._alpha)

/usr/lib64/python2.5/site-packages/matplotlib/backend_bases.py in 
set_foreground(self, fg, isRGB)
617 self._rgb = fg
618 else:
--> 619 self._rgb = colors.colorConverter.to_rgb(fg)
620
621 def set_graylevel(self, frac):

/usr/lib64/python2.5/site-packages/matplotlib/colors.py in to_rgb(self, arg)
277
278 except (KeyError, ValueError, TypeError), exc:
--> 279 raise ValueError('to_rgb: Invalid rgb arg "%s"\n%s' % 
(str(arg), exc))
280 # Error messages could be improved by handling TypeError
281 # separately; but this should be rare and not too hard

ValueError: to_rgb: Invalid rgb arg "None"
invalid literal for float(): None

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Problem with tick labels in scripts

2007-09-28 Thread John Hunter
On 9/27/07, Charles Seaton <[EMAIL PROTECTED]> wrote:

> I am having the same problem as Eugen, and the suggested solution of using
> a.xaxis.get_major_locator().refresh()
> to force the creation of the full set of ticklabels doesn't seem to work for
> me.

matplotlib creates a prototypical tick (the prototick) and then
creates new ones on as as needed basis, copying properties from the
prototick.  Of course, position is one of the properties that cannot
be copied, which is why you are having trouble in your example.
Fortunately, there is an easy solution.

Call ax.xaxis.get_major_ticks() and access the label attribute:

for tick in ax.xaxis.get_major_ticks():
   label = tick.label1

Axis.get_major_ticks  will force a call to the locator and update the
tick list.  The Axes methods like get_xticklabels are just working on
the existing tick list rather than calling the get_major_ticks method
which is why you are not getting the full list.  This is a bug.  I
just made changes in svn so that all the accessor methods
(ax.get_xticklines, ax.get_yticklabels, and friends) all trigger a
call to axis.get_major_ticks rather so they should give the same
results going forward.


JDH


FYI, the Tick attributes are:

  tick1line  : a Line2D instance
  tick2line  : a Line2D instance
  gridline   : a Line2D instance
  label1 : a Text instance
  label2 : a Text instance
  gridOn : a boolean which determines whether to draw the tickline
  tick1On: a boolean which determines whether to draw the 1st tickline
  tick2On: a boolean which determines whether to draw the 2nd tickline
  label1On   : a boolean which determines whether to draw tick label
  label2On   : a boolean which determines whether to draw tick label

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users