Re: [Matplotlib-users] ANN: matplotlib-0.90.1
John, John Hunter wrote: On 6/4/07, Werner F. Bruhin [EMAIL PROTECTED] wrote: John Hunter wrote: matplotlib 0.90.1 is out and available for download from the sourceforge site. Just installed it. Works very nicely with the exception of some font issue. I am getting this: Could not match Bitstream Vera Serif, New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif, normal, normal. Returning C:\Python25\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf make sure you are picking up the most recent matplotlibrc. We changed the font ordering some time ago. Then run with --verbose-helpful and post the output, maybe --verbose-debug, and we will see if we can figure out what is going on. I haven't run under windows for some time. Works the first time after I removed the cache file. Looking at the file it might have something to do with Unicode, i.e. one of the two / is encoded as 'u0005C', see attached file. Werner (dp1 S'cmsy10' p2 (dp3 S'normal' p4 (dp5 g4 (dp6 I400 (dp7 g4 (dp8 S'scalable' p9 S'C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\cmsy10.ttf' p10 ssS'Baveuse' p11 (dp12 g4 (dp13 g4 (dp14 I400 (dp15 g4 (dp16 g9 VC:\u005CWindows\u005CFonts\u005CBAVEUSE.TTF p17 ssS'Mangal' p18 (dp19 g4 (dp20 g4 (dp21 I400 (dp22 g4 (dp23 g9 VC:\u005CWindows\u005CFonts\u005Cmangal.ttf p24 ssS'Arial' p25 (dp26 S'italic' p27 (dp28 g4 (dp29 I400 (dp30 g4 (dp31 g9 VC:\u005CWindows\u005CFonts\u005Cariali.ttf p32 sssI700 (dp33 g4 (dp34 g9 VC:\u005CWindows\u005CFonts\u005Carialbi.ttf p35 sg4 (dp36 g4 (dp37 I400 (dp38 g4 (dp39 g9 VC:\u005CWindows\u005CFonts\u005Carial.ttf p40 sssI700 (dp41 g4 (dp42 g9 VC:\u005CWindows\u005CFonts\u005Carialbd.ttf p43 ssS'Neuropol' p44 (dp45 g4 (dp46 g4 (dp47 I400 (dp48 g4 (dp49 g9 VC:\u005CWindows\u005CFonts\u005CNEUROPOL.TTF p50 ssS'Catriel' p51 (dp52 g27 (dp53 g4 (dp54 I400 (dp55 g4 (dp56 g9 VC:\u005CWindows\u005CFonts\u005Ccatriel italic.ttf p57 sssI700 (dp58 g4 (dp59 g9 Vc:\u005Cwindows\u005Cfonts\u005Ccatriel bolditalic.ttf p60 sg4 (dp61 g4 (dp62 I400 (dp63 g4 (dp64 g9 Vc:\u005Cwindows\u005Cfonts\u005Ccatriel regular.ttf p65 sssI700 (dp66 g4 (dp67 g9 Vc:\u005Cwindows\u005Cfonts\u005Ccatriel bold.ttf p68 ssS'Arial Narrow' p69 (dp70 g27 (dp71 g4 (dp72 I400 (dp73 S'condensed' p74 (dp75 g9 Vc:\u005Cwindows\u005Cfonts\u005Carialni.ttf p76 sssI700 (dp77 g74 (dp78 g9 VC:\u005CWindows\u005CFonts\u005CArialNbi.TTF p79 sg4 (dp80 g4 (dp81 I400 (dp82 g74 (dp83 g9 Vc:\u005Cwindows\u005Cfonts\u005Carialn.ttf p84 sssI700 (dp85 g74 (dp86 g9 Vc:\u005Cwindows\u005Cfonts\u005Carialnb.ttf p87 ssS'Blue Highway' p88 (dp89 g4 (dp90 g4 (dp91 I400 (dp92 g4 (dp93 g9 VC:\u005CWindows\u005CFonts\u005CBLUEHIGH.TTF p94 sssI700 (dp95 g4 (dp96 g9 Vc:\u005Cwindows\u005Cfonts\u005Cbluebold.ttf p97 ssS'Gisha' p98 (dp99 g4 (dp100 g4 (dp101 I400 (dp102 g4 (dp103 g9 Vc:\u005Cwindows\u005Cfonts\u005Cgisha.ttf p104 sssI700 (dp105 g4 (dp106 g9 Vc:\u005Cwindows\u005Cfonts\u005Cgishabd.ttf p107 ssS'Eurostile' p108 (dp109 g4 (dp110 g4 (dp111 I400 (dp112 g4 (dp113 g9 Vc:\u005Cwindows\u005Cfonts\u005Ceurosti.ttf p114 sssI700 (dp115 g4 (dp116 g9 Vc:\u005Cwindows\u005Cfonts\u005Ceurostib.ttf p117 ssS'Franklin Gothic Demi Cond' p118 (dp119 g4 (dp120 g4 (dp121 I600 (dp122 g74 (dp123 g9 Vc:\u005Cwindows\u005Cfonts\u005Cfradmcn.ttf p124 ssS'Eras Demi ITC' p125 (dp126 g4 (dp127 g4 (dp128 I600 (dp129 g4 (dp130 g9 Vc:\u005Cwindows\u005Cfonts\u005Cerasdemi.ttf p131 ssS'MV Boli' p132 (dp133 g4 (dp134 g4 (dp135 I400 (dp136 g4 (dp137 g9 Vc:\u005Cwindows\u005Cfonts\u005Cmvboli.ttf p138 ssS'Shruti' p139 (dp140 g4 (dp141 g4 (dp142 I400 (dp143 g4 (dp144 g9 Vc:\u005Cwindows\u005Cfonts\u005Cshruti.ttf p145 ssS'Amienne' p146 (dp147 g4 (dp148 g4 (dp149 I400 (dp150 g4 (dp151 g9 Vc:\u005Cwindows\u005Cfonts\u005Camienne_.ttf p152 sssI700 (dp153 g4 (dp154 g9 Vc:\u005Cwindows\u005Cfonts\u005Camienneb.ttf p155 ssS'Times New Roman' p156 (dp157 g27 (dp158 g4 (dp159 I500 (dp160 g4 (dp161 g9 Vc:\u005Cwindows\u005Cfonts\u005Ctimesi.ttf p162 sssI700 (dp163 g4 (dp164 g9 Vc:\u005Cwindows\u005Cfonts\u005Ctimesbi.ttf p165 sg4 (dp166 g4 (dp167 I500 (dp168 g4 (dp169 g9 VC:\u005CWindows\u005CFonts\u005Ctimes.ttf p170 sssI700 (dp171 g4 (dp172 g9 Vc:\u005Cwindows\u005Cfonts\u005Ctimesbd.ttf p173 ssS'Earwig Factory' p174 (dp175 g4 (dp176 g4 (dp177 I400 (dp178 g4 (dp179 g9 VC:\u005CWindows\u005CFonts\u005CEARWIGFA.TTF p180 ssS'Rockwell Extra Bold' p181 (dp182 g4 (dp183 g4 (dp184 I700 (dp185 g4 (dp186 g9 Vc:\u005Cwindows\u005Cfonts\u005Crockeb.ttf p187 ssS'Gautami' p188 (dp189 g4 (dp190 g4 (dp191 I400 (dp192 g4 (dp193 g9 Vc:\u005Cwindows\u005Cfonts\u005Cgautami.ttf p194 ssS'Ligurino Condensed' p195 (dp196 g4 (dp197 g4 (dp198 I400 (dp199 g74 (dp200 g9 VC:\u005CWindows\u005CFonts\u005Cligurino condensed.ttf p201 ssS'Ligurino' p202 (dp203 g27 (dp204 g4
Re: [Matplotlib-users] ANN: matplotlib-0.90.1
John Hunter wrote: matplotlib 0.90.1 is out and available for download from the sourceforge site. When trying to package my application with py2exe I get the following error: Traceback (most recent call last): File setup.py, line 141, in module mpdir, mpfiles = matplotlib.get_py2exe_datafiles() File C:\Python25\Lib\site-packages\matplotlib\__init__.py, line 369, in get_py2exe_datafiles mplfiles.remove(os.sep.join([get_data_path(), 'Matplotlib.nib'])) ValueError: list.remove(x): x not in list Werner - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Prompt in MPL
I think a prompt could be very useful in MPL, just to build small little GUI's that only need 1 or 2 boxes. I also realize it is not easy, and for bigger jobs you want a full GUI environment like wx or Tk anyway, so I understand it when developers set other priorities. Then again, I would really use it, Mark From: Matthias Michler [EMAIL PROTECTED] Hello everybody, Now my question is: Could a prompt be a useful part of matplotlib? - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Prompt in MPL
On 6/5/07, Mark Bakker [EMAIL PROTECTED] wrote: I think a prompt could be very useful in MPL, just to build small little GUI's that only need 1 or 2 boxes. I also realize it is not easy, and for bigger jobs you want a full GUI environment like wx or Tk anyway, so I understand it when developers set other priorities. Then again, I would really use it, Mark From: Matthias Michler [EMAIL PROTECTED] Hello everybody, Now my question is: Could a prompt be a useful part of matplotlib? I worked on this some time ago, I never got to the point where I thought it was ready for production but it is close. There is a problem if usetex is enabled, because partial tex strings will cause errors. But you can use it with regular text or plain text. Give it a whirl -- I don't mind including tit in matplotlib.widgets if people think it would be usefult. I do think there is a niche for these kinds of things where people want brain dead simple widgets w/o having to deal with GUI toolkits. I'm pasting the example below, and also attaching it in case the lines get wrapped # usetex not supported import matplotlib matplotlib.rcParams['text.usetex'] = False import matplotlib.transforms as transforms import matplotlib.widgets as widgets from pylab import figure, show, nx class TextBox(widgets.Widget): def __init__(self, ax, s=''): self.canvas = ax.figure.canvas self.text = ax.text(0.025, 0.2, s, fontsize=14, #verticalalignment='baseline', horizontalalignment='left', transform=ax.transAxes) self.ax = ax ax.set_yticks([]) ax.set_xticks([]) ax.set_navigate(False) self.canvas.draw() self.canvas.mpl_connect('key_press_event', self.keypress) self.region = self.canvas.copy_from_bbox(ax.bbox) r = self._get_text_right() self.cursor, = ax.plot([r,r], [0.2, 0.8], transform=ax.transAxes) self.redraw() def redraw(self): self.ax.redraw_in_frame() self.canvas.blit(self.ax.bbox) def keypress(self, event): if event.key is not None and len(event.key)1: return t = self.text.get_text() if event.key is None: # simulate backspace if len(t): newt = t[:-1] else: newt = '' else: newt = t + event.key self.text.set_text(newt) r = self._get_text_right() self.cursor.set_xdata([r,r]) self.redraw() def _get_text_right(self): l,b,w,h = self.text.get_window_extent().get_bounds() r = l+w+2 t = b+h s = self.text.get_text() # adjust cursor position for trailing space numtrail = len(s) - len(s.rstrip()) en = self.ax.get_renderer_cache().points_to_pixels(self.text.get_fontsize())/2. r += numtrail*en l,b = self.ax.transAxes.inverse_xy_tup((l,b)) r,t = self.ax.transAxes.inverse_xy_tup((r,t)) return r fig = figure() ax = fig.add_axes([0.1, 0.1, 0.8, 0.7]) ax.plot([1,2,3]) #rc('text', usetex=1) fig.text(0.39, 0.875, 'My label: ', horizontalalignment='right', verticalalignment='center') axtext = fig.add_axes([0.4, 0.85, 0.5, 0.05]) box = TextBox(axtext) show() # usetex not supported import matplotlib matplotlib.rcParams['text.usetex'] = False import matplotlib.transforms as transforms import matplotlib.widgets as widgets from pylab import figure, show, nx class TextBox(widgets.Widget): def __init__(self, ax, s=''): self.canvas = ax.figure.canvas self.text = ax.text(0.025, 0.2, s, fontsize=14, #verticalalignment='baseline', horizontalalignment='left', transform=ax.transAxes) self.ax = ax ax.set_yticks([]) ax.set_xticks([]) ax.set_navigate(False) self.canvas.draw() self.canvas.mpl_connect('key_press_event', self.keypress) self.region = self.canvas.copy_from_bbox(ax.bbox) r = self._get_text_right() self.cursor, = ax.plot([r,r], [0.2, 0.8], transform=ax.transAxes) self.redraw() def redraw(self): self.ax.redraw_in_frame() self.canvas.blit(self.ax.bbox) def keypress(self, event): if event.key is not None and len(event.key)1: return t = self.text.get_text() if event.key is None: # simulate backspace if len(t): newt = t[:-1] else: newt = '' else: newt = t + event.key self.text.set_text(newt) r = self._get_text_right() self.cursor.set_xdata([r,r]) self.redraw() def _get_text_right(self): l,b,w,h = self.text.get_window_extent().get_bounds() r = l+w+2 t = b+h s = self.text.get_text() # adjust
Re: [Matplotlib-users] ANN: matplotlib-0.90.1
Dear Werner, This seems to be an unintended side-effect of reorganizing the mpl data file location that I did prior to this release. (I.e. it's not your code that broke, I think it's mpl.) Unfortunately, since I didn't (and still don't) use py2exe, it will be hard for me to fix this. Can you send a patch that gets py2exe working again? Thanks, Andrew Werner F. Bruhin wrote: Werner F. Bruhin wrote: John Hunter wrote: matplotlib 0.90.1 is out and available for download from the sourceforge site. When trying to package my application with py2exe I get the following error: Traceback (most recent call last): File setup.py, line 141, in module mpdir, mpfiles = matplotlib.get_py2exe_datafiles() File C:\Python25\Lib\site-packages\matplotlib\__init__.py, line 369, in get_py2exe_datafiles mplfiles.remove(os.sep.join([get_data_path(), 'Matplotlib.nib'])) ValueError: list.remove(x): x not in list To work around this I just put a try/except in: try: # Need to explicitly remove cocoa_agg files or py2exe complains mplfiles.remove(os.sep.join([get_data_path(), 'Matplotlib.nib'])) except: pass But I then get this error: error: can't copy 'C:\Python25\lib\site-packages\matplotlib\mpl-data\fonts': doesn't exist or not a regular file I guess I will have to review how I am using the get_py2exe_datafiles stuff. Werner - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Prompt in MPL
I notice the alignment problem. But it looks like you are close. On my machine (win32), the 'enter' key didn't work either. It works like a backspace. That sounds like what Matthias reported. Mark On 6/5/07, John Hunter [EMAIL PROTECTED] wrote: On 6/5/07, John Hunter [EMAIL PROTECTED] wrote: I worked on this some time ago, I never got to the point where I thought it was ready for production but it is close. There is a problem if usetex is enabled, because partial tex strings will cause errors. But you can use it with regular text or plain text. Typo: plain text was meant to be math text Now I remember what really bothered me about this widget, and it wasn't just the usetex problem. The problem is that mpl has three different vertical alignment methods for text: top, bottom and center. None of them are right for a text box: you want baseline. Try typing thinking into the text box and watch what happens when you add and remove the g. We do need to support baseline alignment for text, so if someone has an interest in adding this it would be a very useful feature, not just for a text box for for text alignment (eg tick labels) in general. See the image of the g at http://freetype.sourceforge.net/freetype2/docs/glyphs/glyphs-3.html for a visual representation -- hwat I am calling the baseline they refer to as the origin in that graph. Our default alignment should be origin or baseline but we don't have support for that. JDH - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Prompt in MPL - NEVER MIND
I just saw in the code: if event.key is None: # simulate backspace So it works properly, Mark On 6/5/07, Mark Bakker [EMAIL PROTECTED] wrote: I notice the alignment problem. But it looks like you are close. On my machine (win32), the 'enter' key didn't work either. It works like a backspace. That sounds like what Matthias reported. Mark On 6/5/07, John Hunter [EMAIL PROTECTED] wrote: On 6/5/07, John Hunter [EMAIL PROTECTED] wrote: I worked on this some time ago, I never got to the point where I thought it was ready for production but it is close. There is a problem if usetex is enabled, because partial tex strings will cause errors. But you can use it with regular text or plain text. Typo: plain text was meant to be math text Now I remember what really bothered me about this widget, and it wasn't just the usetex problem. The problem is that mpl has three different vertical alignment methods for text: top, bottom and center. None of them are right for a text box: you want baseline. Try typing thinking into the text box and watch what happens when you add and remove the g. We do need to support baseline alignment for text, so if someone has an interest in adding this it would be a very useful feature, not just for a text box for for text alignment (eg tick labels) in general. See the image of the g at http://freetype.sourceforge.net/freetype2/docs/glyphs/glyphs-3.html for a visual representation -- hwat I am calling the baseline they refer to as the origin in that graph. Our default alignment should be origin or baseline but we don't have support for that. JDH - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Chart plotting blank?
Hi, I'm trying to plot a barchart for use in a django site. It's creating a blank chart image though.(attached). What am I doing wrong? from pylab import * def chart(request): from PIL import Image as PILImage from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from matplotlib.figure import Figure from StringIO import StringIO fig = Figure(figsize=(6,4)) canvas = FigureCanvas(fig) ax = fig.add_subplot(111) #from pylab import * N = 7 menMeans = (20, 35, 30, 35, 27, 21, 60) ind = arange(N) # the x locations for the groups #print ind width = 0.35 # the width of the bars ax = bar(ind, menMeans, width, color='b') #ylabel('Time') title('Time In Minutes - Last 7 Days') xticks(ind+width, ('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', '*') ) fig.set_facecolor('w') canvas.draw() size = canvas.get_renderer().get_canvas_width_height() buf=canvas.tostring_rgb() im=PILImage.fromstring('RGB', size, buf, 'raw', 'RGB', 0, 1) imdata=StringIO() im.save(imdata, format='PNG') response = HttpResponse(imdata.getvalue(), mimetype='image/png') return response Thanks! Erik attachment: chart.png- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] resizing of markers when a plot is resized ?
Hi folks, I have a marker on a plot that is 5 units long, if I resize the figure, the markers don't get resized appropriately. How do I address this? code snippet to display markers: self.axes.annotate(text, xy=(0.5, 0.5), markerprops=dict(marker=TICKRIGHT, markerfacecolor='black', markersize=5, markeredgecolor='black', markeredgewidth = 2),) -iyer Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. http://smallbusiness.yahoo.com/webhosting - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users