From: Humufr <humufr@ya...>  20040403 02:00:48

Hello, I have a problem to obtain a good ps file (with mathematical symbol) with matplotlib. That's work very good with a png file but not with a postscript. I tried to define the TTFPATH and AFMPATH but that change nothing. I think that I miss one configuration somewhere but I can't arrive to find what... Thank you for this soft, I just begin to use but it's seems very interesting Nicolas 
From: John Hunter <jdhunter@ac...>  20040403 14:09:19

>>>>> "Humufr" == Humufr <humufr@...> writes: Humufr> Hello, I have a problem to obtain a good ps file Humufr> (with mathematical symbol) with matplotlib. That's work Humufr> very good with a png file but not with a postscript. Humufr> I tried to define the TTFPATH and AFMPATH but that change Humufr> nothing. I think that I miss one configuration somewhere Humufr> but I can't arrive to find what... Humufr> Thank you for this soft, I just begin to use but it's Humufr> seems very interesting I haven't yet added mathtext to the postscript backend, though I will as soon as I get the time. See the mathtext documentation at http://matplotlib.sf.net/matplotlib.mathtext.html for the latest information about mathtext, which backends it works on, etc... mathtext is designed around the BaKoMa truetype fonts. There are also postscript versions of these fonts. Paul Barrett has been working on unifying the interface between AFM (postscript) and truetype fonts, but we're not there yet. When this is done, it will be easier to rewrite mathtext to work with either kind of font. Another possibility is to modify the postscript backend to use postscript level 3, which supports truetype fonts. This would be very nice because it would improve compatibility between the postscript, image and GUI backends. Another thing that needs to be done is to add image support to the postscript backend (draw_image). This shouldn't be too hard. The matplotlib freetype module ft2font has a method to get the font raster as a bitmap, which could be placed on the PS canvas with draw_image. This wouldn't be an ideal solution because it's not scalable, but it would be a fairly easy temporary solution. Volunteers welcome! JDH 
From: Peter Groszkowski <pgroszko@ge...>  20040405 21:23:28

Hi everyone: I was wondering whether it is possible to tell matplotlib how/when to connect data points. Consider this simple script: from matplotlib.matlab import * figure(1) t = [0,1,2,3,4,5,105,106,107] s = [1,4,5,3,9,11,5,8,3] plot(t, s, antialiased=False) grid(True) show() There are no data points between t=5 and t=105. By default the points (5,11) and (105,5) are connected, but I would like to tell matplotlib NOT to do so. In my case I would like to pass the plot function a variable telling it what to do. So for example would have: plot(t, s, max_delta=40) This would mean that the points are only to be connected if the difference between the adjacent t values is less than 40. In my case this is relevant because sometimes there are "holes" in my data, and connecting the points makes the plots look very messy. Would anyone find something like this useful? Would it be difficult to implement? Thanks. Peter 
From: John Hunter <jdhunter@ac...>  20040406 19:57:33

>>>>> "Peter" == Peter Groszkowski <pgroszko@...> writes: Peter> Hi everyone: I was wondering whether it is possible to tell Peter> matplotlib how/when to connect data points. Consider this Peter> simple script: Peter> from matplotlib.matlab import * figure(1) t = Peter> [0,1,2,3,4,5,105,106,107] s = [1,4,5,3,9,11,5,8,3] Peter> plot(t, s, antialiased=False) grid(True) show() Peter> There are no data points between t=5 and t=105. By default Peter> the points (5,11) and (105,5) are connected, but I would Peter> like to tell matplotlib NOT to do so. In my case I would Peter> like to pass the plot function a variable telling it what Peter> to do. So for example would have: Peter> plot(t, s, max_delta=40) Peter> This would mean that the points are only to be connected if Peter> the difference between the adjacent t values is less than Peter> 40. In my case this is relevant because sometimes there Peter> are "holes" in my data, and connecting the points makes the Peter> plots look very messy. Peter> Would anyone find something like this useful? Would it be Peter> difficult to implement? Certainly not difficult, and probably useful enough to put in the standard distro. Eg, in a stock market trading example, you would have lots of quotes, minute by minute, punctuated by long intervals overnight where the market is closed. If you set maxdelta appropriately, you could draw connected lines only within trading days. Here is a sample implementation from matplotlib.matlab import * def segplot(x, y, fmt, maxdelta, **kwargs): """ Plot x versus y, breaking the plot at any point where x[i]  x[i1] > maxdelta. kwargs are passed on to plot """ x = asarray(x) y = asarray(y) d = diff(x) lines = [] ind = nonzero(greater(d, maxdelta)) ind = ind+1 if not len(ind): lines.extend( plot(x,y,fmt,**kwargs) ) else: allind = [0] allind.extend(ind) allind.append(len(x)) for i1,i2 in zip(allind[:1], allind[1:]): lines.extend( plot(x[i1:i2], y[i1:i2], fmt, **kwargs) ) return lines t = [0,1,2,3,4,5,105,106,107,187, 200, 212, 300, 320] s = [1,4,5,3,9,11,5,8,3,12, 15, 12, 1, 3] segplot(t, s, 'bo', 40, antialiased=False) grid(True) show() I'm inclined not to make this part of plot, since plot processes a variable number of arguments it makes it a little difficult. Certainly doable, but I'm hesitant to put too much on plot because it might become unwieldy. But a new function, like segment plot, would be easy enough to include. Any suggestions for a name, or additional functionality? JDH 
From: Peter Groszkowski <pgroszko@ge...>  20040412 20:50:25

John Hunter wrote: [snip] >Here is a sample implementation > >from matplotlib.matlab import * >def segplot(x, y, fmt, maxdelta, **kwargs): > """ > Plot x versus y, breaking the plot at any point where x[i]  > x[i1] > maxdelta. kwargs are passed on to plot > """ > x = asarray(x) > y = asarray(y) > d = diff(x) > lines = [] > ind = nonzero(greater(d, maxdelta)) > ind = ind+1 > if not len(ind): > lines.extend( plot(x,y,fmt,**kwargs) ) > else: > allind = [0] > allind.extend(ind) > allind.append(len(x)) > for i1,i2 in zip(allind[:1], allind[1:]): > lines.extend( plot(x[i1:i2], y[i1:i2], fmt, **kwargs) ) > return lines > >t = [0,1,2,3,4,5,105,106,107,187, 200, 212, 300, 320] >s = [1,4,5,3,9,11,5,8,3,12, 15, 12, 1, 3] >segplot(t, s, 'bo', 40, antialiased=False) >grid(True) >show() > >I'm inclined not to make this part of plot, since plot processes a >variable number of arguments it makes it a little difficult. >Certainly doable, but I'm hesitant to put too much on plot because it >might become unwieldy. But a new function, like segment plot, would >be easy enough to include. > >Any suggestions for a name, or additional functionality? > > Thanks for the quick solution. I think the name is just fine. Best,  Peter Groszkowski Gemini Observatory Tel: +1 808 9742509 670 N. A'ohoku Place Fax: +1 808 9359235 Hilo, Hawai'i 96720, USA 
From: Vincent BOYER <boyer@cl...>  20040407 09:12:17

Hi everybody. Related to this discussion, here is something else that could be very useful for me : Let's say t =[0,5,15,18] s = [1,9,5] I'd like to plot a curve f(x) using s and t in a way that :  f(x)=1 for x in [0,5]  f(x)=9 for x in [5,15]  f(x)=51 for x in [5,18] Is there already a simple way to do that using Matplotlib, and if not, would it be possible to add it? Thanx Vincent John Hunter wrote: >>>>>>"Peter" == Peter Groszkowski <pgroszko@...> writes: >>>>>> > > Peter> Hi everyone: I was wondering whether it is possible to tell > Peter> matplotlib how/when to connect data points. Consider this > Peter> simple script: > > Peter> from matplotlib.matlab import * figure(1) t = > Peter> [0,1,2,3,4,5,105,106,107] s = [1,4,5,3,9,11,5,8,3] > Peter> plot(t, s, antialiased=False) grid(True) show() > > > Peter> There are no data points between t=5 and t=105. By default > Peter> the points (5,11) and (105,5) are connected, but I would > Peter> like to tell matplotlib NOT to do so. In my case I would > Peter> like to pass the plot function a variable telling it what > Peter> to do. So for example would have: > > Peter> plot(t, s, max_delta=40) > > Peter> This would mean that the points are only to be connected if > Peter> the difference between the adjacent t values is less than > Peter> 40. In my case this is relevant because sometimes there > Peter> are "holes" in my data, and connecting the points makes the > Peter> plots look very messy. > > Peter> Would anyone find something like this useful? Would it be > Peter> difficult to implement? > >Certainly not difficult, and probably useful enough to put in the >standard distro. Eg, in a stock market trading example, you would >have lots of quotes, minute by minute, punctuated by long intervals >overnight where the market is closed. If you set maxdelta >appropriately, you could draw connected lines only within trading >days. > >Here is a sample implementation > >from matplotlib.matlab import * >def segplot(x, y, fmt, maxdelta, **kwargs): > """ > Plot x versus y, breaking the plot at any point where x[i]  > x[i1] > maxdelta. kwargs are passed on to plot > """ > x = asarray(x) > y = asarray(y) > d = diff(x) > lines = [] > ind = nonzero(greater(d, maxdelta)) > ind = ind+1 > if not len(ind): > lines.extend( plot(x,y,fmt,**kwargs) ) > else: > allind = [0] > allind.extend(ind) > allind.append(len(x)) > for i1,i2 in zip(allind[:1], allind[1:]): > lines.extend( plot(x[i1:i2], y[i1:i2], fmt, **kwargs) ) > return lines > >t = [0,1,2,3,4,5,105,106,107,187, 200, 212, 300, 320] >s = [1,4,5,3,9,11,5,8,3,12, 15, 12, 1, 3] >segplot(t, s, 'bo', 40, antialiased=False) >grid(True) >show() > >I'm inclined not to make this part of plot, since plot processes a >variable number of arguments it makes it a little difficult. >Certainly doable, but I'm hesitant to put too much on plot because it >might become unwieldy. But a new function, like segment plot, would >be easy enough to include. > >Any suggestions for a name, or additional functionality? > >JDH > > > >This SF.Net email is sponsored by: IBM Linux Tutorials >Free Linux tutorial presented by Daniel Robbins, President and CEO of >GenToo technologies. Learn everything from fundamentals to system >administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click >_______________________________________________ >Matplotlibusers mailing list >Matplotlibusers@... >https://lists.sourceforge.net/lists/listinfo/matplotlibusers > > 
From: Greg Whittier <greg@th...>  20040407 11:42:26

