Re: [matplotlib-devel] system fonts not found
On Thu, Sep 25, 2008 at 9:31 AM, Darren Dale <[EMAIL PROTECTED]> wrote: > I noticed this morning that my Times and Palatino system fonts are not being > found anymore. I removed my fontManager.cache and ran my script with > verbose=debug, and it looks like creatFontDict found them, but then findfont > cant: I recently fixed another bug related to font finding when an explicit file name was passed -- I wonder if I broke a normal use case. It's a simple change shown in the diff below. Could you manually revert on your end and see if it makes a difference. If so, I'll have to find another solution to the problem I was fixing. [EMAIL PROTECTED]:mpl> svn diff lib/matplotlib/font_manager.py -r6097:6098 Index: lib/matplotlib/font_manager.py === --- lib/matplotlib/font_manager.py (revision 6097) +++ lib/matplotlib/font_manager.py (revision 6098) @@ -955,7 +955,7 @@ fname = prop.get_file() if fname is not None: verbose.report('findfont returning %s'%fname, 'debug') -return fname[0] +return fname if fontext == 'afm': fontdict = self.afmdict - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] system fonts not found
On Thursday 25 September 2008 11:53:04 am John Hunter wrote: > On Thu, Sep 25, 2008 at 9:31 AM, Darren Dale <[EMAIL PROTECTED]> wrote: > > I noticed this morning that my Times and Palatino system fonts are not > > being found anymore. I removed my fontManager.cache and ran my script > > with verbose=debug, and it looks like creatFontDict found them, but then > > findfont cant: > > I recently fixed another bug related to font finding when an explicit > file name was passed -- I wonder if I broke a normal use case. It's a > simple change shown in the diff below. Could you manually revert on > your end and see if it makes a difference. If so, I'll have to find > another solution to the problem I was fixing. > > > [EMAIL PROTECTED]:mpl> svn diff lib/matplotlib/font_manager.py -r6097:6098 > Index: lib/matplotlib/font_manager.py > === > --- lib/matplotlib/font_manager.py (revision 6097) > +++ lib/matplotlib/font_manager.py (revision 6098) > @@ -955,7 +955,7 @@ > fname = prop.get_file() > if fname is not None: > verbose.report('findfont returning %s'%fname, 'debug') > -return fname[0] > +return fname > > if fontext == 'afm': > fontdict = self.afmdict I tried this, but it didnt change anything. I ended up checking the values of the keys in the fontdict, and noticed that rather than "Times" I needed to use "Times New Roman", for example. Maybe this is a change in my font packages, or maybe my configuration was always out of whack and I hadnt noticed because I was using usetex up until now, in which case I apologize for noise. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] spy: ignore zero values in sparse matrix
On Fri, Sep 26, 2008 at 2:36 PM, Tony S Yu <[EMAIL PROTECTED]> wrote: > I guess you could plot sparse all-zero matrices with image mode. My only > hesitation is that sparse arrays tend to be very large and (I imagine) this > would lead to very slow performance. I assumed this was the reason image > mode wasn't adapted to use sparse arrays. > > Actually, now that I think about it: you could plot a trivially small image > and just adjust the coordinates so that they correspond to the original > matrix shape. Is this what you were thinking? This is something I considered, but I was thinking less about the implementation and more about the functionality. I don't want to raise an exception unless the input doesn't make sense. I would rather the user start at a boring image and figure out why it is blank that deal with an exception. > I should note that a dense zero array also fails to plot with spy *if marker > mode is used*. Can you fix this along with spy2? JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] spy: ignore zero values in sparse matrix
On Sep 26, 2008, at 5:01 PM, Eric Firing wrote: > Also, if an image cannot be resolved by the output device, info is > lost--one might not see anything at a location where there actually > is a value--whereas with markers, a marker will always show up, and > the only problem is that one can't necessarily distinguish a single > point from a cluster. > > The real problem with all-zero values is that plot can't handle > "plot([],[])". One can work around this by putting in bogus values > to plot a single point, saving the line, and then setting the line > data to empty; or, better, by not using the high-level plot command, > but by generating the Line2D object and adding it to the axes. The > Line2D initializer is happy with empty x and y sequences. I think if > you use this approach it will kill two bugs (failure on all-zeros > with sparse and full arrays) with one very simple stone. > > Eric Thanks for the tip Eric. Below is a patch for spy that implements Eric's suggestion. This patch seems to work for a couple simple tests on my end: sparse and dense arrays with non-zero and all-zero values. A couple of notes: * the call to `add_artist` isn't needed to show the correct plot, but it may be helpful for debugging. * the docstring for `spy` suggests that a Line2D instance is returned, but `spy` currently returns a list with a Line2D instance. I set all- zero arrays to return a list also, for consistency. -Tony Index: matplotlib/lib/matplotlib/axes.py === --- matplotlib/lib/matplotlib/axes.py (revision 6123) +++ matplotlib/lib/matplotlib/axes.py (working copy) @@ -6723,9 +6723,9 @@ else: if hasattr(Z, 'tocoo'): c = Z.tocoo() -y = c.row -x = c.col -z = c.data +nonzero = c.data != 0. +y = c.row[nonzero] +x = c.col[nonzero] else: Z = np.asarray(Z) if precision is None: mask = Z!=0. @@ -6733,8 +6733,12 @@ y,x,z = mlab.get_xyz_where(mask, mask) if marker is None: marker = 's' if markersize is None: markersize = 10 -lines = self.plot(x, y, linestyle='None', - marker=marker, markersize=markersize, **kwargs) +if len(x) == 0: +lines = [mlines.Line2D([], [])] +self.add_artist(lines[0]) +else: +lines = self.plot(x, y, linestyle='None', + marker=marker, markersize=markersize, **kwargs) nr, nc = Z.shape self.set_xlim(xmin=-0.5, xmax=nc-0.5) self.set_ylim(ymin=nr-0.5, ymax=-0.5) Index: matplotlib/examples/pylab_examples/masked_demo.py === --- matplotlib/examples/pylab_examples/masked_demo.py (revision 6123) +++ matplotlib/examples/pylab_examples/masked_demo.py (working copy) @@ -1,4 +1,4 @@ -#!/bin/env python +#!/usr/bin/env python ''' Plot lines with points masked out. Index: matplotlib/examples/misc/rec_groupby_demo.py === --- matplotlib/examples/misc/rec_groupby_demo.py(revision 6123) +++ matplotlib/examples/misc/rec_groupby_demo.py(working copy) @@ -2,7 +2,7 @@ import matplotlib.mlab as mlab -r = mlab.csv2rec('data/aapl.csv') +r = mlab.csv2rec('../data/aapl.csv') r.sort() def daily_return(prices): - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] spy: ignore zero values in sparse matrix
Tony S Yu wrote: > Hi Eric, > > Sorry for the late reply. > > On Sep 27, 2008, at 8:56 PM, Eric Firing wrote: > >> Actually, I think the most logical thing would be to let the default >> None give the old behavior, and require precision=0 to get the new >> behavior. What do you think? Is it OK if I make this change? It >> is more consistent with the old behavior. > > I'm ambivalent about this change. On one hand, I think it makes a lot > more sense to have None give the old behavior and precision=0 to > ignore zero values in the sparse array (then precision would be > consistent for finite values and for zero). > > On the other hand, I think ignoring zero values should be the default > behavior for sparse arrays (although, I definitely agree there should > be the option to plot all assigned values). > > Would it be possible to make the change you suggest and also change > the default precision value to 0? (see diff below) This change would > also allow you to remove a lot of the special handling for > precision=None, since precision=0 gives the same result (I didn't go > this far in the diff below). Good point. I made that change, but then made precision='present' be the value for sparse arrays to show all filled cells. precision=None is deprecated, but converted to 0. Eric - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] system fonts not found
John, As you may know, you're reverting the change Michael made sometime ago. Michael said it is not a bug, but rather intended. http://sourceforge.net/mailarchive/message.php?msg_id=6e8d907b0809031201p4bb0701eo23b3d294797a8766%40mail.gmail.com So, I would appreciate if you reiterate this with Micheal before I change back my scripts again. Regards, -JJ On Thu, Sep 25, 2008 at 11:53 AM, John Hunter <[EMAIL PROTECTED]> wrote: > On Thu, Sep 25, 2008 at 9:31 AM, Darren Dale <[EMAIL PROTECTED]> wrote: >> I noticed this morning that my Times and Palatino system fonts are not being >> found anymore. I removed my fontManager.cache and ran my script with >> verbose=debug, and it looks like creatFontDict found them, but then findfont >> cant: > > I recently fixed another bug related to font finding when an explicit > file name was passed -- I wonder if I broke a normal use case. It's a > simple change shown in the diff below. Could you manually revert on > your end and see if it makes a difference. If so, I'll have to find > another solution to the problem I was fixing. > > > [EMAIL PROTECTED]:mpl> svn diff lib/matplotlib/font_manager.py -r6097:6098 > Index: lib/matplotlib/font_manager.py > === > --- lib/matplotlib/font_manager.py (revision 6097) > +++ lib/matplotlib/font_manager.py (revision 6098) > @@ -955,7 +955,7 @@ > fname = prop.get_file() > if fname is not None: > verbose.report('findfont returning %s'%fname, 'debug') > -return fname[0] > +return fname > > if fontext == 'afm': > fontdict = self.afmdict > > - > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > ___ > Matplotlib-devel mailing list > Matplotlib-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel