Re: [Matplotlib-users] Custom colormap is inconsistent. What is wrong?
On Tue, Feb 1, 2011 at 6:31 PM, Eric Firing wrote: > On 02/01/2011 02:18 PM, Benjamin Root wrote: >> On Tue, Feb 1, 2011 at 6:05 PM, Jeremy Conlin > <mailto:jlcon...@gmail.com>> wrote: >> >> On Tue, Feb 1, 2011 at 5:00 PM, Benjamin Root > <mailto:ben.r...@ou.edu>> wrote: >> > >> > >> > On Tue, Feb 1, 2011 at 5:48 PM, Jeremy Conlin > <mailto:jlcon...@gmail.com>> wrote: >> >> >> >> I'm trying to create a custom colormap used with pcolormesh, but the >> >> results seem inconsistent to me. I want the following colors >> >> >> >> -3 < x <= -2 - Black >> >> -2 < x <= -1 - Blue >> >> -1 < x <= 0 - Yellow >> >> 0 < x <= 1 - Green >> >> 1 < x <= inf - Red >> >> >> >> A minimal example is copied below. I have a 2-D array that >> looks like: >> >> >> >> -1, 6, 2.5 >> >> 1.3, -2, 4/3 >> >> 2.5, 6, 0 >> >> >> >> I want to get a pcolormesh that looks like >> >> >> >> R R Y >> >> R K R >> >> B R R >> >> >> >> But instead I get: >> >> >> >> Y R B >> >> Y K Y >> >> K R Y >> >> >> >> I recognize that the pcolormesh is plotted "upside-down" from >> how the >> >> matrix is printed. I apparently don't understand how to use a >> custom >> >> colormap. I have tried to follow the example here: >> >> >> >> http://matplotlib.sourceforge.net/examples/api/colorbar_only.html >> >> >> >> but haven't been too successful. It seems like there is a >> >> normalization going on that I can't seem to track down. Can anyone >> >> see what is wrong? >> >> >> >> Thanks, >> >> Jeremy >> >> >> >> >> >> import numpy >> >> import matplotlib.pyplot as pyplot >> >> import matplotlib.colors >> >> >> >> C = numpy.array([[-1,6,2.5],[4/3., -2, >> 4/3.],[2.5,6,0.0]],dtype=float) >> >> >> >> cMap = matplotlib.colors.ListedColormap(['k', 'b', 'y', 'g', 'r']) >> >> Bounds = [-3.0, -2.0, -1.0, 0.0, 1.0, numpy.inf] >> >> >> >> # Plot >> >> Fig = pyplot.figure() >> >> pyplot.pcolormesh(C, cmap=cMap) >> >> >> > >> > Have you given imshow() a try? The pcolor() and family are >> really meant for >> > more general domain specifications. imshow() is about as basic >> as one can >> > get for producing an image that shows the colors for particular >> values. >> > matshow() also does something similar and doesn't interpolate between >> > points. >> > >> > I don't know if it would fix your problem, but it should be a >> good start. >> >> I just tried both imshow and matshow and they gave the same output, >> but the plot was rotated -90º. I don't care so much about how it is >> oriented, but I do care about consistency, i.e. -1 should be plotted >> as blue, but is instead black. I could also accept -1 as yellow since >> -1 is on the boundary. pcolor, imshow, and matshow all show the same >> inconsistency. >> >> Jeremy >> >> >> I think I just figured out what is wrong. In your code, you create a >> ListedColormap, but you don't assign a Norm object. So, when you call >> pcolor or whatever, it will use the default norm using the range of >> input values. I see you created a list of boundaries called Bounds, but >> you don't do anything with it. >> >> I believe you want to first make a BoundaryNorm object using Bounds and >> pass that object to the ListedColormap using the norm keyword. > > Not to the ListedColormap, but to the imshow or whatever. Here is an > example of BoundaryNorm: > > http://matplotlib.sourceforge.net/examples/pylab_examples/image_masked.html > > And here is another, using a BoundaryNorm with a L
Re: [Matplotlib-users] Custom colormap is inconsistent. What is wrong?
On Tue, Feb 1, 2011 at 5:00 PM, Benjamin Root wrote: > > > On Tue, Feb 1, 2011 at 5:48 PM, Jeremy Conlin wrote: >> >> I'm trying to create a custom colormap used with pcolormesh, but the >> results seem inconsistent to me. I want the following colors >> >> -3 < x <= -2 - Black >> -2 < x <= -1 - Blue >> -1 < x <= 0 - Yellow >> 0 < x <= 1 - Green >> 1 < x <= inf - Red >> >> A minimal example is copied below. I have a 2-D array that looks like: >> >> -1, 6, 2.5 >> 1.3, -2, 4/3 >> 2.5, 6, 0 >> >> I want to get a pcolormesh that looks like >> >> R R Y >> R K R >> B R R >> >> But instead I get: >> >> Y R B >> Y K Y >> K R Y >> >> I recognize that the pcolormesh is plotted "upside-down" from how the >> matrix is printed. I apparently don't understand how to use a custom >> colormap. I have tried to follow the example here: >> >> http://matplotlib.sourceforge.net/examples/api/colorbar_only.html >> >> but haven't been too successful. It seems like there is a >> normalization going on that I can't seem to track down. Can anyone >> see what is wrong? >> >> Thanks, >> Jeremy >> >> >> import numpy >> import matplotlib.pyplot as pyplot >> import matplotlib.colors >> >> C = numpy.array([[-1,6,2.5],[4/3., -2, 4/3.],[2.5,6,0.0]],dtype=float) >> >> cMap = matplotlib.colors.ListedColormap(['k', 'b', 'y', 'g', 'r']) >> Bounds = [-3.0, -2.0, -1.0, 0.0, 1.0, numpy.inf] >> >> # Plot >> Fig = pyplot.figure() >> pyplot.pcolormesh(C, cmap=cMap) >> > > Have you given imshow() a try? The pcolor() and family are really meant for > more general domain specifications. imshow() is about as basic as one can > get for producing an image that shows the colors for particular values. > matshow() also does something similar and doesn't interpolate between > points. > > I don't know if it would fix your problem, but it should be a good start. I just tried both imshow and matshow and they gave the same output, but the plot was rotated -90º. I don't care so much about how it is oriented, but I do care about consistency, i.e. -1 should be plotted as blue, but is instead black. I could also accept -1 as yellow since -1 is on the boundary. pcolor, imshow, and matshow all show the same inconsistency. Jeremy -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Custom colormap is inconsistent. What is wrong?
I'm trying to create a custom colormap used with pcolormesh, but the results seem inconsistent to me. I want the following colors -3 < x <= -2 - Black -2 < x <= -1 - Blue -1 < x <= 0 - Yellow 0 < x <= 1 - Green 1 < x <= inf - Red A minimal example is copied below. I have a 2-D array that looks like: -1,6, 2.5 1.3, -2, 4/3 2.5, 6, 0 I want to get a pcolormesh that looks like R R Y R K R B R R But instead I get: Y R B Y K Y K R Y I recognize that the pcolormesh is plotted "upside-down" from how the matrix is printed. I apparently don't understand how to use a custom colormap. I have tried to follow the example here: http://matplotlib.sourceforge.net/examples/api/colorbar_only.html but haven't been too successful. It seems like there is a normalization going on that I can't seem to track down. Can anyone see what is wrong? Thanks, Jeremy import numpy import matplotlib.pyplot as pyplot import matplotlib.colors C = numpy.array([[-1,6,2.5],[4/3., -2, 4/3.],[2.5,6,0.0]],dtype=float) cMap = matplotlib.colors.ListedColormap(['k', 'b', 'y', 'g', 'r']) Bounds = [-3.0, -2.0, -1.0, 0.0, 1.0, numpy.inf] # Plot Fig = pyplot.figure() pyplot.pcolormesh(C, cmap=cMap) -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to use pcolormesh with two masked arrays
On Tue, Feb 1, 2011 at 1:11 PM, Benjamin Root wrote: > > > On Tue, Feb 1, 2011 at 1:48 PM, Jeremy Conlin wrote: >> >> On Tue, Feb 1, 2011 at 11:22 AM, Benjamin Root wrote: >> > >> > >> > On Tue, Feb 1, 2011 at 11:58 AM, Jeremy Conlin >> > wrote: >> >> >> >> I have two arrays and I want to plot the ratio of A/B when A>=B or B/A >> >> when A> >> these two instances, but I'm having trouble plotting them. Below I >> >> have a minimal example. I get a plot, but only from the second time I >> >> issue the pcolormesh command. Is there a way to combine the two >> >> arrays for plotting or to plot without overlapping? >> >> >> >> Thanks, >> >> Jeremy >> >> >> >> >> > >> > Try this: >> > >> > ratio = numpy.where(A >= B, A/B, B/A) >> > Figure = pyplot.figure() >> > pyplot.pcolormesh(ratio) >> > >> > I hope that helps! >> >> numpy.where helps a lot. To further complicate things, some elements >> of A or B are zero which causes A/B or B/A to be infinite in some >> places. I can use numpy.where or create a masked array to elimnate >> those elements that are infinite, but then my plotted values are >> either 0 or 1 (False or True); I lose all the interesting data. The >> documents of pcolormesh show that I can pass a masked_array, but I'm >> successful in doing that. Do you have another trick you can show to >> help me get around this problem? >> >> Thanks again, >> Jeremy > > > I think you are using the masked array and/or the np.where incorrectly. > > ratio = np.where(A >= B, A/B, B/A) > ratio = np.ma.masked_array(ratio, mask=(~np.isfinite(ratio))) > > And then do a contourf on ratio. Yeah, that seems to work. Thanks for the help. Jeremy -- Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] How to use pcolormesh with two masked arrays
I have two arrays and I want to plot the ratio of A/B when A>=B or B/A when A=B, fill_value=0.0) ba = numpy.ma.masked_array(B/A, mask=Ahttp://p.sf.net/sfu/arcsight-sfd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to add extra ticks to colorbar
On Fri, Sep 17, 2010 at 12:44 AM, Scott Sinclair wrote: > On 16 September 2010 22:52, Jeremy Conlin wrote: >> I have a colorbar which has some ticks, but I would like to add my own >> ticks without replacing any of the existing ones. In addition, I >> would like to give the ticks a different labels like "min" and "max". >> Can someone show how this might be done? > > http://matplotlib.sourceforge.net/examples/pylab_examples/colorbar_tick_labelling_demo.html > should give you some ideas to get started. Thanks for pointing me to that demo, it's a good one. However, I want the ticks that are generated automatically, in addition to the extra ones I add. The demo seems to show how I can define my own only. Jeremy -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] How to add extra ticks to colorbar
I have a colorbar which has some ticks, but I would like to add my own ticks without replacing any of the existing ones. In addition, I would like to give the ticks a different labels like "min" and "max". Can someone show how this might be done? Thanks, Jeremy -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Math fonts not working after upgrading to MPL 1.0
On Wed, Sep 8, 2010 at 10:42 AM, Tony S Yu wrote: > > On Sep 8, 2010, at 11:56 AM, Jeremy Conlin wrote: > >> I have trouble getting any symbols or any super/sub scripts to work >> since I upgraded to 1.0 a few months ago. I always get a message >> saying that some font isn't found. This occurs whenever I try to put >> symbols, superscripts, or subscripts in a label, or when I use a log >> scale (because then it MPL has to use superscripts). I have tried >> changing my matplotlibrc file but haven't found any combination of >> settings that help. >> >> To illustrate the problem, I have included three files, one python >> file and the other the error as captured from the output as well as my >> matplotlibrc file. The python file is trivial: >> >> # - >> import matplotlib.pyplot as pyplot >> >> pyplot.plot([1,2,3], label='$\alpha > \beta$') >> >> pyplot.legend() >> pyplot.show() >> # - >> >> Can someone please help me figure out what is wrong? I'm on a Mac >> running 10.6, python 2.6, matplotlib 1.0, and I have TeX installed. >> > Works on my system if you use a raw string (note ``r`` before string): > >>>> pyplot.plot([1,2,3], label=r'$\alpha > \beta$') > > Does that fix your problem? Unfortunately, no. When I use a raw string, I just get "*a@" instead of the expected result. See attached figure for proof. I still get a long list of errors of fonts not being found. Jeremy mathfont.pdf Description: Adobe PDF document -- This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Math fonts not working after upgrading to MPL 1.0
I have trouble getting any symbols or any super/sub scripts to work since I upgraded to 1.0 a few months ago. I always get a message saying that some font isn't found. This occurs whenever I try to put symbols, superscripts, or subscripts in a label, or when I use a log scale (because then it MPL has to use superscripts). I have tried changing my matplotlibrc file but haven't found any combination of settings that help. To illustrate the problem, I have included three files, one python file and the other the error as captured from the output as well as my matplotlibrc file. The python file is trivial: # - import matplotlib.pyplot as pyplot pyplot.plot([1,2,3], label='$\alpha > \beta$') pyplot.legend() pyplot.show() # - Can someone please help me figure out what is wrong? I'm on a Mac running 10.6, python 2.6, matplotlib 1.0, and I have TeX installed. Thanks, Jeremy /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py:1242: UserWarning: findfont: Font family ['STIXGeneral'] not found. Falling back to Bitstream Vera Sans (prop.get_family(), self.defaultFamily[fontext])) /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py:1252: UserWarning: findfont: Could not match :family=Bitstream Vera Sans:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0. Returning /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf UserWarning) /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py:1242: UserWarning: findfont: Font family ['STIXSizeOneSym'] not found. Falling back to Bitstream Vera Sans (prop.get_family(), self.defaultFamily[fontext])) /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py:1252: UserWarning: findfont: Could not match :family=Bitstream Vera Sans:style=normal:variant=normal:weight=bold:stretch=normal:size=12.0. Returning /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf UserWarning) /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py:1242: UserWarning: findfont: Font family ['STIXSizeThreeSym'] not found. Falling back to Bitstream Vera Sans (prop.get_family(), self.defaultFamily[fontext])) /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py:1242: UserWarning: findfont: Font family ['STIXSizeFourSym'] not found. Falling back to Bitstream Vera Sans (prop.get_family(), self.defaultFamily[fontext])) /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py:1242: UserWarning: findfont: Font family ['STIXSizeFiveSym'] not found. Falling back to Bitstream Vera Sans (prop.get_family(), self.defaultFamily[fontext])) /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py:1242: UserWarning: findfont: Font family ['STIXSizeTwoSym'] not found. Falling back to Bitstream Vera Sans (prop.get_family(), self.defaultFamily[fontext])) /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py:1252: UserWarning: findfont: Could not match :family=Bitstream Vera Sans:style=italic:variant=normal:weight=normal:stretch=normal:size=12.0. Returning /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf UserWarning) /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py:1242: UserWarning: findfont: Font family ['STIXNonUnicode'] not found. Falling back to Bitstream Vera Sans (prop.get_family(), self.defaultFamily[fontext])) /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py:1242: UserWarning: findfont: Font family ['cmb10'] not found. Falling back to Bitstream Vera Sans (prop.get_family(), self.defaultFamily[fontext])) /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py:1242: UserWarning: findfont: Font family ['cmtt10'] not found. Falling back to Bitstream Vera Sans (prop.get_family(), self.defaultFamily[fontext])) /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py:1242: UserWarning: findfont: Font family ['cmmi10'] not found. Falling back to Bitstream Vera Sans (prop.get_family(), self.defaultFamily[fontext])) /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py:1242: UserWarning: findfont: Font family ['cmex10'] not found. Falling back to Bitstream Vera San
[Matplotlib-users] Reduce image size
I have a matplotlib plot that I saved to a pdf image. The plot consists of 1E5 dots plotted with varying colors and opacities. Actually 1E5 black dots with varying opacities and 64 colored markers. The trouble is my image is 11 MB and takes a few seconds to fully display in a PDF reader. I am using this figure in a presentation and therefore need to reduce the file size so it will display more quickly. Is there any way I can reduce the size of my image while still keeping all the data? Thanks, Jeremy -- This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to improve colorbar scaling?
On Wed, Aug 18, 2010 at 10:11 PM, Jae-Joon Lee wrote: > > Try > > > cbar.formatter.set_useOffset(False) > cbar.formatter.set_scientific(True) > cbar.formatter.set_powerlimits((0,2)) > > It gives me > > offsetText -> "x 10^3" > and tick labels = ["5.0002", "5.0004",...] Yes that is exactly what I want. Thanks for being persistent in getting that through my thick skull. Jeremy -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to improve colorbar scaling?
On Mon, Aug 16, 2010 at 6:13 PM, Jae-Joon Lee wrote: > Using the set_powerlimits method didn't help? I couldn't get set_powerlimits or set_scientific to change anything in my colorbar scaling. If I used setOffset(False) then there was no scaling; an improvement, but not ideal. > > As far as I know, the current implementation does not allow a custom > scale factor. > But if the scale factor is power of 10 (10, 100, 1000, ...), I believe > using set_powerlimits method (as in my previous example, or some > variation) is good enough. Unfortunately in my simple example (and in my real world case), the scale factor is some number (i.e. 5) times a power of 10. Am I missing something? I'm running matplotlib version 1.0.0. Thanks, Jeremy import numpy import matplotlib.pyplot as pyplot a = 5000 b = 5002 M = (b-a)*numpy.random.random((5,5))+a fig = pyplot.figure() pc = pyplot.pcolor(M) cbar = fig.colorbar(pc) cbar.formatter.set_scientific(False) cbar.formatter.set_powerlimits((0,2)) # cbar.formatter.set_useOffset(False) cbar.update_ticks() -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to improve colorbar scaling?
On Sun, Aug 15, 2010 at 10:49 PM, Jae-Joon Lee wrote: > On Fri, Aug 13, 2010 at 3:34 AM, Jeremy Conlin wrote: >> I have a problem with the scaling of the numbers on a colorbar. The >> problem occurs when the numbers used as colorbar labels need to be >> scaled (i.e. by 1E3). The colorbar correctly puts the scaling value >> on the top of the colorbar, but instead of of multiplying by a scale >> factor, addition is used instead. See the attached script and figure >> for example. In the example, it looks like the color scale goes from >> 0 to 2*5E3. At least, that's what I thought when I first looked at >> it. Instead it means 5000 to 5002. >> >> Is there anyway I can scale the colorbar labels by *multiplying* them >> by a scaling factor instead of *adding* a scaling factor? That seems >> more intuitive to me and those I work with. >> > > Given the value range of 5000-5002, I doubt how using the scaling > factor improve your plot. > > To disable the use of offset (+5000), > > cb = fig.colorbar(pc) > > # do not use offset > cb.formatter.set_useOffset(False) > > cb.update_ticks() > > If you do want to use scaling factor, > > # to use scaling factor > cb.formatter.set_scientific(True) > cb.formatter.set_powerlimits((0,0)) > > cb.update_ticks() > > This will only work with matplotlib v1.0. > In older versions, try to replace "update_ticks" with > "update_bruteforce" (but I'm not sure if this will work) > > IHTH, > Thanks for your suggestions. I recognize that a range of 5000–5002 is not much; it was used simply to illustrate my point. I was able to turn the scaling off with set_useOffset(False). Is there anyway to scale by multiplying instead of adding? Thanks, Jeremy -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] How to improve colorbar scaling?
I have a problem with the scaling of the numbers on a colorbar. The problem occurs when the numbers used as colorbar labels need to be scaled (i.e. by 1E3). The colorbar correctly puts the scaling value on the top of the colorbar, but instead of of multiplying by a scale factor, addition is used instead. See the attached script and figure for example. In the example, it looks like the color scale goes from 0 to 2*5E3. At least, that's what I thought when I first looked at it. Instead it means 5000 to 5002. Is there anyway I can scale the colorbar labels by *multiplying* them by a scaling factor instead of *adding* a scaling factor? That seems more intuitive to me and those I work with. Jeremy colorbarExample.py Description: Binary data colorbarExample.pdf Description: Adobe PDF document -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Permission error after installing MPL 1.0 on Mac
I recently installed MPL on two Macs, one running 10.6 and another running 10.5. When I try to plot, I get the following error: TclError: couldn't open "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/mpl-data/images/home.ppm": permission denied After checking, it's true that only the owner has read permissions. This is easy enough on my end, but I wonder if there is a problem with the distributed installer that should have the correct permissions for these images. Has anyone else seen this problem or is it just me? Jeremy -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] No color scaling when using plot_surface. Please help
On Friday, July 9, 2010, Benjamin Root wrote: > Jeremy, > > I believe that 0.99.1 is fairly old. I don't know when Axes3D came along, > but I am sure you can find it in 0.99.3. It is most definitely in 1.0, but > you might not need to go that far if your distro does not provide it. Wince my first post, I have upgraded to 1.0 which definitely has Axes3D. The trouble is that the plot_surface function does not deal with masked arrays like color does. That is what I need and I haven't found a way around it. Jeremy -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] No color scaling when using plot_surface. Please help
On Thu, Jul 8, 2010 at 8:41 AM, Jeremy Conlin wrote: > On Sun, Jul 4, 2010 at 8:38 PM, Benjamin Root wrote: >> Jeremy, >> >> The pcolor function can take a vmin and a vmax parameter if you wish to >> control the colorscaling. In addition, you can use a special array >> structure called a "masked array" to have pcolor ignore "special" values. >> Assuming your data is 'vals': >> >> vals_masked = numpy.ma.masked_array(vals, vals == 0.0) >> >> Note that depending on your situation, doing an equality with with a >> floating point value probably isn't very reliable, so be sure to test and >> modify to suit your needs. 'vals_masked' can then be passed to pcolor >> instead of vals. > > Yes, I think this is exactly what I need. Thanks! > To follow up with my response, I tried the above and it works nicely with pyplot.pcolor. I would like to get a 3D version of this, like I get using Axes3D.plot_surface. Is this just not implemented yet? I am using 0.99.1.1. Has this been implemented in matplotlib 1.0? Thanks, Jeremy -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] No color scaling when using plot_surface. Please help
On Sun, Jul 4, 2010 at 8:38 PM, Benjamin Root wrote: > Jeremy, > > The pcolor function can take a vmin and a vmax parameter if you wish to > control the colorscaling. In addition, you can use a special array > structure called a "masked array" to have pcolor ignore "special" values. > Assuming your data is 'vals': > > vals_masked = numpy.ma.masked_array(vals, vals == 0.0) > > Note that depending on your situation, doing an equality with with a > floating point value probably isn't very reliable, so be sure to test and > modify to suit your needs. 'vals_masked' can then be passed to pcolor > instead of vals. Yes, I think this is exactly what I need. Thanks! Jeremy -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] No color scaling when using plot_surface. Please help
I am trying to plot some data over a mesh using the plot_surface method. However when I plot my data, everything is the same color when I expected to get a nice rainbow of colors as in the example: http://matplotlib.sourceforge.net/examples/mplot3d/surface3d_demo.html I have attached a simple script to show what I did as well as the result. Essentially, I just copied the above demo, but put my own data in. I think the problem arises because I have "holes" in my data, or areas where the data is zero. These zeros throw the scaling off so I tried to eliminate their effect, but this messed everything up. Essentially my question is: how can I get a nice color distribution while at the same time avoid the extreme scaling issues associated with some data being zero (while all the other data is ~16)? Thanks, Jeremy tmp.py Description: Binary data tmp.pdf Description: Adobe PDF document -- This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Unequal size gangplots
On Mon, Jun 21, 2010 at 2:33 PM, Jeffrey Blackburne wrote: > I have used add_axes() to do this in the past. E.g., > > import matplotlib.pyplot as plt > > fig = plt.figure() > leftmarg = 0.125 # change these numbers to taste > botmmarg = 0.125 > width = 0.825 > height = 0.825 > frac = 2./3. > ax0 = fig.add_axes([leftmarg, botmmarg, width, frac*height]) > ax1 = fig.add_axes([leftmarg, botmmarg+frac*height, width, (1-frac)*height]) > ax1.xaxis.set_ticklabels([]) > plt.show() > > Sorry it is in object-oriented style instead of pylab style... > Thanks! This looks like it might work. I'll give it a try. Jeremy -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Unequal size gangplots
I have followed this excellent example: http://matplotlib.sourceforge.net/examples/pylab_examples/ganged_plots.html but I would like my plots to be 2/3 and 1/3 of the total height of the figure (I only have 2 plots). What do I have to do to specify the relative sizes of the figures? Thanks, Jeremy -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Can I make a mplot3d PolyCollection Plot with projection on back wall
On Wed, Apr 14, 2010 at 9:35 AM, Ben Axelrod wrote: > This example shows how to use 2d plots in a 3d plot: > http://matplotlib.sourceforge.net/examples/mplot3d/2dcollections3d_demo.html > > These examples may also help: > http://matplotlib.sourceforge.net/trunk-docs/examples/mplot3d/contour3d_demo3.html > http://matplotlib.sourceforge.net/trunk-docs/examples/mplot3d/pathpatch3d_demo.html > > -Ben Yep those are what I needed. Thanks! Jeremy -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Can I make a mplot3d PolyCollection Plot with projection on back wall
I want to make a plot similar to this demo: http://matplotlib.sourceforge.net/examples/mplot3d/polys3d_demo.html but also make simple line plots on the "back wall" of the plot, perhaps with the pyplot.plot command. How can I do this? Thanks, Jeremy -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Failure compiling MPL on Snow Leopard
I am trying to compile MPL on Snow Leopard without success. I have a fairly fresh system (10.6.2) with python.org 2.6.4 installed. I have downloaded the MPL trunk with svn. I had to make a small change to the make.osx file because there are some extra ". However I still can't get MPL to compile/install; it fails when compiling zlib. The change I made in the make.osx file is on line 11. It used to be: ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64" and is now: ARCH_FLAGS=-arch i386 -arch ppc -arch x86_64 The error I get while compiling is copied below. Can anyone help me figure out what is wrong? Thanks, Jeremy x zlib-1.2.3/zutil.h Checking for gcc... Building static library libz.a version 1.2.3 with gcc. Checking for unistd.h... No. Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf() Checking for snprintf() in stdio.h... No. WARNING: snprintf() not found, falling back to sprintf(). zlib can build but will be open to possible buffer-overflow security vulnerabilities. Checking for return value of sprintf()... No. WARNING: apparently sprintf() does not return a value. zlib can build but will be open to possible string-format security vulnerabilities. Checking for errno.h... No. Checking for mmap support... No. gcc -arch i386 -arch ppc -arch x86_64 -I/include -I/include/freetype2 -isysroot /Developer/SDKs/MacOSX10.6u.sdk -DNO_snprintf -DHAS_sprintf_void -DNO_ERRNO_H -c -o adler32.o adler32.c gcc -arch i386 -arch ppc -arch x86_64 -I/include -I/include/freetype2 -isysroot /Developer/SDKs/MacOSX10.6u.sdk -DNO_snprintf -DHAS_sprintf_void -DNO_ERRNO_H -c -o compress.o compress.c gcc -arch i386 -arch ppc -arch x86_64 -I/include -I/include/freetype2 -isysroot /Developer/SDKs/MacOSX10.6u.sdk -DNO_snprintf -DHAS_sprintf_void -DNO_ERRNO_H -c -o crc32.o crc32.c In file included from crc32.c:29: zutil.h:21:24: error: stddef.h: No such file or directory zutil.h:23:22: error: string.h: No such file or directory zutil.h:24:22: error: stdlib.h: No such file or directory crc32.c:36:24: error: limits.h: No such file or directory In file included from crc32.c:29: zutil.h:21:24: error: stddef.h: No such file or directory zutil.h:23:22: error: string.h: No such file or directory zutil.h:24:22: error: stdlib.h: No such file or directory crc32.c:36:24: error: limits.h: No such file or directory In file included from crc32.c:29: zutil.h:21:24: error: stddef.h: No such file or directory zutil.h:23:22: error: string.h: No such file or directory zutil.h:24:22: error: stdlib.h: No such file or directory crc32.c:36:24: error: limits.h: No such file or directory gcc -arch i386 -arch ppc -arch x86_64 -I/include -I/include/freetype2 -isysroot /Developer/SDKs/MacOSX10.6u.sdk -DNO_snprintf -DHAS_sprintf_void -DNO_ERRNO_H -c -o gzio.o gzio.c lipo: can't figure out the architecture type of: /var/tmp//cc9xNLIP.out make[1]: *** [crc32.o] Error 1 make[1]: *** Waiting for unfinished jobs gzio.c:10:19: error: stdio.h: No such file or directory and more errors below. -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Why do xticklabels and yticklabels always collide?
On Fri, Feb 12, 2010 at 11:30 AM, C M wrote: >> My biggest problem with matplotlib is that the smallest yticklabel and >> the smallest xticklabel always seem to lie on top of each other (or >> close to it). See attachment for example. Is there anyway to make it >> so these don't lie on top of each other? How can I make this the >> default behavior? >> >> Thanks, >> Jeremy > > This was just asked a day or two ago, and here's how that went: > > http://old.nabble.com/x%2Cy-ticklabel-too-close-to27551389.html Oops I didn't notice the other message. Sorry for asking again. -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Why do xticklabels and yticklabels always collide?
My biggest problem with matplotlib is that the smallest yticklabel and the smallest xticklabel always seem to lie on top of each other (or close to it). See attachment for example. Is there anyway to make it so these don't lie on top of each other? How can I make this the default behavior? Thanks, Jeremy Burunp.pdf Description: Adobe PDF document -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] How can I customize a legend?
I have a plot that I need to add a customized legend. (The plot is attached to this email.) I want to show that each color represents something as well as each marker symbol. For example: Green -> a Square -> j Blue -> b Circle-> k Red-> c Triangle -> l Black -> d Diamond -> m When representing the color, the symbol doesn't matter and vice versa for representing the symbol. Is there an easy way to do this or do I have to write some checks into my plotting function to make this happen. Thanks, Jeremy MPL.pdf Description: Adobe PDF document -- This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Extraneous line drawn using pyplot
On Fri, Oct 23, 2009 at 4:16 PM, Jae-Joon Lee wrote: > Your data repeat itself twice. > Please check your data and report back if you still see the problem. > Regards, Of course it does . Sorry for bothering the list with my stupidity. Jeremy -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Extraneous line drawn using pyplot
Hello list. I am having trouble with an extraneous line drawn from my last data point back to the first data point. I I don't quite know why this is happening and was hoping someone could tell me what was wrong. I have attached an example; the commands I used are copied below. Thanks, Jeremy 8> pyplot.clf() [SpentFuel/H2O]|3> pyplot.plot(Energy[0],Tally[0]) <3> [] [SpentFuel/H2O]|4> pyplot.step(Energy[0],Tally[0]) <4> [] [SpentFuel/H2O]|5> pyplot.xscale('log') [SpentFuel/H2O]|6> pyplot.clf -> pyplot.clf() [SpentFuel/H2O]|7> pyplot.xscale('log') [SpentFuel/H2O]|8> pyplot.plot(Energy[0],Tally[0]) <8> [] 9> Energy[0] <9> [1e-08, 9.9995e-08, 9.9995e-07, 1.0001e-05, 0.001, 1.0, 2.0, 5.0, 1e-08, 9.9995e-08, 9.9995e-07, 1.0001e-05, 0.001, 1.0, 2.0, 5.0] 10> Tally[0] <10> [1.58463e-06, 2.98732001e-05, 8.93929993e-06, 5.99841997e-06, 1.6206e-05, 8.33131994e-05, 2.32848001e-05, 2.43042e-05, 1.58463e-06, 2.98732001e-05, 8.93929993e-06, 5.99841997e-06, 1.6206e-05, 8.33131994e-05, 2.32848001e-05, 2.43042e-05] -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Fatal Python error when importing pyplot
On Mon, Mar 9, 2009 at 12:08 PM, John Hunter wrote: > > > On Mon, Mar 9, 2009 at 10:43 AM, Jeremy Conlin wrote: > >> I am using Mac OS X 10.5.5 and have installed Enthought's latest Python >> distribution which includes Matplotlib 0.98.3. I get a fatal python error >> whenever I try to import matplotlib.pyplot. The exact message I get is: >> Fatal Python error: Interpreter not initialized (version mismatch?) >> Abort trap >> >> Has anyone else had a problem with this? Please help me because I can't >> do any plotting until it's fixed! >> > > > So you haven't installed matplotlib or wxpython separately? This error can > arise when the version of python that built the extension is not the same as > the version of python you are running. I suggest making sure you have a > clean install of enthought python (remove the install dir entirely), > reinstall it, and if you still see the same problem report it on the > enthought list because it looks like a build problem more than a matplotlib > problem. > I did not install matplotlib seperately. A while back I did play with wxpython and wxwidgets, but my Python script that uses those libraries still work well. I did just reinstall my enthought python this morning when I was having these problems. I didn't delete anything before installing, I just assumed it would overwrite the old/bad stuff. > > Before you report, you may want to do some extra diagnostics. Eg create a > script like > > import matplotlib > matplotlib.use('Agg') > import matplotlib.pyplot > > > and try running this script, replacing 'Agg' with 'PS', 'PDF', 'TkAgg' and > 'WXAgg' and noting whether all fail in the same way, or if only some do. Now this was a good idea. Every backend worked except TkAgg which was my default specified in my ~/.matplotlib/matplotlibrc file. Jeremy -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Fatal Python error when importing pyplot
On Mon, Mar 9, 2009 at 12:50 PM, Jeff Whitaker wrote: > Jeremy Conlin wrote: > > >> >> On Mon, Mar 9, 2009 at 12:19 PM, Jeff Whitaker > jsw...@fastmail.fm>> wrote: >> >>Jeremy Conlin wrote: >> >>I am using Mac OS X 10.5.5 and have installed Enthought's >>latest Python distribution which includes Matplotlib 0.98.3. >> I get a fatal python error whenever I try to import >>matplotlib.pyplot. The exact message I get is: >> >>Fatal Python error: Interpreter not initialized (version >>mismatch?) >>Abort trap >> >>Has anyone else had a problem with this? Please help me >>because I can't do any plotting until it's fixed! >> >>Thanks, >>Jeremy >> >>Jeremy: That sometimes means you are importing a module into a >>different version of python than it was built against. Are you >>sure you are running Enthough python when you import matplotlib? >> >> >> I'm pretty sure it's the Enthought python. >> $ python --version >> Python 2.5.2 |EPD Py25 4.1.30101| >> >> Jeremy >> > Jeremy: Then unless you have DYLD_LIBRARY_PATH or PYTHONPATH set so that > the wrong python libs or extensions are being picked up, it must be an EPD > problem. I'd ask on the EPD list. Oops. A long time ago I set PYTHONPATH in my bash_profile. The value for that is now wrong. Now that I've fixed it, everything seems to work fine. Thanks for the help. Jeremy -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Fatal Python error when importing pyplot
I am using Mac OS X 10.5.5 and have installed Enthought's latest Python distribution which includes Matplotlib 0.98.3. I get a fatal python error whenever I try to import matplotlib.pyplot. The exact message I get is: Fatal Python error: Interpreter not initialized (version mismatch?) Abort trap Has anyone else had a problem with this? Please help me because I can't do any plotting until it's fixed! Thanks, Jeremy -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Installing latest version of matplotlib for enthought python
I installed EPD and now would like to install the latest version of matplotlib so I can try out the new CocoaAgg background. I can download the binary mpkg from sourceforge, but it won't work for me because my python version isn't the python from python.org. Can someone help me get this installed? Mac OS 10.5.6 EPD with Py2.5 (4.0.30002 ) -- http://www.enthought.com/epd Thanks, Jeremy -- This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Please help with 3d scatter plot
I have a function (shown below) that would take a 3D numpy array and plot points in 3D. I recently updated my matplotlib with the latest Enthought Python Distribution and now it doesn't work; I guess matplotlib changed the api a little bit. The first problem arises because there is no matplotlib.axes3d anymore. I can't find the equivalent in the newest version. Can someone help me figure this out? Thanks, Jeremy #=== import matplotlib.pyplot as pyplot import matplotlib.axes3d as p3 def PlotPoints(P): """ """ fig = pyplot.figure() ax = p3.Axes3D(fig) ax.plot3D(P[:,0],P[:,1],P[:,2],'.') pyplot.show() return ax - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Two questions regarding axis scaling
On Fri, Sep 12, 2008 at 4:31 PM, Jeff Whitaker <[EMAIL PROTECTED]> wrote: > Jeremy Conlin wrote: > >> First question: >> I know I can do pylab.loglog() to get a log-log plot. I would like to >> create a log-linear plot. How can I do this? >> > > semilogx or semilogy: > > > > semilogy < > http://matplotlib.sourceforge.net/matplotlib.pyplot.html#-semilogy>(*args, > **kwargs) > > Make a plot with log scaling on the *y* axis. > >> >> Second question: >> I would like to plot two sequences on the same figure with two different >> y-scales, one scale shown on the left and one scale shown on the right. How >> can I do this? >> > > twiny: > > > ax = twiny > <http://matplotlib.sourceforge.net/matplotlib.axes.html#Axes-twiny>() > create a twin of Axes > <http://matplotlib.sourceforge.net/matplotlib.axes.html#Axes> for > generating a plot with a shared > y-axis but independent x axis. The x-axis of self will have > ticks on bottom and the returned axes will have ticks on the > top > > -Jeff > >> Thanks for that information, that is what I needed. But now I come up with a separate problem. I have the following in my code: pylab.plot(n, S, 'b.', label='x') pylab.legend() ax2 = pylab.twinx() pylab.plot(n, mean, 'r',label="mean") ax2.yaxis.tick_right() pylab.legend() Both plots are shown with the appropriate axes, but only the second plot is listed in the legend. If I only have the first, then only the first plot will be listed. Please help. Jeremy - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Two questions regarding axis scaling
First question:I know I can do pylab.loglog() to get a log-log plot. I would like to create a log-linear plot. How can I do this? Second question: I would like to plot two sequences on the same figure with two different y-scales, one scale shown on the left and one scale shown on the right. How can I do this? Thanks in advance, Jeremy - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] os x leopard build step-by-step
Thanks for posting these instructions. Forgive me if this has already been hashed out in previous emails, but do the instructions for iPython resolve the readline issues in Leopard? Thanks, Jeremy On Nov 25, 2007 11:12 PM, John Hunter <[EMAIL PROTECTED]> wrote: > A couple of weeks ago I got a new powerbook and installed leopard on > it, and decided to keep fairly detailed notes of the process of > getting developer svn versions of some of the scientific python tools > installed (matplotlib, ipython, numpy, scipy aka MINS). The notes > will probably apply equally well for the released versions, but or > those of you embarking on getting a new OS X environment, up and > running, this might be helpful. I tried to leave nothing to the > imagination so that this would be useful to newbies, so some of this > will be a bit tedious to unix or max veterans > > == get access to the terminal == > > Put the "Terminal" on your dock launch bar. It is in the > Applications->Utilities folder > > == install gcc and other developer tools == > > Install XCode developer tools from the Leopard install CD under > optional packages. Verify the install -- check for a working gcc > > > gcc --version > i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465) > > == get the mac python python release == > > The consensus is that the python that ships with Apple is broken and > should be replaced with the universal binary from the mac python > community. Go to the mac python site for downloads and install the > python 2.5 universal binary from there > > http://www.pythonmac.org/packages/py25-fat/index.html > > Verify the python install > > > /usr/local/bin/python > Python 2.5 (r25:51918, Sep 19 2006, 08:49:13) > [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > > Make sure that /usr/local/bin is in your PATH before the Apple > defaults. I added this to the front of my default .bash_profile > > > PATH="/usr/local/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}" > export PATH > > Start a new terminal instance and verify > > > which python > /usr/local/bin/python > > Get whatever else you want from pythonmac.org > > == get svn checkouts of MINS == > > I am going to be installing most things from svn since I need > developerversions of many packages, but you may just want to get the > latest stable releases from this pythonmac site. In particular, I > always run svn ipython, numpy, scipy and matplotlibx > > = ipython = > >> svn co http://ipython.scipy.org/svn/ipython/ipython/trunk ipython >> cd ipython >> sudo python setup.py install > > = numpy = > >> svn co http://svn.scipy.org/svn/numpy/trunk numpy >> cd numpy >> sudo python setup.py install > > = scipy = > >> svn co http://svn.scipy.org/svn/scipy/trunk scipy > >http://scipy.org/Installing_SciPy/Mac_OS_X gives step-by-step >instructions to install the vecLib Framework (should have been >done in step one of the developer tools above) g77 compiler, the >fftw libs, and the scipy build commands, do I won't repeat them >here. The only gotcha was I got an internal compiler error >"qelg.f:1: internal compiler error: vector VEC ..." when I >downloaded the intel gfortran binary linked from the site, so I >grabbed the gfortran-intel-leopard-bin.tar.gz from >http://hpc.sourceforge.net/ and reinstalled using > > > sudo tar -xvzf gfortran-intel-leopard-bin.tar.gz -C / > > and then did a clean build of scipy > > > = matplotlib = > > matplotlib wants a GUI, so I am going to try wxpython2.8, which is > available from the pythonmac ite. Because I am interested in > installing the enthought tools which need wxython (eg traits UI) I'm > going to see if I can get a wx enabled build of mpl going. I > installed wxPython2.8-osx-unicode-2.8.3.0-universal10.4-py2.5.dmg from > the pythonmac site and am crossing my fingers that I don't find myself > entangled in wx version hell. > > > svn co > https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlib > > matplotlib depends on libpng and freetype, both of which are provided > by the xcode package in /usr/X11R6, so I am going to point the mpl > build to that directory. sys.platform is "darwin", so edit > setupext.py and add '/usr/X11R6' to the "basedir" dictionary for the > 'darwin' key. You need to install pkgcong-0.22 from > http://pkgconfig.freedesktop.org/releases/ (just configure, sudo make > install it) so that matplotlib can use it to find an properly > configure png and freetype. You will need to set the pkgcong path > > > export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig > > After all that, I could build mpl from svn with > > > python setup.py build > > sudo python setup.py install > > and successfully make a figure with > > > ipython -pylab > >>> plot([1,2,3]) > > which used the wxagg backend. > > -
Re: [Matplotlib-users] Installing under Leopard (Mac OSX 10.5)
I am having a similar problem. However I can't seem to get matplotlib to compile at all. It fails when it can't find png.h. At the beginning, it says it can find freetype and libpng, but can't find the appropriate header files. I have found them here: /Developer/SDKs/MacOSX10.5.sdk/usr/X11/include So the question is, how can I/we get matplotlib to use the included versions of freetype and libpng instead of downloading and compiling other versions? Thanks, Jeremy On Nov 13, 2007 11:01 AM, Scott Cooper <[EMAIL PROTECTED]> wrote: > sent to: matplotlib-users@lists.sourceforge.net > > I'm attempting to install matplotlib under version 10.5 ("Leopard") of > the Macintosh operating system. > > I had an old installation, via Fink, which broke when I (foolishly) > upgraded from version 10.4 to version 10.5. > > In principle, installing matplotlib under 10.5 should be simple, > because Leopard already includes all of matplotlib's dependencies: > Python 2.4 (and 2.5) > numpy > libpng > zlib > freetype > > In practice, I seem to be running into trouble with freetype. > > I built matplotlib version 0.90.1 from source, and installed it in / > Library/Python/2.5/site-packages > > When I run python2.5 and import pylab, the import looks for freetext. > 6.dylib in /sw/lib/freetype219/lib/libfreetype.6.dylib (i.e. the > broken Fink installation, incompatable with Leopard) which results in > a bus error. (My reasons for this assertion are given below.) There's > a (presumably Leopard-compatable) version of libfreetype.6.dylib in / > usr/X11/lib/libfreetype.6.dylib > > ...so, my problem seems to be, how do I get matplotlib to look for > libfreetype.6.dylib in the right place? > > I have tried changing setup.py Specifically, I've replaced > 'darwin' : ['/sw/lib/freetype2', '/sw/lib/freetype219', '/usr/local', > '/usr', '/sw'], > with > 'darwin' : ['/usr/X11', '/usr/X11/lib', '/usr/X11/include', '/usr/X11/ > include/freetype2', '/usr/local','/usr'], > Which does not solve the problem (does not change anything at all, as > far as I can tell). > > I've not been able to locate an explicit reference to the /sw > directory anywhere else in setupext.py, or in setup.py > > APPENDIX: why am I convinced that pylab is looking for freetype. > 6.dylib in /sw/lib/freetype219/lib/ ? > > First, when I get the bus error, a window pops up saying that Python's > "unexpected quit" (=crash) may be due to "freetype.6.dylib" > > Second, when I click the "report" button in this window, I see many > pages of debugging info which I don't know how to interpret, but which > includes this line: > 0x1226000 - 0x1279ff3 +libfreetype.6.dylib ??? (???) /sw/lib/ > freetype219/lib/libfreetype.6.dylib > > Third, when I temporarily remove the entire /sw/lib/freetype219 > directory from /sw/lib then run python2.5 and import pylab, I no > longer get a bus error, but I *do* now get *this* error: > ImportError: dlopen(/Library/Python/2.5/site-packages/matplotlib/ > ft2font.so, 2): Library not loaded: /sw/lib/freetype219/lib/ > libfreetype.6.dylib >Referenced from: /Library/Python/2.5/site-packages/matplotlib/ > ft2font.so >Reason: image not found > > I am going to try some monkey business along the lines of > ln /usr/X11/lib/libfreetype.6.dylib /sw/lib/freetype219/lib/ > libfreetype.6.dylib > and will let you know the results. However, even if that works, it's > a heinous kluge, and probably fragile, too. > > > > - > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Equivalent to Gnuplot histeps style
On 10/18/07, Eric Firing <[EMAIL PROTECTED]> wrote: > Jeremy Conlin wrote: > > On 10/18/07, Eric Firing <[EMAIL PROTECTED]> wrote: > >> Jeremy Conlin wrote: > >>> On 10/17/07, Charles Seaton <[EMAIL PROTECTED]> wrote: > >>>> Jeremy, > >>>> > >>>> I ran across the answer to this last week while searching the list for > >>>> info on datestr2num (both subjects happened to come up in the same > >>>> exchange). > >>>> > >>>> http://www.nabble.com/First-impression-from-a-new-user-tf1716894.html#a4662446 > >>>> > >>>> plot(x, y, linestyle='*steps*') > >>>> > >>>> Charles Seaton > >>> > >>> Well that's great! (I should have at least tried making such a plot > >>> before posting. Sorry.) How come I couldn't find it in the > >>> documentation? I can't find anything about available linestyles. Am > >>> I looking the wrong location? I am looking at users_guide_0.9.0.pdf > >> The user's guide tends to lag. To find the latest features, look at the > >> CHANGELOG, the examples, and the docstrings. Ipython is a big help for > >> looking at docstrings and trying things out. Are you familiar with it? > >> > >> Eric > >> > > > > I am familiar with IPython and use it all the time as a replacement > > for the standard Python interpreter. I don't always use the extra > > features it offers. I just did > > > > help pylab.plot > > Even easier: > > pylab.plot? > > And for more detail (but mostly useful for matplotlib modules and > functions rather than for their pylab wrappers), use two question marks > to view the source code. > > To see available functions or attributes, use tab completion. > > Eric > > > > > > and there it was, what the available linestyles. Again lesson > > learned, read the (available) documentation before asking the > > questions. It is sometimes confusing where to go for the > > documentation. > > > > Thanks, > > Jeremy > > Ooh, very nice. I'll try to incorporate those commands into my daily repertoire. Jeremy - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Equivalent to Gnuplot histeps style
On 10/18/07, Eric Firing <[EMAIL PROTECTED]> wrote: > Jeremy Conlin wrote: > > On 10/17/07, Charles Seaton <[EMAIL PROTECTED]> wrote: > >> Jeremy, > >> > >> I ran across the answer to this last week while searching the list for > >> info on datestr2num (both subjects happened to come up in the same > >> exchange). > >> > >> http://www.nabble.com/First-impression-from-a-new-user-tf1716894.html#a4662446 > >> > >> plot(x, y, linestyle='*steps*') > >> > >> Charles Seaton > > > > > > Well that's great! (I should have at least tried making such a plot > > before posting. Sorry.) How come I couldn't find it in the > > documentation? I can't find anything about available linestyles. Am > > I looking the wrong location? I am looking at users_guide_0.9.0.pdf > > The user's guide tends to lag. To find the latest features, look at the > CHANGELOG, the examples, and the docstrings. Ipython is a big help for > looking at docstrings and trying things out. Are you familiar with it? > > Eric > am familiar with IPython and use it all the time as a replacement for the standard Python interpreter. I don't always use the extra features it offers. I just did help pylab.plot and there it was, what the available linestyles. Again lesson learned, read the (available) documentation before asking the questions. It is sometimes confusing where to go for the documentation. Thanks, Jeremy - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Equivalent to Gnuplot histeps style
On 10/17/07, Charles Seaton <[EMAIL PROTECTED]> wrote: > Jeremy, > > I ran across the answer to this last week while searching the list for > info on datestr2num (both subjects happened to come up in the same > exchange). > > http://www.nabble.com/First-impression-from-a-new-user-tf1716894.html#a4662446 > > plot(x, y, linestyle='*steps*') > > Charles Seaton Well that's great! (I should have at least tried making such a plot before posting. Sorry.) How come I couldn't find it in the documentation? I can't find anything about available linestyles. Am I looking the wrong location? I am looking at users_guide_0.9.0.pdf Thanks again, Jeremy - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Equivalent to Gnuplot histeps style
I am a recent switcher to matplotlib from gnuplot so please forgive me if I post often. I am currently looking to see if there is a similar matplotlib plotting style like gnuplots "histeps". An example is: http://gnuplot.sourceforge.net/demo_4.2/random.4.png As I searched through the email list archives, it seemed like John was looking at adding "steps" as a linestyle to matplotlib. The email is a few years old http://sourceforge.net/mailarchive/message.php?msg_id=4158CE19.3060601%40gemini.edu I was wondering if anything came from this or if I need to figure out something on my own. Thanks in advance. Jeremy - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users