I assume that's a typo and is supposed to be "f(x)=5 for [15,18]. Is this what you want? plot([0,5,5,15,15,18], [1,1,9, 9,5,5]) On Wed, 20040407 at 05:12, Vincent BOYER wrote: > Hi everybody. > > Related to this discussion, here is something else that could be very > useful for me : > > Let's say > > t =[0,5,15,18] > s = [1,9,5] > > I'd like to plot a curve f(x) using s and t in a way that : >  f(x)=1 for x in [0,5] >  f(x)=9 for x in [5,15] >  f(x)=51 for x in [5,18] > > Is there already a simple way to do that using Matplotlib, and if not, would it be possible to add it? > > Thanx > Vincent > > > > John Hunter wrote: > > >>>>>>"Peter" == Peter Groszkowski <pgroszko@...> writes: > >>>>>> > > > > Peter> Hi everyone: I was wondering whether it is possible to tell > > Peter> matplotlib how/when to connect data points. Consider this > > Peter> simple script: > > > > Peter> from matplotlib.matlab import * figure(1) t = > > Peter> [0,1,2,3,4,5,105,106,107] s = [1,4,5,3,9,11,5,8,3] > > Peter> plot(t, s, antialiased=False) grid(True) show() > > > > > > Peter> There are no data points between t=5 and t=105. By default > > Peter> the points (5,11) and (105,5) are connected, but I would > > Peter> like to tell matplotlib NOT to do so. In my case I would > > Peter> like to pass the plot function a variable telling it what > > Peter> to do. So for example would have: > > > > Peter> plot(t, s, max_delta=40) > > > > Peter> This would mean that the points are only to be connected if > > Peter> the difference between the adjacent t values is less than > > Peter> 40. In my case this is relevant because sometimes there > > Peter> are "holes" in my data, and connecting the points makes the > > Peter> plots look very messy. > > > > Peter> Would anyone find something like this useful? Would it be > > Peter> difficult to implement? > > > >Certainly not difficult, and probably useful enough to put in the > >standard distro. Eg, in a stock market trading example, you would > >have lots of quotes, minute by minute, punctuated by long intervals > >overnight where the market is closed. If you set maxdelta > >appropriately, you could draw connected lines only within trading > >days. > > > >Here is a sample implementation > > > >from matplotlib.matlab import * > >def segplot(x, y, fmt, maxdelta, **kwargs): > > """ > > Plot x versus y, breaking the plot at any point where x[i]  > > x[i1] > maxdelta. kwargs are passed on to plot > > """ > > x = asarray(x) > > y = asarray(y) > > d = diff(x) > > lines = [] > > ind = nonzero(greater(d, maxdelta)) > > ind = ind+1 > > if not len(ind): > > lines.extend( plot(x,y,fmt,**kwargs) ) > > else: > > allind = [0] > > allind.extend(ind) > > allind.append(len(x)) > > for i1,i2 in zip(allind[:1], allind[1:]): > > lines.extend( plot(x[i1:i2], y[i1:i2], fmt, **kwargs) ) > > return lines > > > >t = [0,1,2,3,4,5,105,106,107,187, 200, 212, 300, 320] > >s = [1,4,5,3,9,11,5,8,3,12, 15, 12, 1, 3] > >segplot(t, s, 'bo', 40, antialiased=False) > >grid(True) > >show() > > > >I'm inclined not to make this part of plot, since plot processes a > >variable number of arguments it makes it a little difficult. > >Certainly doable, but I'm hesitant to put too much on plot because it > >might become unwieldy. But a new function, like segment plot, would > >be easy enough to include. > > > >Any suggestions for a name, or additional functionality? > > > >JDH > > > > > > > >This SF.Net email is sponsored by: IBM Linux Tutorials > >Free Linux tutorial presented by Daniel Robbins, President and CEO of > >GenToo technologies. Learn everything from fundamentals to system > >administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > >_______________________________________________ > >Matplotlibusers mailing list > >Matplotlibusers@... > >https://lists.sourceforge.net/lists/listinfo/matplotlibusers > > > > > > > > >  > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers  Greg Whittier <greg@...> 