Re: [Matplotlib-users] plot with marker color coded according to z-value
On Fri, Oct 19, 2012 at 11:08 PM, elmar werling el...@net4werling.de wrote: vmin=min(z), vmax=max(z) A suggestion, when dealing with arrays, it is generally faster to use the numpy function to compute the max and min, either np.max(z) or z.max(), than the standard Python one. -- 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] mpl command-line utilities
I also think that would be useful. It would, for example, allow to generate preview plots from other languages, without interfacing them to Python. It must be said that MPL is actually quite nice looking in the default settings for basic plotting, and this is an nice feature that can exploit. I have seen many pieces of code using SuperMongo for plotting. I find it absolutely ugly, and super expensive, but it is probably the easier plotting system to call from FORTRAN (or, at least, it was). On Wed, Oct 17, 2012 at 3:15 PM, Michael Droettboom md...@stsci.edu wrote: I think this could be very useful -- and might help increase the user base beyond the Python community. As I, and most of us on this list, are quite comfortable with Python, I don't think I'd use it myself, but I certainly see the utility of it. Mike On 10/17/2012 06:38 AM, Damon McDougall wrote: All, I was brain-storming yesterday and I wanted to test the waters to see if people would find it useful. Currently, GNU plotutils comes with command-line utilities such as `graph` to create quick and dirty line plots like this: http://www.gnu.org/software/gsl/manual/html_node/DWT-Examples.html. I think even gnuplot might be similar. How do people feel about perhaps adding a matplotlib version, mocking the same calling signature as graph? I think the most important question is: would it be useful? -- 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 -- 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] installating matplotlib in mac 10.7.4 for python 2.6
On Sun, Oct 14, 2012 at 3:42 AM, Paul Tremblay paulhtremb...@gmail.com wrote: You don't want to install for python 2.6. Python 2.6 is out of date at this point. I disagree. Most of the tools and libraries for 2.6 are available for 2.7 and viceversa (they are quite similar), but not all of them. In fact, in my experience, I have found more compatibility for 2.6 than for 2.7. In most practical scenarios, they will be just the same, but if all your work has been developed in 2.6 and you are not aware of the changes introduced by 2.7, it may be unwise to switch uncarefully (even though the Python deprecation policy is supposed to minimise this kind of problems). Lulu, if you just want something that works, you can use macports (macports.org), and install everything from there. Easy and fail proof. -- 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] installating matplotlib in mac 10.7.4 for python 2.6
in the terminal type: sudo port install py26-python sudo port install py26-matplotlib and there you are! On Sun, Oct 14, 2012 at 5:37 AM, lulu lauracur...@me.com wrote: Okay -- that's good to know. I've just installed macports, but am not sure how to go about using matplotlib in my python 2.6 - or even 2.7 at this point becuase I installed that version too. I also installed xcode geez - this is getting s confusing! -- View this message in context: http://matplotlib.1069221.n5.nabble.com/installating-matplotlib-in-mac-10-7-4-for-python-2-6-tp39436p39440.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- 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 -- 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] Corrupted percent signs in labels
On Windows it works just fine. Just a wild guess, can you try to make it a raw string? plt.xlabel(r'Percent [%]') On Tue, Oct 9, 2012 at 10:45 PM, Francesco Montesano franz.berges...@gmail.com wrote: Hi 2012/10/9 Nikolaus Rath nikol...@rath.org Hello, For some reason, my matplotlib isn't able to print percent signs ('%') properly: [1] inspiron:~/tmp# cat mplbug.py import matplotlib import matplotlib.pyplot as plt import numpy as np print matplotlib.__version__ plt.plot(np.arange(10), np.arange(10)**2) plt.xlabel('Percent [%]') plt.savefig('mplbug.pdf') [0] inspiron:~/tmp# python mplbug.py 1.1.1rc2 I have attached the resulting PDF. For some reason, the slash in the percent sign becomes a triangle that partially covers the upper left circle. Known bug? Any workarounds that don't require upgrading (I'd like to stick with the Debian package)? confirmed for pdf and eps figures. For jpg and png, as well as the matplotlib window with TkAgg the percentage looks fine. matplotlib version: 1.1.1 shipped with kubuntu 12.10 Francesco Thanks, -Nikolaus -- »Time flies like an arrow, fruit flies like a Banana.« PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C -- 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 -- 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 -- 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] python question from matlab user
On Sunday, September 9, 2012, Eric Firing wrote: Regarding the need to pre-allocate: yes, matlab is slicker in this regard, and every now and then there is discussion about implementing equivalent behavior in numpy, or in an add-on module. Technically, you don´t have to preallocate the memory, but every time you expand your array, the whole of it will be copied to a new contiguous piece of memory. This works, but it can be slow if you do it many times, or you are handling big data. Using a Python list is not much more flexible, but you could use carrays (for chunked arrays), that are structures NumPyArrays-compatible (AFAIK) that are stored non contiguosly in memory. Adding data only needs to move one of those small pieces, instead of the whole array. -- 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] ValueError: x and y must have same first dimension
In the example you provide, bins is returned by the hist command, whereas in your code, bins is a number that you defined as 20. So, change: bins = 20 plt.hist(C, bins, ... by: nbins = 20 n, bins, patches = plt.hist(C, nbins, ... As a side comment, your data loading is too complex, and fail prone. I suggest you to have a look at the numpy function for that, loadfromtxt or (I like it more), genfromtxt. It would be something like: data=np.genfromtxt(F, delimiter=' ') C=data[:,3] Much easier, and way faster. Regards, David. On Fri, Jul 27, 2012 at 4:13 AM, surfcast23 surfcas...@gmail.com wrote: Hi I have a code to plot a histogram and I am trying to add a best fit line following this example http://matplotlib.sourceforge.net/examples/pylab_examples/histogram_demo.html but run into this error Traceback (most recent call last): File /home/Astro/count_Histogram.py, line 54, in module l = plt.plot(bins, y, 'r--', linewidth=1) File /usr/lib/pymodules/python2.7/matplotlib/pyplot.py, line 2467, in plot ret = ax.plot(*args, **kwargs) File /usr/lib/pymodules/python2.7/matplotlib/axes.py, line 3893, in plot for line in self._get_lines(*args, **kwargs): File /usr/lib/pymodules/python2.7/matplotlib/axes.py, line 322, in _grab_next_args for seg in self._plot_args(remaining, kwargs): File /usr/lib/pymodules/python2.7/matplotlib/axes.py, line 300, in _plot_args x, y = self._xy_from_xy(x, y) File /usr/lib/pymodules/python2.7/matplotlib/axes.py, line 240, in _xy_from_xy raise ValueError(x and y must have same first dimension) ValueError: x and y must have same first dimension My Code import matplotlib.pyplot as plt import math import numpy as np import mpl_toolkits.mplot3d.axes3d import matplotlib.mlab as mlab counts = [] F = '/home/Astro/outfiles/outmag21_5dr_38_68.txt' f = open(F) for line in f: if line != ' ': columns = line.split() count = columns[3] count = int(count) counts.append(count) C = np.array(counts, dtype=float) avg = sum(C)/len(C) diff = C-avg sigma = np.sqrt((1./len(C))*(diff**2)) bins = 20 plt.hist(C, bins, range=None, normed=False, weights=None, cumulative=False, bottom=None, histtype='bar', align='mid', orientation='vertical', rwidth=None, log = False, color=None, label=None) plt.title() plt.text(25,20,'M -21.5' '\n' 'N Halos 3877' '\n' 'Length Cell 38.68Mpc' '\n' 'N Cells 269' '\n' 'Avg Halo per Cell 14.35 ') plt.xlabel(Halos/Cell) plt.ylabel(Number Cells with N Halos) y = mlab.normpdf( bins, avg, sigma) print(len(y)) l = plt.plot(bins, y, 'r--', linewidth=1) plt.show() My first question is do x and y refer to the values in l = plt.plot(bins, y, 'r--', linewidth=1) which for my case are bins and y? if that is the case how can I get then to be the same first dimension? -- View this message in context: http://old.nabble.com/ValueError%3A-x-and-y-must-have-same-first-dimension-tp34218704p34218704.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- 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
Re: [Matplotlib-users] ValueError: x and y must have same first dimension
On Fri, Jul 27, 2012 at 9:57 PM, surfcast23 surfcas...@gmail.com wrote: y = mlab.normpdf( nbins, avg, sigma) l = plt.plot(nbins, y, 'r--', linewidth=1) plt.show() You should not change bins there, as you are evaluating the gaussian function at different values. Also, sigma is a vector, but it should be an scalar: sigma = np.sqrt((1./len(C))*(diff**2)) should be sigma = np.sum(np.sqrt((1./len(C))*(diff**2)))# The sum of the previous But, much better, you can change the three lines of code by: avg=np.mean(C) sigma=np.std(C) They are way faster and more numerically accurate and stable. As a rule of thumb, if you want to do something simple, think that there should be an easy way of doing it. And if it is something people do every day (like taking the mean or the std of a vector, or loading from a txt file), there should be a very easy way of doing it. :-) And it would probably be faster and more flexible than any naive implementation. Good luck with your galaxies! -- 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] ValueError: x and y must have same first dimension
I guess it is showing, but you have many data points, so the gaussian is too small down there. You have to increase its values to make both areas fit: plt.plot(bins, N*(bins[1]-bins[0])*y, 'r--', linewidth=1) And you will get a nice gaussian fitting your data. On Fri, Jul 27, 2012 at 11:12 PM, surfcast23 surfcas...@gmail.com wrote: Thanks for catching that sigma was still a vector! I am no longer getting the errors, but the best fit line is not showing up.Is there something else I am missing ? BTW thanks for the heads up on the np.mean and np.standard functions. Khary Daπid wrote: On Fri, Jul 27, 2012 at 9:57 PM, surfcast23 surfcas...@gmail.com wrote: y = mlab.normpdf( nbins, avg, sigma) l = plt.plot(nbins, y, 'r--', linewidth=1) plt.show() You should not change bins there, as you are evaluating the gaussian function at different values. Also, sigma is a vector, but it should be an scalar: sigma = np.sqrt((1./len(C))*(diff**2)) should be sigma = np.sum(np.sqrt((1./len(C))*(diff**2)))# The sum of the previous But, much better, you can change the three lines of code by: avg=np.mean(C) sigma=np.std(C) They are way faster and more numerically accurate and stable. As a rule of thumb, if you want to do something simple, think that there should be an easy way of doing it. And if it is something people do every day (like taking the mean or the std of a vector, or loading from a txt file), there should be a very easy way of doing it. :-) And it would probably be faster and more flexible than any naive implementation. Good luck with your galaxies! -- 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 -- View this message in context: http://old.nabble.com/ValueError%3A-x-and-y-must-have-same-first-dimension-tp34218704p34222788.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- 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
Re: [Matplotlib-users] ValueError: x and y must have same first dimension
On Sat, Jul 28, 2012 at 12:22 AM, surfcast23 surfcas...@gmail.com wrote: Am I reading (bins[1]-bins[0]) correctly as taking the difference between what is in the second and first bin? Yes. I am multipliying the width of the bins by their total height. Surely there are cleaner and more general ways (say, when the bins are of different width), but this one does the trick for most cases. And, if you have many data points, you can increase the number of bins (typically the square root of the number of points, if you have enough density) and get a more precise profile. In that case you would want to change the parameter of hist histype='stepfilled' -- 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] How to plot only a legend?
On Thu, Jul 26, 2012 at 5:05 PM, Andreas Hilboll li...@hilboll.de wrote: That's really easy :) I could live with this solution, applying some external tool like pdfcrop to the result. If you can use other output, you can generate a png image, which would be easier to cut (even inside MPL.image). This, without entering in more complicated issues, that I don't know if they are even possible. -- 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] Additional line styles - comparison excel chart
On Mon, Jul 16, 2012 at 11:09 AM, Benjamin Jonen bjo...@gmail.com wrote: 2) The coloring and the way the lines curve around looks very nice to me. I remember that the Excel charts did not have this nice look before Excel 2007. Can I achieve similar effects with matplotlib? I'm not really sure what creates this nice look, so this question is of course a little fuzzy. Maybe you are thinking about the smoothness of the curves. Even you have spaced points, they don't do sharp edges. In my opinion, for scientific research, they shouldn't be concealed in the general case, and this is, I think, the main target of MPL. Nevertheless, if in your case it makes sense and you want them to be smooth, you can do it through SciPy, applying a interpolation scheme. tck=scipy.interpolate(datax, datay) datax_n=np.arange(datax.min(), datax.max(), len(datax)*20) datay_n=sicpy.interpolate(splev(datax_n,tck,der=0) And then you plot datax_n and datay_n. http://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html#spline-interpolation-in-1-d-procedural-interpolate-splxxx -- 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] histogram scaling
I don't know if there is any reason for not having it, but as a workaround, you could use np.hist to get the data (syntax is the same as mpl.hist and returns the same numbers, but without drawing) and then renormalise and plot with mpl.bars. On Thu, Jul 12, 2012 at 4:42 PM, Alan G Isaac alan.is...@gmail.com wrote: This is essentially a query about why certain histogram types are not offered. I can see two possible answers: haven't gotten to them, or, don't want to offer them (e.g., they're bad practice). I will choose Stata as a point of comparison. http://www.stata.com/help.cgi?hist The types are density, fraction, frequency, and percent. Frequency corresponds of mpl's normed=False. Density corresponds of mpl's normed=True. Today I wanted the 'fraction' type, but mpl did not offer it. (Note that because of other elements of the graph, hacks like replacing the ticklabels won't work nicely.) If there is not sentiment against offering these types, I suggest that the `normed` keyword accept strings, including fraction and percent, and that `hist` be extended to produce these types. Cheers, Alan Isaac -- 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
[Matplotlib-users] Typing \H{o} in LaTeX
Hello, I am trying to type Erdős in the title of a figure. I am using the LaTeX command Erd\H{o}s, as it works in normal latex documents both in text and math mode, but it malfunctioning putting the two lines on the d. To obtain the proper typeset, I have to write: plt.title(r$Erdo\H s$) This behaviour is not the same as standard LaTeX. Regards, David. -- 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] logairthmic contour plot
If all your values are positive (and you are sure of it), you could use the SymmetricalLogScale It uses log scale for large values (both positive and negative), and linear for small ones. http://matplotlib.sourceforge.net/devel/add_new_projection.html I believe there is a way to do it without going symetrical (ie, only defined for positive values), but I am unable to find it. On Wed, Jun 13, 2012 at 7:31 PM, jonasr jonas.rueb...@web.de 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 ? thank you -- View this message in context: http://old.nabble.com/logairthmic-contour-plot-tp34007155p34007155.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- 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
Re: [Matplotlib-users] logairthmic contour plot
First, this is another topic, so please, change the subject of the message so it doesn't get messed up with others (and possible help lost in the process). Now, you are indeed plotting one dot at the time and generating a label for it. If you don't want that, you have to plot the whole list at the time: x=[rand() for i in xrange(10)] y=[rand() for i in xrange(10)] scatter(x,y, label='points') legend() show() where the definition of x includes a list comprehension (equivalent at for i in xrange(10): x.append(rand()) ). On another topic, people are not usually fan of using from MODULEX import *, as it can turn into poor code and name collisions. It is nicer if you write import pylab as plt, and refer to the functions as plt.scatter and so on. Regards. On Wed, Jun 13, 2012 at 9:21 PM, Steven Boada bo...@physics.tamu.edu wrote: 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 -- 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] Gallery broken link
http://matplotlib.sourceforge.net/examples/api/demo_affine_image_00.html This link of the gallery example is broken (error 404). It corresponds to the third example of the fourth row. -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Memory increasing while plotting in loop
I can run the script you provided up to 600 without noticing any memory growth (TkAgg backend by default). Using the WxAgg, the memory leak appears. If you don't explicitly need WxAgg, I would recommend using TkAgg, or better Agg if you are not showing the figures. If it is not the case, more expert and wiser people will have to come to help. On Thu, Jun 16, 2011 at 11:41 AM, Alain Francés frances08...@itc.nl wrote: Hi, http://old.nabble.com/file/p31858795/ErrorMsg.png indeed I forgot to remove these line from previous tests, sorry. However it doesn't affect the code behaviour, the problem remains (it fills the RAM memory and raises a memory error, see img in att.). Alain Davidmh wrote: You are importing pylab again before each plot. You have loaded it before. for i,t in enumerate(times): import pylab as pl # --ERASE THIS On Wed, Jun 15, 2011 at 12:10 PM, Alain Pascal Frances frances17...@itc.nl wrote: Hi, I have a script that creates and saves figures in a loop. The memory is increasing at each figure and is not released back, rising a Memory error. I used the close() function on the figure object as well as gc.collect(), but no effect. I searched on the net and found a similar problem at http://stackoverflow.com/questions/3623600/python-matplotlib-memory-not-being-released-when-specifying-figure-size. The problem here was solved using the close() function but in my case, as refered before, it doens't work (see code below). I'm using Python 2.6.6, matplotlib 1.0.1, WXagg as backend, on windows7. Thanks for help! Alain CODE: import pylab as pl import os, tempfile def plot_density(filename,i,t,psi_Na): pl.figure(figsize=(8,6)) pl.imshow(abs(psi_Na)**2,origin = 'lower') filename = os.path.join(tempfile.gettempdir(), filename + '_%04d.png'%i) pl.savefig(filename) pl.clf() pl.close() if __name__ == __main__: x = pl.linspace(-6e-6,6e-6,128,endpoint=False) y = pl.linspace(-6e-6,6e-6,128,endpoint=False) X,Y = pl.meshgrid(x,y) k = 100 omega = 200 times = pl.linspace(0,100e-3,100,endpoint=False) for i,t in enumerate(times): import pylab as pl psi_Na = pl.sin(k*X-omega*t) plot_density('wavefunction',i,t,psi_Na) print i -- EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- View this message in context: http://old.nabble.com/Memory-increasing-while-plotting-in-loop-tp31850163p31858795.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Memory increasing while plotting in loop
You are importing pylab again before each plot. You have loaded it before. for i,t in enumerate(times): import pylab as pl # --ERASE THIS On Wed, Jun 15, 2011 at 12:10 PM, Alain Pascal Frances frances17...@itc.nl wrote: Hi, I have a script that creates and saves figures in a loop. The memory is increasing at each figure and is not released back, rising a Memory error. I used the close() function on the figure object as well as gc.collect(), but no effect. I searched on the net and found a similar problem at http://stackoverflow.com/questions/3623600/python-matplotlib-memory-not-being-released-when-specifying-figure-size. The problem here was solved using the close() function but in my case, as refered before, it doens't work (see code below). I'm using Python 2.6.6, matplotlib 1.0.1, WXagg as backend, on windows7. Thanks for help! Alain CODE: import pylab as pl import os, tempfile def plot_density(filename,i,t,psi_Na): pl.figure(figsize=(8,6)) pl.imshow(abs(psi_Na)**2,origin = 'lower') filename = os.path.join(tempfile.gettempdir(), filename + '_%04d.png'%i) pl.savefig(filename) pl.clf() pl.close() if __name__ == __main__: x = pl.linspace(-6e-6,6e-6,128,endpoint=False) y = pl.linspace(-6e-6,6e-6,128,endpoint=False) X,Y = pl.meshgrid(x,y) k = 100 omega = 200 times = pl.linspace(0,100e-3,100,endpoint=False) for i,t in enumerate(times): import pylab as pl psi_Na = pl.sin(k*X-omega*t) plot_density('wavefunction',i,t,psi_Na) print i -- EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting in loop problem, not refreshing
I am using MPL 1.0.1 with Python 2.6 over Windows XP and it works. I would like to add an advice: range(n) creates a list of size n, and stores it in memory. But in your code you are only using one number at a time. Python has a better instruction: xrange. It works exactly like range, but doesn't create the list; it will return sequentially every number without the need of storing all at once. In this simple program it makes no difference, but when you go bigger, it will. David. On Sun, Jun 5, 2011 at 3:28 AM, Joe Kington jking...@wisc.edu wrote: Your code should work (and does on my system)... What backend, version of matplotlib, OS, etc are you running? On Sat, Jun 4, 2011 at 4:54 PM, Armin G armi...@gmail.com wrote: Hi everyone , I know this has been posted several times now, But I could not understand qietly why my simple code does not work. here is the code: http://old.nabble.com/file/p31775254/LinearConvection.py LinearConvection.py The problem in detail: In the solver loop ( the outer loop) , The plot should be updated after every time step, but it stays the same. I'm a complete noob in python, so excuse my simple communicating language. thanks alot, Armin -- View this message in context: http://old.nabble.com/Plotting-in-loop-problem%2C-not-refreshing-tp31775254p31775254.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Discover what all the cheering's about. Get your free trial download today. http://p.sf.net/sfu/quest-dev2dev2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Discover what all the cheering's about. Get your free trial download today. http://p.sf.net/sfu/quest-dev2dev2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Discover what all the cheering's about. Get your free trial download today. http://p.sf.net/sfu/quest-dev2dev2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] strange behavior with imshow
I have checked with all the interpolation modes and the only one that behaves badly is 'nearest'. There are them: http://dl.dropbox.com/u/1351211/Interpolation_modes.zip On Mon, Apr 18, 2011 at 12:46 PM, Emanuele Passera emanuele.pass...@treuropa.com wrote: Hello everybody, I am experiencing a strange behavior with the imshow() function when using the nearest interpolation method. Executing the code listed below, I obtain a good image when using the bilinear interpolation method and a totally white image when using the nearest interpolation method. I have attached the input data buffer and the resulting images too. import numpy as n import pylab as p # input data dataFile = /users/lelepass/python/test_imagesc/buffer.float samples = 15 lines = 39 imagescCanvasXDim = 800 imagescCanvasDpi = 100 data_aspect_ratio = 0.75707855955290304 vMin = -3.3467740682968197 vMax = 0.65322593170318011 outImageFileBilinear = /users/lelepass/python/test_imagesc/subpxAzBilinear.png outImageFileNearest = /users/lelepass/python/test_imagesc/subpxAzNearest.png # loading input data file s = file(dataFile, 'rb').read() data = n.fromstring(s, 'f') data.shape = lines, samples data = n.transpose(data) # image canvas dimension setting xAxisInches = float(imagescCanvasXDim) / float(imagescCanvasDpi) yPixelsDim = imagescCanvasXDim * data_aspect_ratio yAxisInches = float(yPixelsDim) / float(imagescCanvasDpi) # bilinear image # # image canvas canvasObj = p.figure(facecolor=w, edgecolor=w, figsize=(xAxisInches, yAxisInches), frameon=True, dpi=imagescCanvasDpi) # axis setting axisLocationList = [0,0,1,1] axisObj = canvasObj.add_axes(axisLocationList) axisObj.axesPatch.set_alpha(1) # colormap colorMap = p.cm.jet_r # bilinear image drawing p.imshow(data, cmap=colorMap, vmin=vMin, vmax=vMax, interpolation=bilinear, origin=lower, aspect=auto, alpha=1) reversing = axisObj.set_ylim(axisObj.get_ylim()[::-1]) # bilinear image saving and closing canvasObj.savefig(outImageFileBilinear, dpi=imagescCanvasDpi) p.close() # nearest image # # image canvas canvasObj = p.figure(facecolor=w, edgecolor=w, figsize=(xAxisInches, yAxisInches), frameon=True, dpi=imagescCanvasDpi) # axis setting axisLocationList = [0,0,1,1] axisObj = canvasObj.add_axes(axisLocationList) axisObj.axesPatch.set_alpha(1) # colormap colorMap = p.cm.jet_r # nearest image drawing p.imshow(data, cmap=colorMap, vmin=vMin, vmax=vMax, interpolation=nearest, origin=lower, aspect=auto, alpha=1) reversing = axisObj.set_ylim(axisObj.get_ylim()[::-1]) # nearest image saving and closing canvasObj.savefig(outImageFileNearest, dpi=imagescCanvasDpi) p.close() I use matplotlib to generate a lot of images in batch mode and this behavior appear not to be deterministic. It seems to depend on the input data buffer. Can anyone help me ? I use Linux openSUSE 11.3 (x86_64) Linux sat1 2.6.34.7-0.7-default #1 SMP 2010-12-13 11:13:53 +0100 x86_64 x86_64 x86_64 GNU/Linux Python 2.6.5 numpy 1.5.1 matplotlib 1.0.1 with backend Agg v2.2 If it can be of some help this strange behavior does not appear with a system Linux Ubuntu 9.10 Linux joshua 2.6.28-11-server #42-Ubuntu SMP Fri Apr 17 02:48:10 UTC 2009 i686 GNU/Linux Python 2.6.4 numpy 1.3.0 matplotlib 0.99.0 with backend Agg v2.2 Executing the script with verbosity I get the subsequent output python /users/lelepass/python/test_imagesc/test.py --verbose-helpful $HOME=/users/lelepass CONFIGDIR=/users/lelepass/.matplotlib Bad key numerix on line 30 in /users/lelepass/.matplotlib/matplotlibrc. You probably need to get an updated matplotlibrc file from http://matplotlib.sf.net/_static/matplotlibrc or from the matplotlib source distribution matplotlib data path /usr/lib64/python2.6/site-packages/matplotlib/mpl-data loaded rc file /users/lelepass/.matplotlib/matplotlibrc matplotlib version 1.0.1 verbose.level helpful interactive is False units is True platform is linux2 Using fontManager instance from /users/lelepass/.matplotlib/fontList.cache backend agg version v2.2 findfont: Matching :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium to Bitstream Vera Sans (/usr/lib64/python2.6/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf) with score of 0.00 Thank you all. Bye. Emanuele Passera Software Engineer Tele-Rilevamento Europa - T.R.E. srl Via Vittoria Colonna, 7 20149 Milano – Italia Tel.: +39.02.4343.121 - Fax: +39.02.4343.1230 emanuele.pass...@treuropa.com - www.treuropa.com -- This communication, that may contain confidential and/or legally privileged information, is intended solely for the use of the intended addressees. Opinions, conclusions and other information contained in this
[Matplotlib-users] Pyplot interactive mode. Issue or misuse?
Hello. I want to plot the result of a calculation, show it, modify and repeat. I have tried with pyplot interactive mode, see code: http://pastebin.com/jsdsLN4z The first plot shows fine, but from now on, all the new plots appear in a new window and all of them are blank --including the first one! I guess I am missing something. What could it be? I am using Matplotlib 1.0.1 on Python2.5 and Windows XP. Thanks, David. -- Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] show(), the state of the art
Hello. It is stated that show() should be the last function in a script, as long as it will stop the execution of the program. Nevertheless, I have seen that the current behavior is just a pause in the flow, and it will be restored when the window is closed. The documentation says: Many users are frustrated by show because they want it to be a blocking call that raises the figure, pauses the script until the figure is closed, and then allows the script to continue running until the next figure is created and the next show is made.[...] This is not what show does and unfortunately, because doing blocking calls across user interfaces can be tricky, is currently unsupported, though we have made some progress towards supporting blocking events. My question is: what is the real state of the art of the feature? Is this something that could be safely exploited, or just an experimental property not recommended? I am using Matplotlib v.1.0 and Python 2.5 over Windows XP and TkAgg backend. Thanks in advance. -- Nokia and ATT present the 2010 Calling All Innovators-North America contest Create new apps games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] show(), the state of the art
On Tue, Nov 2, 2010 at 12:49 PM, David Kremer david.kremer...@gmail.com wrote: Personally I used show() yesterday, and it blocks the execution until the figure's window is closed. It is of perfect convenience I think, as a default behavior. Yes, this is the optimal behavior, but it is not fully implemented, as seen in the documentation. -- Nokia and ATT present the 2010 Calling All Innovators-North America contest Create new apps games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Equation
If you are curious, here is what Mathematica can tell about the integral (assuming everything constant but z): http://pastebin.com/Gir3XZBe On Wed, Oct 13, 2010 at 4:28 PM, Waléria Antunes David waleriantu...@gmail.com wrote: Hi all, I know here is a group for matplotlib, but can anyone help me? I need to pass this integral equation for for scipy.integrate pack for python. My integral equation is attached. Can anyone help me? Thanks Waleria. -- Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Download new Adobe(R) Flash(R) Builder(TM) 4 The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly Flex(R) Builder(TM)) enable the development of rich applications that run across multiple browsers and platforms. Download your free trials today! http://p.sf.net/sfu/adobe-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Basemap: High resolution output cutout marks on contours
On Mon, Oct 4, 2010 at 11:36 AM, nickj nickja...@gmail.com wrote: To better illustrate my problem, here is a screenshot with added red lines pointing to the odd slicing I get around the contours: http://www.bigoceans.com/slices.png A low-tech option is to plot first all the oceans in light color, then overplot the next color for all values (corresponding to that one an higher) and so on. For your performance issues, make sure you are not displaying the image, but saving it directly to disk. -- Virtualization is moving to the mainstream and overtaking non-virtualized environment for deploying applications. Does it make network security easier or more difficult to achieve? Read this whitepaper to separate the two and get a better understanding. http://p.sf.net/sfu/hp-phase2-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] WebP support
On Sat, Oct 2, 2010 at 7:39 PM, Jouni K. Seppänen j...@iki.fi wrote: And yet, we still allow for saving to jpegs. Wow, I didn't know. Last time I tried that I got a traceback, and assumed that it was not supported exactly because jpeg is a nonsensical format for most graphs. Don't forget MPL is also capable of dealing with photographs, and it is really useful. I am currently working in two scientific projects based on this capability, and for some issues could be useful to save JPGs. -- 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] Z channel
No, it is not. The Z channel is an aditional number per pixel that haves the information of the deepness. When you render an image you can keep this information for adding mist, without rendering again, for example. I don't know if I have been able to explain myself, my mind is not really clear today. ;-) On Thu, Sep 16, 2010 at 5:12 PM, Benjamin Root ben.r...@ou.edu wrote: On Thu, Sep 16, 2010 at 12:03 AM, Daπid davidmen...@gmail.com wrote: Does MPL support in any way the Z channel? If not, is there any possibility to use it? For example, to create a parallel matrix of the same dimensions of the image with the values of Z in each pixel. Thank you very much. David. David, I am not entirely certain I understand what you mean. Perhaps you are speaking of Z-order? Using the zorder kwarg in various plotting commands, I can manually control the order in which elements are rendered. When figures are saved, depending on the file format, this information can get flattened, and therefore lost, and other formats (most of the vector-based formats) maintain this information, I believe. Does that help? Ben Root -- 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] Level surface of a function of 3 variables
I think you can make it with pyplot.contourf() and the argument V http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.contour contour(Z,V) contour(X,Y,Z,V) draw contour lines at the values specified in sequence V On Wed, Sep 15, 2010 at 9:02 PM, Luke hazelnu...@gmail.com wrote: I have a function of three variables and am interested in plotting the zero level surface: f(x,y,z) = 0 Is there a simple way to plot this level surface in 3-D without having to resort to meshing up x and y, and solving for the z that satisfies the equation? I can do this, but it gets messy because there are anywhere from 0 to 2 solutions to the equation for each point in the x-y plane. The mplot3d examples all seem to calculate the z-data simply from simple functions of x and y. Thanks, ~Luke -- 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 -- 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] Z channel
Does MPL support in any way the Z channel? If not, is there any possibility to use it? For example, to create a parallel matrix of the same dimensions of the image with the values of Z in each pixel. Thank you very much. David. -- 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] Reduce image size
If it is only one image, an easy low-tech workaround is to save it as PNG and then put it into a PDF. This way, you only have to load one element. On Mon, Aug 30, 2010 at 11:36 PM, Jeremy Conlin jlcon...@gmail.com wrote: 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 -- 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] CMYK images
Image Magick and Inkscape seem to work for this. Probably the first one is easier to automatize in batch processing. On Thu, Aug 26, 2010 at 4:21 PM, Michael Droettboom md...@stsci.edu wrote: matplotlib does not have any built-in support for any color spaces other than RGB. You would need to use an external tool (if such a thing exists) to convert color spaces. Mike On 08/26/2010 10:06 AM, Michele De Stefano wrote: Is it possible to export EPS images with the CMYK color scheme ? There are several technical journals that require this format (for example Geophysiscs, one of the most important geophysical journals, The Leading Edge, and, I think, Geophysical Prospecting only to cite some of them). -- Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA -- Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] saving animations
I cannot see what is wrong, but after saving each figure you should add plt.clf() in order to delete the image and preventing memory leaks, because MPL stores one image in top of the other. For the filecode I suggest you to use something like: savefig(head+str(filecode).zfill(digits)+format, dpi=205) filecode+=1 where head is the name, digits an int and format usually .png. Which backend are you using? Do you need it to be displayed on screen? If not, the backend Agg is best. Regards, David. On Wed, Aug 25, 2010 at 5:28 AM, David Pine djp...@gmail.com wrote: I am trying to save the frames from a matplotlib animation and I have a question that is undoubtedly based on a profound lack of understanding about how matplotlib/python works, but I'm hoping someone can offer me an explanation. The following code is excerpted from the animation examples animation_blit_wx.py. The example works fine unless I include the #* line meant to record the animations in included. If the line is included, the animated line is no longer drawn to the screen or to the sequence of plots I am trying to save. That is, the background is displayed and saved, but not the animated line. Why? def update_line(*args): global blit_time if update_line.background is None: update_line.background = canvas.copy_from_bbox(ax.bbox) # restore the clean slate background canvas.restore_region(update_line.background) # update the data line.set_ydata(npy.sin(x+update_line.cnt/10.0)) # just draw the animated artist ax.draw_artist(line) # just redraw the axes rectangle t = time.time() canvas.blit(ax.bbox) blit_time += time.time() - t #* plt.savefig('f' + str(update_line.cnt) + '.png') * if update_line.cnt == NBLITS: # print the timing info and quit frame_time = time.time() - tstart print '%d frames: %.2f seconds' % (NBLITS, frame_time) print '%d blits: %.2f seconds' % (NBLITS, blit_time) print print 'FPS: %.2f' % (NBLITS/frame_time) print 'BPS: %.2f' % (NBLITS/blit_time) sys.exit() update_line.cnt += 1 wx.WakeUpIdle() -- Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Animated artists not present in savefigged files
What I use to create animations is plainly: savefig(head+str(filecode).zfill(digits)+format, dpi=205) plt.clf() filecode+=1 where filecode is the name, digits an int and format usually .png. clf() is important in order to prevent memory leaks, because otherwise mpl stores all the figures one in top of the other, consuming a lot of resources once you have a several images. To stick all of them together, I use a video editor. On Mon, Aug 23, 2010 at 2:59 PM, Kim Hansen slaun...@gmail.com wrote: Hi list, I am using animated artists to generate an animation, where I save each step in the anmantion as a png using the savefig method of the figure instance after drawing the animated artists on a cached background and after fig.canvas.blit. What I see on screen are the updated animated artists being drawn, but only the cached background with subplots and axes and grid is being stored in the savefig commands called after the last blit. Why is only the background saved.? I am using matplotlib ver. 0.99.1 and the 'TkAgg' backend on a Win XP PC. Thanks in advance, Kim -- 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 -- 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] Issue with hist plotting
On Sat, Aug 14, 2010 at 10:19 PM, Eric Firing efir...@hawaii.edu wrote: The problem is that the alpha kwarg can never be other than a scalar in mpl at present, as far as I know. The error message from to_rgba was intended to be informative, but in this case it is misleading. Thanks for your response. I was following the logic for colors, which does accept lists. Anyway, the error message is diferent if I set the color or not, which is not logical. By the way, do you have any clue on the persistence of the problem until the IDLE is restarted? I mean, even with the code fixed, the error is still raised until IDLE is reopened. Thank you again, David. -- 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] Issue with hist plotting
Hello. I have had an issue trying to plot an histogram with Matplotlib. The line is: plt.hist([SNIa.angles, SNIbc.angles, SNII.angles], 11, range=[-pi, pi], normed=True,histtype='stepfilled',color=['g', 'r', 'b'],alpha=[1, 0.6, 1]) But the error is raised when I try to save the image. For completness, the whole program is here: http://nopaste.voric.com/paste.php?f=8zl9i4 If I call hist as stated above, I get the following error report: Traceback (most recent call last): File C:\Documents and Settings\David\Escritorio\Python\IAYC\Supernovae\final\Deprecated\supernovae_bug.py, line 35, in module plt.savefig('angular_merged_1bis.png') File C:\Python25\Lib\site-packages\matplotlib\pyplot.py, line 363, in savefig return fig.savefig(*args, **kwargs) File C:\Python25\Lib\site-packages\matplotlib\figure.py, line 1084, in savefig self.canvas.print_figure(*args, **kwargs) File C:\Python25\Lib\site-packages\matplotlib\backend_bases.py, line 1886, in print_figure **kwargs) File C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py, line 438, in print_png FigureCanvasAgg.draw(self) File C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py, line 394, in draw self.figure.draw(self.renderer) File C:\Python25\Lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\Python25\Lib\site-packages\matplotlib\figure.py, line 798, in draw func(*args) File C:\Python25\Lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\Python25\Lib\site-packages\matplotlib\axes.py, line 1934, in draw a.draw(renderer) File C:\Python25\Lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\Python25\Lib\site-packages\matplotlib\patches.py, line 366, in draw r, g, b, a = colors.colorConverter.to_rgba(self._facecolor, self._alpha) File C:\Python25\Lib\site-packages\matplotlib\colors.py, line 353, in to_rgba raise ValueError('to_rgba: Invalid rgba arg %s\n%s' % (str(arg), exc)) ValueError: to_rgba: Invalid rgba arg [ 0. 0.5 0. 1. ] alpha must be in range 0-1 If I delete the color declaring, I get instead: Traceback (most recent call last): File C:\Documents and Settings\David\Escritorio\Python\IAYC\Supernovae\final\Deprecated\supernovae_bug.py, line 35, in module plt.savefig('angular_merged_1bis.png') File C:\Python25\Lib\site-packages\matplotlib\pyplot.py, line 363, in savefig return fig.savefig(*args, **kwargs) File C:\Python25\Lib\site-packages\matplotlib\figure.py, line 1084, in savefig self.canvas.print_figure(*args, **kwargs) File C:\Python25\Lib\site-packages\matplotlib\backend_bases.py, line 1886, in print_figure **kwargs) File C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py, line 438, in print_png FigureCanvasAgg.draw(self) File C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py, line 394, in draw self.figure.draw(self.renderer) File C:\Python25\Lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\Python25\Lib\site-packages\matplotlib\figure.py, line 798, in draw func(*args) File C:\Python25\Lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\Python25\Lib\site-packages\matplotlib\axes.py, line 1934, in draw a.draw(renderer) File C:\Python25\Lib\site-packages\matplotlib\artist.py, line 55, in draw_wrapper draw(artist, renderer, *args, **kwargs) File C:\Python25\Lib\site-packages\matplotlib\patches.py, line 383, in draw renderer.draw_path(gc, tpath, affine, rgbFace) File C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py, line 117, in draw_path self._renderer.draw_path(gc, path, transform, rgbFace) TypeError: float() argument must be a string or a number And works fine without alpha statement. Any change in the other arguments does not make any difference on the behaviour. If I run it from the IDLE, once I get an error, I continue getting it even if the problematic part is fixed, until I restart the program. I am running Matplotlib 1.0.0 y Python 2.5 sobre WXP. I haven't find any reference to this in the documentation, so it seems to be a bug. Regards, David. -- 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