Re: [Matplotlib-users] Artifacts when saving as PDF
Thomas, Thanks for the smaller example. I would have come up with one, but I wasn't sure what was causing it to begin with. Is there anything to be done to prevent this? Just use another backend? Steven On 4/6/15 8:47 PM, Thomas Caswell wrote: This is probaly due to issues with not all of the vector backends supporting alpha gracefully. This can be reproduced more simply by x, y = np.ogrid[-5:5:.1, -5:5:.1] dd = np.exp(-(x**2 + y**2)) dd[dd .1] = np.nan fig, ax = plt.subplots() ax.imshow(dd, interpolation='none', cmap='gray_r') plt.savefig('test.pdf') @steven In the future it is best to report bugs with minimal copy-paste able examples. On Mon, Apr 6, 2015 at 5:41 PM Steven Boada bo...@physics.tamu.edu mailto:bo...@physics.tamu.edu wrote: Getting some strange artifacts when I save a figure as a PDF in matplotlib. Here are some screen shots. PDF http://imgur.com/oQDXkWn and PNG http://imgur.com/bCw3Fn4. Any idea why that is happening? Here is (most of) the source code that makes the plot. I stripped out the data generation, because it is long and involved, and doesn't really matter. Basically what the script is supposed to do is make a scatter plot where the density is below some threshold, and a 2d histogram when it is above that threshold. The code seems to work fine, but when I save the figure (using savefig in Ipython) it shows up funny. Thanks. import pylab as pyl bins = [50,50] thresh = 3 xdat = #generate or load some data ydat = #generate or load some data hh, locx, locy = pyl.histogram2d(xdat, ydat, range=[[-1,4],[-26,-10]], bins=bins) posx = pyl.digitize(xdat, locx) posy = pyl.digitize(ydat, locy) # finds the bins which contain points. posx = 0 for points outside range ind = (posx 0) (posx = bins[0]) (posy 0) (posy = bins[1]) # values of histogram with points in the bins. hhsub = hh[posx[ind] - 1, posy[ind] - 1] xdat1 = xdat[ind][hhsub thresh] # low density points ydat1 = ydat[ind][hhsub thresh] hh[hh thresh] = pyl.nan # fill the areas with low density by NaNs pyl.scatter(xdat1, ydat1, s=20, c='0.8') pyl.imshow(pyl.log10(hh.T), cmap='gray_r', extent=pyl.array([[-1,4],[-26,-10]]).flatten(), interpolation='none') pyl.show() -- Steven Boada Doctoral Student Dept of Physics and Astronomy Texas AM University bo...@physics.tamu.edu mailto:bo...@physics.tamu.edu -- BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15utm_medium=emailutm_campaign=VA_SF___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Steven Boada Doctoral Student Dept of Physics and Astronomy Texas AM University bo...@physics.tamu.edu -- BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15utm_medium=emailutm_campaign=VA_SF ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Artifacts when saving as PDF
Hi Tom, Thanks for your help. interpolation='nearest' doesn't produce any problems. I'm currently using TkAgg, and I checked with a buddy of mine, using MacOSX backend. Neither of us see any problems using interpolation='nearest'. He is using an older version of MPL which doesn't let him use interpolation='none'. I will ask around to see if anyone can run a few more test cases. Steven On 4/7/15 10:39 AM, Thomas Caswell wrote: This probably should be made into an issue on github as this is clearly a bug. On further consideration, the fact that in my example the bad pixels show up only on the edge and are not symmetric makes me think that my original suggestion is wrong. Does `interpoltation='nearest'` work any better? I also am not sure that the rasterzation is happening so this may be an issue on the renderer end. This needs more investigation that I have time for today. Tom On Tue, Apr 7, 2015 at 11:02 AM Steven Boada bo...@physics.tamu.edu mailto:bo...@physics.tamu.edu wrote: Thomas, Thanks for the smaller example. I would have come up with one, but I wasn't sure what was causing it to begin with. Is there anything to be done to prevent this? Just use another backend? Steven On 4/6/15 8:47 PM, Thomas Caswell wrote: This is probaly due to issues with not all of the vector backends supporting alpha gracefully. This can be reproduced more simply by x, y = np.ogrid[-5:5:.1, -5:5:.1] dd = np.exp(-(x**2 + y**2)) dd[dd .1] = np.nan fig, ax = plt.subplots() ax.imshow(dd, interpolation='none', cmap='gray_r') plt.savefig('test.pdf') @steven In the future it is best to report bugs with minimal copy-paste able examples. On Mon, Apr 6, 2015 at 5:41 PM Steven Boada bo...@physics.tamu.edu mailto:bo...@physics.tamu.edu mailto:bo...@physics.tamu.edu mailto:bo...@physics.tamu.edu wrote: Getting some strange artifacts when I save a figure as a PDF in matplotlib. Here are some screen shots. PDF http://imgur.com/oQDXkWn and PNG http://imgur.com/bCw3Fn4. Any idea why that is happening? Here is (most of) the source code that makes the plot. I stripped out the data generation, because it is long and involved, and doesn't really matter. Basically what the script is supposed to do is make a scatter plot where the density is below some threshold, and a 2d histogram when it is above that threshold. The code seems to work fine, but when I save the figure (using savefig in Ipython) it shows up funny. Thanks. import pylab as pyl bins = [50,50] thresh = 3 xdat = #generate or load some data ydat = #generate or load some data hh, locx, locy = pyl.histogram2d(xdat, ydat, range=[[-1,4],[-26,-10]], bins=bins) posx = pyl.digitize(xdat, locx) posy = pyl.digitize(ydat, locy) # finds the bins which contain points. posx = 0 for points outside range ind = (posx 0) (posx = bins[0]) (posy 0) (posy = bins[1]) # values of histogram with points in the bins. hhsub = hh[posx[ind] - 1, posy[ind] - 1] xdat1 = xdat[ind][hhsub thresh] # low density points ydat1 = ydat[ind][hhsub thresh] hh[hh thresh] = pyl.nan # fill the areas with low density by NaNs pyl.scatter(xdat1, ydat1, s=20, c='0.8') pyl.imshow(pyl.log10(hh.T), cmap='gray_r', extent=pyl.array([[-1,4],[-26,-10]]).flatten(), interpolation='none') pyl.show() -- Steven Boada Doctoral Student Dept of Physics and Astronomy Texas AM University bo...@physics.tamu.edu mailto:bo...@physics.tamu.edu mailto:bo...@physics.tamu.edu mailto:bo...@physics.tamu.edu -- BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15utm_medium=emailutm_campaign=VA_SF___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net
[Matplotlib-users] Artifacts when saving as PDF
Getting some strange artifacts when I save a figure as a PDF in matplotlib. Here are some screen shots. PDF http://imgur.com/oQDXkWn and PNG http://imgur.com/bCw3Fn4. Any idea why that is happening? Here is (most of) the source code that makes the plot. I stripped out the data generation, because it is long and involved, and doesn't really matter. Basically what the script is supposed to do is make a scatter plot where the density is below some threshold, and a 2d histogram when it is above that threshold. The code seems to work fine, but when I save the figure (using savefig in Ipython) it shows up funny. Thanks. import pylab as pyl bins = [50,50] thresh = 3 xdat = #generate or load some data ydat = #generate or load some data hh, locx, locy = pyl.histogram2d(xdat, ydat, range=[[-1,4],[-26,-10]], bins=bins) posx = pyl.digitize(xdat, locx) posy = pyl.digitize(ydat, locy) # finds the bins which contain points. posx = 0 for points outside range ind = (posx 0) (posx = bins[0]) (posy 0) (posy = bins[1]) # values of histogram with points in the bins. hhsub = hh[posx[ind] - 1, posy[ind] - 1] xdat1 = xdat[ind][hhsub thresh] # low density points ydat1 = ydat[ind][hhsub thresh] hh[hh thresh] = pyl.nan # fill the areas with low density by NaNs pyl.scatter(xdat1, ydat1, s=20, c='0.8') pyl.imshow(pyl.log10(hh.T), cmap='gray_r', extent=pyl.array([[-1,4],[-26,-10]]).flatten(), interpolation='none') pyl.show() -- Steven Boada Doctoral Student Dept of Physics and Astronomy Texas AM University bo...@physics.tamu.edu -- BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15utm_medium=emailutm_campaign=VA_SF___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] verts
Hey List, I've got some verts I stole from the internet that draws an upward arrow (or a down arrow), but I need to draw an arrow to the right or to the left. But I don't really understand verts and how they work. arrowup_verts = [[0.,0.], [-1., -1], [0.,0.], [0.,-2.],[0.,0.], [1,-1]] arrowdown_verts = [[0.,0.], [-1., 1], [0.,0.], [0.,2.],[0.,0.], [1, 1]] plot them like... scatter(1,1,s=100, marker=None, verts=arrowup_verts) Can someone make me new verts for the right and left arrow? Then, maybe tomorrow, explain how I was supposed to know what to do. Thanks y'all Steven -- Steven Boada Doctoral Student Dept of Physics and Astronomy Texas AM University bo...@physics.tamu.edu -- Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] verts
Thanks Zach, That simple little example makes more sense than the manual page did. Perhaps it's just late. I appreciate it. Steven On Mon Apr 8 22:30:43 2013, Zachary Pincus wrote: I've got some verts I stole from the internet that draws an upward arrow (or a down arrow), but I need to draw an arrow to the right or to the left. But I don't really understand verts and how they work. arrowup_verts = [[0.,0.], [-1., -1], [0.,0.], [0.,-2.],[0.,0.], [1,-1]] arrowdown_verts = [[0.,0.], [-1., 1], [0.,0.], [0.,2.],[0.,0.], [1, 1]] plot them like... scatter(1,1,s=100, marker=None, verts=arrowup_verts) Can someone make me new verts for the right and left arrow? Then, maybe tomorrow, explain how I was supposed to know what to do. Draw a line from (0,0) to (-1, -1) on the X-Y plane, and then to (0,0) again, and then continue so forth for all the (x,y) pairs in arrowup_verts. You will notice they form a nice little arrow pointing up. (At some point in this process, you should note that verts is short for vertices. As in vertices of a polygon or poly-line.) It would seem that the origin of the verts coordinate system is translated to the (x,y) data position at which each marker is plotted. This should give you, I presume, sufficient information to figure out your own left and right arrows, no? Or any other shape you should care to plot... Zach Thanks y'all Steven -- Steven Boada Doctoral Student Dept of Physics and Astronomy Texas AM University bo...@physics.tamu.edu -- Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Steven Boada Doctoral Student Dept of Physics and Astronomy Texas AM University bo...@physics.tamu.edu -- Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting from datafile
Another, slightly more flexible, option is the genfromtxt function, also in numpy. Normally you should try genfromtxt after loadtxt doesn't work. Or, that is my normal method. Steven On Wed Mar 27 07:16:45 2013, Sayan Chatterjee wrote: Thank you very much for your prompt reply. Florian, your reply seems to be the answer to my question. I'll try it out. If can't figure out,I'll get back to you. On 27 March 2013 15:37, Florian M. Wagner wagne...@student.ethz.ch mailto:wagne...@student.ethz.ch wrote: Hey Sayan, for reading in simple ASCII-Files containing your two arrays you should have a look at the numpy.loadtxt function. Scatter plots in matplotlib are then easily created as shown here http://matplotlib.org/examples/pylab_examples/scatter_demo.html For your purpose you can do something like: import os import numpy as np import matplotlib.pyplot as plt for file in os.path.listdir(): x, y = np.loadtxt(file, unpack=True) plt.scatter(x,y) plt.savefig(file + '.png') Cheers, Florian Am 27.03.2013 09:32, schrieb Sayan Chatterjee: Dear All, I'm new to Matplotlib. It might be a silly question, how does one plot data(not functions) in Matplotlib. How: 1)Two arrays (X and Y) can be plotted in a scatter diagram? 2) or a number of data files can used to produce different plots having different(sequential) name? Thanks in anticipation. Regards, Sayan -- -- *Sayan Chatterjee* Dept. of Physics and Meteorology IIT Kharagpur Lal Bahadur Shastry Hall of Residence Room AB 205 Mob: +91 9874513565 blog: www.blissprofound.blogspot.com http://www.blissprofound.blogspot.com Volunteer , Padakshep www.padakshep.org http://www.padakshep.org -- Own the Future-Intelreg; Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13.http://p.sf.net/sfu/intel_levelupd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Own the Future-Intelreg; Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- -- *Sayan Chatterjee* Dept. of Physics and Meteorology IIT Kharagpur Lal Bahadur Shastry Hall of Residence Room AB 205 Mob: +91 9874513565 blog: www.blissprofound.blogspot.com http://www.blissprofound.blogspot.com Volunteer , Padakshep www.padakshep.org http://www.padakshep.org -- Own the Future-Intelreg; Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Steven Boada Doctoral Student Dept of Physics and Astronomy Texas AM University bo...@physics.tamu.edu -- Own the Future-Intelreg; Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Squashed axes with AxesGrid
Sorry y'all. I can see the confusion. I started with AxesGrid -- squashed. JJ suggested Grid and that fixes the scaling problems. I realized that using just plain Grid doesn't give me the nice controls over the colorbars (which I would like to have), so I wrote a simple script and emailed it back out. That did include AxesGrid. According to the manual ( http://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html#axes-grid1 )... aspect By default (False), widths and heights of axes in the grid are scaled independently. If True, they are scaled according to their data limits (similar to aspect parameter in mpl). Which I read as it should scale the widths and heights should not be squashed. But what Ben is telling me (thanks for the explanation) is that isn't true. Seems like there is something simple I am just missing. Sorry for that bit of confusion. Steven On Fri Mar 22 11:39:46 2013, Benjamin Root wrote: On Fri, Mar 22, 2013 at 12:30 PM, Steven Boada bo...@physics.tamu.edu mailto:bo...@physics.tamu.edu wrote: Well... I jumped the gun. To better illustrate the problem(s) I am having, I wrote a simple script that doesn't work... import pylab as pyl from mpl_toolkits.axes_grid1 import AxesGrid # make some data xdata = pyl.random(100) * 25. ydata = pyl.random(100) * 8. colordata = pyl.random(100) * 3. # make us a figure F = pyl.figure(1,figsize=(5.5,3.5)__) grid = AxesGrid(F, 111, nrows_ncols=(1,2), axes_pad = 0.1, add_all=True, share_all = True, cbar_mode = 'each', cbar_location = 'top') # Plot! sc1 = grid[0].scatter(xdata, ydata, c=colordata, s=50, cmap='spectral') sc2 = grid[1].scatter(xdata, ydata, c=colordata, s=50, cmap='spectral') # Add colorbars grid.cbar_axes[0].colorbar(__sc1) grid.cbar_axes[1].colorbar(__sc2) grid[0].set_xlim(0,25) grid[0].set_ylim(0,8) pyl.show() And you get some squashed figures... I'll attach a png. Thanks again. Steven You used AxesGrid again, not Grid. AxesGrid implicitly applies an aspect='equal' to the subplots. This means that a unit of distance on the x-axis takes the same amount of space as the same unit of distance on the y-axis. In your example, the x axis goes from 0 to 25, while the y-axis goes from 0 to 8. When aspect='equal', the y-axis will then be about a third the size of the x-axis, because the y-limits are about a third the size of the x-limits. Ben Root -- Steven Boada Doctoral Student Dept of Physics and Astronomy Texas AM University bo...@physics.tamu.edu -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Squashed axes with AxesGrid
Hey Jody et al. Yeah aspect = False does the trick. Thanks for the help trouble shooting. Steven On Fri Mar 22 11:59:45 2013, Jody Klymak wrote: ...and did aspect=False not give you what you want? From what I can see http://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html#axes-grid1 contradicts itself, and the chart is correct and the description below incorrect. FWIW, I would expect the default to be False as well, but who am I to say? Cheers, Jody On Mar 22, 2013, at 9:52 AM, Steven Boada bo...@physics.tamu.edu wrote: Sorry y'all. I can see the confusion. I started with AxesGrid -- squashed. JJ suggested Grid and that fixes the scaling problems. I realized that using just plain Grid doesn't give me the nice controls over the colorbars (which I would like to have), so I wrote a simple script and emailed it back out. That did include AxesGrid. According to the manual ( http://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html#axes-grid1 )... aspect By default (False), widths and heights of axes in the grid are scaled independently. If True, they are scaled according to their data limits (similar to aspect parameter in mpl). Which I read as it should scale the widths and heights should not be squashed. But what Ben is telling me (thanks for the explanation) is that isn't true. Seems like there is something simple I am just missing. Sorry for that bit of confusion. Steven On Fri Mar 22 11:39:46 2013, Benjamin Root wrote: On Fri, Mar 22, 2013 at 12:30 PM, Steven Boada bo...@physics.tamu.edu mailto:bo...@physics.tamu.edu wrote: Well... I jumped the gun. To better illustrate the problem(s) I am having, I wrote a simple script that doesn't work... import pylab as pyl from mpl_toolkits.axes_grid1 import AxesGrid # make some data xdata = pyl.random(100) * 25. ydata = pyl.random(100) * 8. colordata = pyl.random(100) * 3. # make us a figure F = pyl.figure(1,figsize=(5.5,3.5)__) grid = AxesGrid(F, 111, nrows_ncols=(1,2), axes_pad = 0.1, add_all=True, share_all = True, cbar_mode = 'each', cbar_location = 'top') # Plot! sc1 = grid[0].scatter(xdata, ydata, c=colordata, s=50, cmap='spectral') sc2 = grid[1].scatter(xdata, ydata, c=colordata, s=50, cmap='spectral') # Add colorbars grid.cbar_axes[0].colorbar(__sc1) grid.cbar_axes[1].colorbar(__sc2) grid[0].set_xlim(0,25) grid[0].set_ylim(0,8) pyl.show() And you get some squashed figures... I'll attach a png. Thanks again. Steven You used AxesGrid again, not Grid. AxesGrid implicitly applies an aspect='equal' to the subplots. This means that a unit of distance on the x-axis takes the same amount of space as the same unit of distance on the y-axis. In your example, the x axis goes from 0 to 25, while the y-axis goes from 0 to 8. When aspect='equal', the y-axis will then be about a third the size of the x-axis, because the y-limits are about a third the size of the x-limits. Ben Root -- Steven Boada Doctoral Student Dept of Physics and Astronomy Texas AM University bo...@physics.tamu.edu -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Jody Klymak http://web.uvic.ca/~jklymak/ -- Steven Boada Doctoral Student Dept of Physics and Astronomy Texas AM University bo...@physics.tamu.edu -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] How to start when you don't know what to do
Heyya list. I must admit that my matplotlib-foo is only so so. One of the biggest problems that I face is seeing cool stuff around the net, and thinking, that's pretty neat, I'd like to copy it. In reality, I have no idea how I would go about creating something like that. Here's an example: http://imgur.com/JdkR4 Just a little circular histogram thing with some annotations. Obviously, I'd need the annotate command for the words, but what about the arcs? No idea, off hand. So my question is, how do you decode (read: what to think about) figures that you see, and turn them into actual python? Sure I could post on stack exchange or email all you people every time, but I want to be *better* at this. And while some people are going to scoff and reply that's easy, silly it's not so for some. I just hate to admit it's me. Thanks for the advice. -- Steven Boada Doctoral Student Dept of Physics and Astronomy Texas AM University bo...@physics.tamu.edu -- Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS and more. Get SQL Server skills now (including 2012) with LearnDevNow - 200+ hours of step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only - learn more at: http://p.sf.net/sfu/learnmore_122512 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to provide colorbars for scatterplots created this way?
I normally just plot a whole bunch of arrays... and then add the color bar sc1 = f1s1.scatter(array[:,0], array[:,1], c=array[:,2], s=50, cmap='spectral',edgecolor='w') bar = pyl.colorbar(sc1) bar.set_label(label) Steven On 12/20/12 5:54 PM, Paul Hobson wrote: On Thu, Dec 20, 2012 at 1:05 PM, Kynn Jones kyn...@gmail.com mailto:kyn...@gmail.com wrote: I create PNG files of scatterplots with code that, in essence, goes as in the sketch below: cmap = (matplotlib.color.LinearSegmentedColormap. from_list('blueWhiteRed', ['blue', 'white', 'red'])) fig = matplotlib.figure.Figure(figsize=(4, 4), dpi=72) ax = fig.gca() for marker in 'o s ^ *'.split(): X, Y, COLOR = zip(*((record.x, record.y, record.level) for record in data if record.marker == marker)) ax.scatter(X, Y, marker=marker, c=COLOR, vmin=0, vmax=1, cmap=cmap, **otherkwargs) # various settings of ticks, labels, etc. omitted canvas = matplotlib.backends.backend_agg.FigureCanvasAgg(fig) fig.set_canvas(canvas) # IMPORTANT: the generated figure is *not* displayed on the screen, but # rather it is output to disk as a PNG file: canvas.print_png('/path/to/output/fig.png') My question is this: What do I need to add to the code above to get a vertical colorbar (representing the colormap incmap) along the plot's right edge? I word the question in this way because I am not sufficiently facile with Matplotlib to deviate too far from the working code above. In particular, my code *has* to be able to produce PNG files *non-interactively*, so the last line in the code sketch above is really essential. Thanks in advance! kj Can you provide some more information and a self-contained example? What is your record object? Is it a pandas dataframe? Are the limits of record.level consistent with vmax and vmin kwargs fed in the call to ax.scatter? Typically you can just do: import matplotlib.pyplot as plt # blah blah fig, ax = plt.subplots() s = ax.scatter()... cb = plt.colorbar(s) cb.set_label('Cbar Label Here') Also, I don't think you need to mess with the backend stuff. Just do fig.savefig('figname.png'). If you need separate markers for each set, make a single call to scatter for each data group, and use numpy to figure out what the appropriate vmax a vmin limits are for the colorbar. -paul -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Steven Boada Doctoral Student Dept of Physics and Astronomy Texas AM University bo...@physics.tamu.edu -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] colorbars with multiple subplots
I echo using the AxesGrid object from the toolkits. Protip -- I have had trouble making it work with semilog plots. So if that is what you are doing, it might be worth trying another thing or two first. Steven On 12/13/12 9:56 AM, Benjamin Root wrote: On Thu, Dec 13, 2012 at 10:45 AM, Claus clausena...@gmail.com mailto:clausena...@gmail.com wrote: Hi, I am trying to plot a colorbar next to each subplot in a figure. In the following example, I create two figures. In the second figure, I try to add the colorbars. Is there a way to show the colorbar next to each subplot. The way I did it, all the colorbars appear next to the last subplot, take away space from it, and all are plotted using the jet colormap. Unfortunately, I am not sure how to do this better, and would appreciate hints. import numpy as np import matplotlib.pylab as plt def main(): # four subplots, no colorbar, so far so good f, axarr = plt.subplots(2, 2) axarr[0, 0].imshow(np.random.rand(5,5)*10) axarr[0, 1].imshow(np.random.rand(5,5)) axarr[1, 0].imshow(np.random.rand(5,5)*100) axarr[1, 1].imshow(np.random.rand(5,5)*1000) plt.show() # four subplots, four colorbars f, axarr = plt.subplots(2, 2) a = axarr[0, 0].imshow(np.random.rand(5,5)*10) cbar1 = f.colorbar(a, cmap='jet') b = axarr[0, 1].imshow(np.random.rand(5,5)) cbar2 = f.colorbar(b, cmap='Reds') c = axarr[1, 0].imshow(np.random.rand(5,5)*100) cbar2 = f.colorbar(c, cmap='Blues') d = axarr[1, 1].imshow(np.random.rand(5,5)*1000) cbar2 = f.colorbar(d, cmap='Greens') plt.show() if __name__ == '__main__': main() I think you are looking for the AxesGrid object from the mpl_toolkits.axes_grid1 module: http://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html#axes-grid1 Ben Root -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Steven Boada Doctoral Student Dept of Physics and Astronomy Texas AM University bo...@physics.tamu.edu -- LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Histogram with overlapping bins
Let's say I generate a bunch of random numbers from 0-1. Then, I'd like to make a histogram of it. But here's the clincher. I'd like my bins to overlap a bit. For example, if the first bin is from 0 - 0.1, centered on 0.05, I'd like the next (second) bin to be centered on 0.1 and range from 0.05 - 0.15. So basically, I want the width of each bin to be greater than the spacing. Is this something that could be done with the histogram function? I did a couple of google searches and couldn't come up with anything meaningful. Apparently, 'rwidth' in the hist function just makes the displayed bars bigger or smaller. Any thoughts? -- Steven Boada Doctoral Student Dept of Physics and Astronomy Texas AM University bo...@physics.tamu.edu -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Histogram with overlapping bins
It'd be cool if we could do something like bins = [(0.0,0.05,0.1),(0.05,0.1,0.15)...] Where I have specified the left edge, center and right edge of each bin. Yeah, that'd be pretty slick. S On Sat Oct 20 16:21:41 2012, Steven Boada wrote: Let's say I generate a bunch of random numbers from 0-1. Then, I'd like to make a histogram of it. But here's the clincher. I'd like my bins to overlap a bit. For example, if the first bin is from 0 - 0.1, centered on 0.05, I'd like the next (second) bin to be centered on 0.1 and range from 0.05 - 0.15. So basically, I want the width of each bin to be greater than the spacing. Is this something that could be done with the histogram function? I did a couple of google searches and couldn't come up with anything meaningful. Apparently, 'rwidth' in the hist function just makes the displayed bars bigger or smaller. Any thoughts? -- Steven Boada Doctoral Student Dept of Physics and Astronomy Texas AM University bo...@physics.tamu.edu -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib produced plots in academic journal articles
was going to do (was it Tony? I forget). I don't know. I think the idea is good, but I think there needs to be some thought and consensus regarding the *best* way to get people to *visually* judge matplotlib's capabilities in the academic realm. This is just my two. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Floris van Breugel PhD Candidate at Caltech Control and Dynamical Systems (925) 963 8280 Wildlife and Landscape Photographer Galleries: http://www.ArtInNaturePhotography.com/ Blog: http://www.ArtInNaturePhotography.com/wordpress/ -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Steven Boada Dept. Physics and Astronomy Texas AM University bo...@physics.tamu.edu -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib produced plots in academic journal articles
For example, in astronomy, a lot of people will 'publish' their paper to Arxiv before it is accepted into a journal. Arxiv is accessible by the general public and a little digging around will reveal that you can download the actual Latex source for the paper. This includes all of the figures. I have never heard of anyone getting sued by a journal for posting their stuff on the arxiv. Steven On Fri 05 Oct 2012 02:42:06 PM CDT, Nelle Varoquaux wrote: On 5 October 2012 21:23, Damon McDougall damon.mcdoug...@gmail.com mailto:damon.mcdoug...@gmail.com wrote: On Fri, Oct 5, 2012 at 8:11 PM, Gökhan Sever gokhanse...@gmail.com mailto:gokhanse...@gmail.com wrote: Seeing mpl produced plots would be only 1 or 2 clicks away, plus this would This is not true. A lot of articles are unavailable to certain institutions due to a lack of subscription. A major sticking point. Am I wrong in thinking that journals copyright the final product? Thus, it would be up to the author(s) to decide whether or not to 'donate' a figure for a gallery. I think it depends on the journal, and on the agreement. I think in most journals you/your institute can pay to have your paper publicly available. I wouldn't be shocked if a requirement to be in the gallery would be to donate a figure. provide context to the use of plots rather that extracting figures and putting them separately (dealing with copyright issues and such) on an alternative gallery page. The figures you linked look shinny but not much practical use in my field. I was just showing an example of a gallery of published figures. It is much easier to go through a gallery, to quickly see what a library is capable of, than clicking on links to articles, that may often be of closed access. Point taken on the context argument. I'll take that. To resolve it, make the figure/html image link to the underlying publication? -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Steven Boada Dept. Physics and Astronomy Texas AM University bo...@physics.tamu.edu -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Trouble with fonts
List, I am trying, with little success, to change the fonts on my plots. It seems like a simple thing to do, but I can't seem to make it work. First, here is the relevant section of my Matplotlibrc file: backend : GTKAgg font.family : sans-serif font.style : normal font.weight : medium font.sans-serif : Helvetica (I copied this from the Matplotlibrc documentation page) Now if I make a plot, and put some labels on there... (just using ipython) In [3]: figure() Out[3]: matplotlib.figure.Figure at 0x2acb950 In [4]: xlabel('Hz',fontsize=20) Out[4]: matplotlib.text.Text at 0x2ae3510 In [5]: /opt/python/lib/python2.7/site-packages/matplotlib/font_manager.py:1216: UserWarning: findfont: Font family ['sans-serif'] not found. Falling back to Bitstream Vera Sans (prop.get_family(), self.defaultFamily[fontext])) I get this over and over and over again. I have deleted everything in my ~/.matplotlib folder. That is, I have deleted all of the font caches... I can't come up with anything else. The internet seems to thing that just deleting the caches will fix everything. In my case it doesn't. I get this problem on both my mac, and my Ubuntu Linux 12.04 machine. Thanks! Steven -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Trouble with fonts
Hey Mike $ fc-match Helvetica n019003l.pfb: Nimbus Sans L Regular Perhaps I don't have the fonts installed... In my matplotlib/mpl-data/fonts/ I have the following fonts installed... in ttf/ cmb10.ttf RELEASENOTES.TXT STIXSizFourSymBol.ttf VeraIt.ttf cmex10.ttf STIXGeneralBolIta.ttf STIXSizFourSymReg.ttf VeraMoBd.ttf cmmi10.ttf STIXGeneralBol.ttf STIXSizOneSymBol.ttf VeraMoBI.ttf cmr10.ttf STIXGeneralItalic.ttf STIXSizOneSymReg.ttf VeraMoIt.ttf cmss10.ttf STIXGeneral.ttfSTIXSizThreeSymBol.ttf VeraMono.ttf cmsy10.ttf STIXNonUniBolIta.ttf STIXSizThreeSymReg.ttf VeraSeBd.ttf cmtt10.ttf STIXNonUniBol.ttf STIXSizTwoSymBol.ttf VeraSe.ttf COPYRIGHT.TXT STIXNonUniIta.ttf STIXSizTwoSymReg.ttf Vera.ttf LICENSE_STIX STIXNonUni.ttf VeraBd.ttf README.TXT STIXSizFiveSymReg.ttf VeraBI.ttf and in pdfcorefonts Courier.afm Helvetica-Bold.afm Times-Bold.afm Courier-Bold.afm Helvetica-BoldOblique.afm Times-BoldItalic.afm Courier-BoldOblique.afm Helvetica-Oblique.afm Times-Italic.afm Courier-Oblique.afm readme.txt Times-Roman.afm Helvetica.afmSymbol.afm ZapfDingbats.afm Which does include some Helvetica fonts. And the font that I am trying to use doesn't *have* to be helvetica. I just like that font, so I was playing with it. Steven On 9/25/12 10:41 AM, Michael Droettboom wrote: Do you have a font installed called Helvetica? That's pretty rare these days... most systems have one of the many Helvetica clones instead. Does fc-match Helvetica (at the commandline) return anything? Mike On 09/25/2012 10:05 AM, Steven Boada wrote: List, I am trying, with little success, to change the fonts on my plots. It seems like a simple thing to do, but I can't seem to make it work. First, here is the relevant section of my Matplotlibrc file: backend : GTKAgg font.family : sans-serif font.style : normal font.weight : medium font.sans-serif : Helvetica (I copied this from the Matplotlibrc documentation page) Now if I make a plot, and put some labels on there... (just using ipython) In [3]: figure() Out[3]: matplotlib.figure.Figure at 0x2acb950 In [4]: xlabel('Hz',fontsize=20) Out[4]: matplotlib.text.Text at 0x2ae3510 In [5]: /opt/python/lib/python2.7/site-packages/matplotlib/font_manager.py:1216: UserWarning: findfont: Font family ['sans-serif'] not found. Falling back to Bitstream Vera Sans (prop.get_family(), self.defaultFamily[fontext])) I get this over and over and over again. I have deleted everything in my ~/.matplotlib folder. That is, I have deleted all of the font caches... I can't come up with anything else. The internet seems to thing that just deleting the caches will fix everything. In my case it doesn't. I get this problem on both my mac, and my Ubuntu Linux 12.04 machine. Thanks! Steven -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Steven Boada Doctoral Student Dept of Physics and Astronomy Texas AM University bo...@physics.tamu.edu -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Trouble with fonts
I have fixed it. Or, I have a better handle on what the stupid thing is doing. LOL. The problem was a couple of things. 1. Michael was right. There was no file named Helvetica.ttf installed on my machine. 2. The path were I thought MPL was looking for files wasn't the right path. I thought it was looking in the mpl-data/fonts/ttf directory... Which it does. But it ALSO looks in system's font directories. So I was finding fonts that weren't in the mpl-data directory. This was very confusing. 3. I was generally angry at it. Now, if you want to change the font, just look in the system's font directory, pick the one you want, and then change the font.family name. It will change everything else. Easy as pie. On Tue Sep 25 15:59:10 2012, Steven Boada wrote: I fail to understand what I am doing wrong and how I supposed to fix it using backend :TkAgg Again in ipython, after I have imported rc from matplotlib... In [5]: rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']}) In [6]: figure() Out[6]: matplotlib.figure.Figure at 0x104bc6890 In [7]: xlabel('z') Out[7]: matplotlib.text.Text at 0x104bd05d0 In [8]: /opt/python/lib/python2.7/site-packages/matplotlib/font_manager.py:1214: UserWarning: findfont: Font family ['sans-serif'] not found. Falling back to Bitstream Vera Sans (prop.get_family(), self.defaultFamily[fontext])) This fails... In [8]: rc('font',**{'family':'serif','serif':['times new roman']}) In [9]: xlabel('z') Out[9]: matplotlib.text.Text at 0x104bd05d0 This works fine. The labels on the plot change and everything. Neither of these two fonts are located in the ttf directory. Both seem to be in the pdfcorefonts directory, and both have afm extensions.. This should not be this hard... Steven On 9/25/12 1:04 PM, Michael Droettboom wrote: Those *.afm fonts are only available in the postscript backend when ps.usecorefonts is set to True. Otherwise, you have to use TrueType/OpenType fonts. Mike On 09/25/2012 12:11 PM, Steven Boada wrote: Hey Mike $ fc-match Helvetica n019003l.pfb: Nimbus Sans L Regular Perhaps I don't have the fonts installed... In my matplotlib/mpl-data/fonts/ I have the following fonts installed... in ttf/ cmb10.ttf RELEASENOTES.TXT STIXSizFourSymBol.ttf VeraIt.ttf cmex10.ttf STIXGeneralBolIta.ttf STIXSizFourSymReg.ttf VeraMoBd.ttf cmmi10.ttf STIXGeneralBol.ttf STIXSizOneSymBol.ttf VeraMoBI.ttf cmr10.ttf STIXGeneralItalic.ttf STIXSizOneSymReg.ttf VeraMoIt.ttf cmss10.ttf STIXGeneral.ttfSTIXSizThreeSymBol.ttf VeraMono.ttf cmsy10.ttf STIXNonUniBolIta.ttf STIXSizThreeSymReg.ttf VeraSeBd.ttf cmtt10.ttf STIXNonUniBol.ttf STIXSizTwoSymBol.ttf VeraSe.ttf COPYRIGHT.TXT STIXNonUniIta.ttf STIXSizTwoSymReg.ttf Vera.ttf LICENSE_STIX STIXNonUni.ttf VeraBd.ttf README.TXT STIXSizFiveSymReg.ttf VeraBI.ttf and in pdfcorefonts Courier.afm Helvetica-Bold.afm Times-Bold.afm Courier-Bold.afm Helvetica-BoldOblique.afm Times-BoldItalic.afm Courier-BoldOblique.afm Helvetica-Oblique.afm Times-Italic.afm Courier-Oblique.afm readme.txt Times-Roman.afm Helvetica.afmSymbol.afm ZapfDingbats.afm Which does include some Helvetica fonts. And the font that I am trying to use doesn't *have* to be helvetica. I just like that font, so I was playing with it. Steven On 9/25/12 10:41 AM, Michael Droettboom wrote: Do you have a font installed called Helvetica? That's pretty rare these days... most systems have one of the many Helvetica clones instead. Does fc-match Helvetica (at the commandline) return anything? Mike On 09/25/2012 10:05 AM, Steven Boada wrote: List, I am trying, with little success, to change the fonts on my plots. It seems like a simple thing to do, but I can't seem to make it work. First, here is the relevant section of my Matplotlibrc file: backend : GTKAgg font.family : sans-serif font.style : normal font.weight : medium font.sans-serif : Helvetica (I copied this from the Matplotlibrc documentation page) Now if I make a plot, and put some labels on there... (just using ipython) In [3]: figure() Out[3]: matplotlib.figure.Figure at 0x2acb950 In [4]: xlabel('Hz',fontsize=20) Out[4]: matplotlib.text.Text at 0x2ae3510 In [5]: /opt/python/lib/python2.7/site-packages/matplotlib/font_manager.py:1216: UserWarning: findfont: Font family ['sans-serif'] not found. Falling back to Bitstream Vera Sans (prop.get_family(), self.defaultFamily[fontext])) I get this over and over and over again. I have deleted everything in my ~/.matplotlib folder. That is, I have deleted all of the font caches... I can't come up with anything else. The internet seems to thing that just deleting the caches will fix everything. In my case it doesn't. I get this problem on both
Re: [Matplotlib-users] logairthmic contour plot
List, I'm making a scatter plot using a for loop. Here's a simple example.. for i in range(10): x=rand() y=rand() scatter(x,y,label='point') legend() show() When you do this, you get a legend entry for every single point. In this case, I get 9 entries in my legend. Is there a way to only get a single entry? I have looked into creating the legends by hand, but I'm not having much luck. Googling, only turned up a single example of someone else with the same problem. Help me list, you're my only hope. Steven -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Scatter legend woes.
Whoops, I forgot to change the subject. Sorry list. List, I'm making a scatter plot using a for loop. Here's a simple example.. for i in range(10): x=rand() y=rand() scatter(x,y,label='point') legend() show() When you do this, you get a legend entry for every single point. In this case, I get 9 entries in my legend. Is there a way to only get a single entry? I have looked into creating the legends by hand, but I'm not having much luck. Googling, only turned up a single example of someone else with the same problem. Help me list, you're my only hope. Steven On 06/13/2012 01:33 PM, Eric Firing wrote: On 06/13/2012 07:31 AM, jonasr wrote: Hi, im actually trying to make a countour plot Z=f(X,Y) from two variables X,Y . My Problem is that i have to use a logarithmic scale for the Z values. If i plot the data with the logarithmic scale it gets pretty ugly, because i have a lot of values which are zero, which means on the log scale the value goes to -inf. Here is an example what i mean http://www.imagebanana.com/view/qh1khpxp/example.png I acutally have no idea how to make the plot look better, maybe somebody has an idea ? Use np.ma.masked_less to mask out values below some threshold before taking the log. e.g., import matplotlib.pyplot as plt import numpy as np x = np.arange(0, 1, 0.01) y = np.arange(0, 8, 0.05) X, Y = np.meshgrid(x, y) Z = 10 ** (-5 + 11 * X * np.sin(Y)) Z = np.ma.masked_less(Z, 1e-4) Zlog = np.ma.log10(Z) CS = plt.contourf(X, Y, Zlog, levels=np.arange(-3, 5.01, 1.0), extend='both') plt.colorbar() Eric thank you -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Steven Boada Dept. Physics and Astronomy Texas AM University bo...@physics.tamu.edu -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Scatter legend woes.
Well I am doing a lot more than this simple example shows. Point is that there are nine different points each with their own legend entry. I could put it all out of the for loops, but it is all already written, and I'd rather just fix the legend at the end than move sections of the code around. I'm willing to do it, if that is the only choice, but I wanted to ask before I commit my time. Wouldn't it be a good (smart) thing for the code to lump all the points with the same label together? This would be a great feature to be added IMO. S On 06/13/2012 03:01 PM, pybokeh wrote: Are you trying to make 9 scatter plots? In your for loop, if you are trying to make a set of x values and a set of y values, then I think this is wrong. Since you didn't provide import statements I don't know which rand() function you are using. Assuming it is scipy.rand(), you will only have one x value and one y value, not much of scatter chart with just one point :-) Otherwise, Mike's suggestion is valid. Regards, Daniel On Jun 13, 2012 3:35 PM, Steven Boada bo...@physics.tamu.edu mailto:bo...@physics.tamu.edu wrote: Whoops, I forgot to change the subject. Sorry list. List, I'm making a scatter plot using a for loop. Here's a simple example.. for i in range(10): x=rand() y=rand() scatter(x,y,label='point') legend() show() When you do this, you get a legend entry for every single point. In this case, I get 9 entries in my legend. Is there a way to only get a single entry? I have looked into creating the legends by hand, but I'm not having much luck. Googling, only turned up a single example of someone else with the same problem. Help me list, you're my only hope. Steven On 06/13/2012 01:33 PM, Eric Firing wrote: On 06/13/2012 07:31 AM, jonasr wrote: Hi, im actually trying to make a countour plot Z=f(X,Y) from two variables X,Y . My Problem is that i have to use a logarithmic scale for the Z values. If i plot the data with the logarithmic scale it gets pretty ugly, because i have a lot of values which are zero, which means on the log scale the value goes to -inf. Here is an example what i mean http://www.imagebanana.com/view/qh1khpxp/example.png I acutally have no idea how to make the plot look better, maybe somebody has an idea ? Use np.ma.masked_less to mask out values below some threshold before taking the log. e.g., import matplotlib.pyplot as plt import numpy as np x = np.arange(0, 1, 0.01) y = np.arange(0, 8, 0.05) X, Y = np.meshgrid(x, y) Z = 10 ** (-5 + 11 * X * np.sin(Y)) Z = np.ma.masked_less(Z, 1e-4) Zlog = np.ma.log10(Z) CS = plt.contourf(X, Y, Zlog, levels=np.arange(-3, 5.01, 1.0), extend='both') plt.colorbar() Eric thank you -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Steven Boada Dept. Physics and Astronomy Texas AM University bo...@physics.tamu.edu mailto:bo...@physics.tamu.edu -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net mailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Steven Boada Dept. Physics and Astronomy Texas AM University bo...@physics.tamu.edu -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263
Re: [Matplotlib-users] Scatter legend woes.
The gca().collections.set_label('label') works great. Admittedly, I'm not sure why it works. I'm not that great with the collections stuff. But thanks! S On 06/13/2012 03:22 PM, Mike Kaufman wrote: On 6/13/12 4:06 PM, Steven Boada wrote: Well I am doing a lot more than this simple example shows. Point is that there are nine different points each with their own legend entry. I could put it all out of the for loops, but it is all already written, and I'd rather just fix the legend at the end than move sections of the code around. I'm willing to do it, if that is the only choice, but I wanted to ask before I commit my time. Wouldn't it be a good (smart) thing for the code to lump all the points with the same label together? This would be a great feature to be added IMO. Assuming that you already have ten scatter plots, change the labels on the ones you don't want in the legend to '_nolegend_' (see help(legend)) for i in range(10): gca().collections[i].set_label('_nolegend_') gca().collections[0].set_label('the one label I want') legend() draw() M -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Steven Boada Dept. Physics and Astronomy Texas AM University bo...@physics.tamu.edu -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Normalized Histograms
Hi Users, I'm looking to make a histogram that is normalized by the total number of items shown in the histogram. For example: Let's say that I have an array 1000 items long. If I make a histogram in the normal way hist(x,10) then I get a histogram showing the total number of items in each bin. What I want to do is take that total number in each bin and divide them by 1000 and then make the plot. So if one of my bins has 350 objects in it, then it would be changed to 0.35. Another way to say it would be that I want the height of the histogram to represent the fraction of the total. I am pretty sure that this is different than using the normed=True flag, but I couldn't find anyone talking about this when I searched. Thanks Steven -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] semilog scatter plot save as postscript.
Hi List, I cannot save a semilog (x axis) scatter plot as a postscript file. I have tried as many backends as I can think of. I can save PNG fine, just not a PDF or a PS. Here is some sample code that doesn't work. I did this test in ipython, so no imports or anything like that. figure() subplot(111) x = randn(1000) y = randn(1000) scatter(x,y) xscale('log') Then save the ps. I just used the interactive window to save it. Try to open the ps and it fails. Next I tried figure() semilogx() scatter(x,y) Still no dice... System specs: Ubuntu 11.04 matplotlib 1.1.0 backend GTKagg Thanks list. Steven -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users