Re: [Matplotlib-users] Memory leak when using pyplot.ion() ?
On 14/10/2013 13:51, OCuanachain, Oisin (Oisin) wrote: Hi, I am having problems with a script. It runs a number of iterations and plots and saves a number of plots on each iteration. After the plots have been saved I issue the pyplot.close(‘all’) command so despite many plots being created only 4 should be open at any given time which should not cause any memory problems. When I run the script however I see the RAM usage gradually growing without bound and eventually causing the script to crash. Interestingly I have found if I comment out the pyplot.ion() and pyplot.ioff() the problem vanishes. So I do have a workaround but it would still be good to have this fixed in case I forget about it in future and loose another weekend’s work. My OS is Windows XP Service Pack 3 Python 2.6 Matplotlib 1.0.1 Is this actually a matplotlib problem or could it be a Windows problem as discussed here http://bugs.python.org/issue19246 ? -- Roses are red, Violets are blue, Most poems rhyme, But this one doesn't. Mark Lawrence -- October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60134071iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Trying to migrate to Python 3.2, Matplotlib 1.2.1
On 19/04/2013 04:03, John Ladasky wrote: Reading more, I realize that the way I was getting GUI output previously (with Python 2.7 and Matplotlib 1.1) was through wxPython. Unfortunately, it appears that wxPython's star is fading, and a Python 3-compatible version will not be written. In fact, wxPython hasn't released a new version in nine months. I'm surprised that you say this as months of work have gone into updating wxPython to make in Python 3 compatible. Please see http://wxpython.org/Phoenix/snapshot-builds/ for the latest and greatest. -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] MonthLocator doesn't honour rrule bymonthday -1 value for last day of month
I've found the solution. MonthLocator doesn't support the bysetpos argument that rrule can use. Thankfully from my POV the following two lines give me exactly what I want. rule = rrulewrapper(MONTHLY, bymonthday=(firstDate.day, -1), bysetpos=1) majorLocator = RRuleLocator(rule) Just wish I'd read the docs more carefully in the first place to save my time and yours. On 05/04/2013 10:17, Mark Lawrence wrote: On 04/04/2013 19:00, Mark Lawrence wrote: Sadly no :( I want the day of the month that I'm processing *OR* the last day. The worst case for this is obviously the 31st of each month. The rrule code I've given provides exactly that. When transferred to mpl that doesn't work. Best seen by changing the lines I gave originally to this. start = datetime.date(2013, 4, 5) until = datetime.date(2014, 4, 5) dates = rrule(MONTHLY, bymonthday=(5, -1), bysetpos=1, until=until) rrule output as follows. 2013-04-05 10:15:24 2013-05-05 10:15:24 2013-06-05 10:15:24 2013-07-05 10:15:24 2013-08-05 10:15:24 2013-09-05 10:15:24 2013-10-05 10:15:24 2013-11-05 10:15:24 2013-12-05 10:15:24 2014-01-05 10:15:24 2014-02-05 10:15:24 2014-03-05 10:15:24 Plot attached. On 04/04/2013 17:31, Phil Elson wrote: Hi Mark, Thanks for persevering :-) What is it you want to achieve? Is it that you just want the last day of each month as the located value? Changing your locator to: ax.xaxis.set_major_locator(MonthLocator(bymonthday = -1)) Seems to do the trick for me (I've never looked at the mpl date magic, so I can give no guarantees). HTH, On 4 April 2013 17:18, Mark Lawrence breamore...@yahoo.co.uk mailto:breamore...@yahoo.co.uk wrote: On 01/04/2013 14:48, Mark Lawrence wrote: On 29/03/2013 15:49, Mark Lawrence wrote: Hi all, From http://labix.org/python-dateutil To generate a rrule for the use case of a date on the specified day of the month, unless it is beyond the end of month, in which case it will be the last day of the month use the following: rrule(MONTHLY, bymonthday=(some_day, -1), bysetpos=1) This will generate a value for every calendar month regardless of the day of the month it is started from. Using bymonthday with MonthLocator gives ticks on the day given and the last day of the month, which looks extremely ugly. Code below demonstrates. from dateutil.rrule import * import datetime import matplotlib.pyplot as plt from matplotlib.ticker import FormatStrFormatter, MultipleLocator from matplotlib.dates import DateFormatter, MonthLocator, DayLocator start = datetime.date(2013, 3, 29) until = datetime.date(2014, 3, 29) dates = rrule(MONTHLY, bymonthday=(29, -1), bysetpos=1, until=until) for d in dates:print(d) dates = [start, until] values = [0, 1] plt.ylabel('Balance') plt.grid() ax = plt.subplot(111) plt.plot_date(dates, values, fmt = 'rx-') ax.xaxis.set_major_locator(MonthLocator(bymonthday = (dates[0].day, -1))) ax.xaxis.set_major_formatter(DateFormatter('%d/%m/%y')) ax.yaxis.set_major_formatter(FormatStrFormatter('£%0.2f')) ax.yaxis.set_minor_locator(MultipleLocator(5)) plt.axis(xmin=dates[0], xmax=dates[-1]) plt.setp(plt.gca().get_xticklabels(), rotation = 45, fontsize = 10) plt.setp(plt.gca().get_yticklabels(), fontsize = 10) plt.show() Seems an apt date to realise that I didn't say much :( Assuming that I'm correct would you like an issue raised on the bug tracker? If not please correct the mistake I've made, presumably in reading the docs, which I think are excellent by the way. Anybody? -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] MonthLocator doesn't honour rrule bymonthday -1 value for last day of month
On 01/04/2013 14:48, Mark Lawrence wrote: On 29/03/2013 15:49, Mark Lawrence wrote: Hi all, From http://labix.org/python-dateutil To generate a rrule for the use case of a date on the specified day of the month, unless it is beyond the end of month, in which case it will be the last day of the month use the following: rrule(MONTHLY, bymonthday=(some_day, -1), bysetpos=1) This will generate a value for every calendar month regardless of the day of the month it is started from. Using bymonthday with MonthLocator gives ticks on the day given and the last day of the month, which looks extremely ugly. Code below demonstrates. from dateutil.rrule import * import datetime import matplotlib.pyplot as plt from matplotlib.ticker import FormatStrFormatter, MultipleLocator from matplotlib.dates import DateFormatter, MonthLocator, DayLocator start = datetime.date(2013, 3, 29) until = datetime.date(2014, 3, 29) dates = rrule(MONTHLY, bymonthday=(29, -1), bysetpos=1, until=until) for d in dates:print(d) dates = [start, until] values = [0, 1] plt.ylabel('Balance') plt.grid() ax = plt.subplot(111) plt.plot_date(dates, values, fmt = 'rx-') ax.xaxis.set_major_locator(MonthLocator(bymonthday = (dates[0].day, -1))) ax.xaxis.set_major_formatter(DateFormatter('%d/%m/%y')) ax.yaxis.set_major_formatter(FormatStrFormatter('£%0.2f')) ax.yaxis.set_minor_locator(MultipleLocator(5)) plt.axis(xmin=dates[0], xmax=dates[-1]) plt.setp(plt.gca().get_xticklabels(), rotation = 45, fontsize = 10) plt.setp(plt.gca().get_yticklabels(), fontsize = 10) plt.show() Seems an apt date to realise that I didn't say much :( Assuming that I'm correct would you like an issue raised on the bug tracker? If not please correct the mistake I've made, presumably in reading the docs, which I think are excellent by the way. Anybody? -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- Minimize network downtime and maximize team effectiveness. Reduce network management and security costs.Learn how to hire the most talented Cisco Certified professionals. Visit the Employer Resources Portal http://www.cisco.com/web/learning/employer_resources/index.html ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] MonthLocator doesn't honour rrule bymonthday -1 value for last day of month
Sadly no :( I want the day of the month that I'm processing *OR* the last day. The worst case for this is obviously the 31st of each month. The rrule code I've given provides exactly that. When transferred to mpl that doesn't work. On 04/04/2013 17:31, Phil Elson wrote: Hi Mark, Thanks for persevering :-) What is it you want to achieve? Is it that you just want the last day of each month as the located value? Changing your locator to: ax.xaxis.set_major_locator(MonthLocator(bymonthday = -1)) Seems to do the trick for me (I've never looked at the mpl date magic, so I can give no guarantees). HTH, On 4 April 2013 17:18, Mark Lawrence breamore...@yahoo.co.uk mailto:breamore...@yahoo.co.uk wrote: On 01/04/2013 14:48, Mark Lawrence wrote: On 29/03/2013 15:49, Mark Lawrence wrote: Hi all, From http://labix.org/python-dateutil To generate a rrule for the use case of a date on the specified day of the month, unless it is beyond the end of month, in which case it will be the last day of the month use the following: rrule(MONTHLY, bymonthday=(some_day, -1), bysetpos=1) This will generate a value for every calendar month regardless of the day of the month it is started from. Using bymonthday with MonthLocator gives ticks on the day given and the last day of the month, which looks extremely ugly. Code below demonstrates. from dateutil.rrule import * import datetime import matplotlib.pyplot as plt from matplotlib.ticker import FormatStrFormatter, MultipleLocator from matplotlib.dates import DateFormatter, MonthLocator, DayLocator start = datetime.date(2013, 3, 29) until = datetime.date(2014, 3, 29) dates = rrule(MONTHLY, bymonthday=(29, -1), bysetpos=1, until=until) for d in dates:print(d) dates = [start, until] values = [0, 1] plt.ylabel('Balance') plt.grid() ax = plt.subplot(111) plt.plot_date(dates, values, fmt = 'rx-') ax.xaxis.set_major_locator(MonthLocator(bymonthday = (dates[0].day, -1))) ax.xaxis.set_major_formatter(DateFormatter('%d/%m/%y')) ax.yaxis.set_major_formatter(FormatStrFormatter('£%0.2f')) ax.yaxis.set_minor_locator(MultipleLocator(5)) plt.axis(xmin=dates[0], xmax=dates[-1]) plt.setp(plt.gca().get_xticklabels(), rotation = 45, fontsize = 10) plt.setp(plt.gca().get_yticklabels(), fontsize = 10) plt.show() Seems an apt date to realise that I didn't say much :( Assuming that I'm correct would you like an issue raised on the bug tracker? If not please correct the mistake I've made, presumably in reading the docs, which I think are excellent by the way. Anybody? -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- Minimize network downtime and maximize team effectiveness. Reduce network management and security costs.Learn how to hire the most talented Cisco Certified professionals. Visit the Employer Resources Portal http://www.cisco.com/web/learning/employer_resources/index.html ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] MonthLocator doesn't honour rrule bymonthday -1 value for last day of month
On 29/03/2013 15:49, Mark Lawrence wrote: Hi all, From http://labix.org/python-dateutil To generate a rrule for the use case of a date on the specified day of the month, unless it is beyond the end of month, in which case it will be the last day of the month use the following: rrule(MONTHLY, bymonthday=(some_day, -1), bysetpos=1) This will generate a value for every calendar month regardless of the day of the month it is started from. Using bymonthday with MonthLocator gives ticks on the day given and the last day of the month, which looks extremely ugly. Code below demonstrates. from dateutil.rrule import * import datetime import matplotlib.pyplot as plt from matplotlib.ticker import FormatStrFormatter, MultipleLocator from matplotlib.dates import DateFormatter, MonthLocator, DayLocator start = datetime.date(2013, 3, 29) until = datetime.date(2014, 3, 29) dates = rrule(MONTHLY, bymonthday=(29, -1), bysetpos=1, until=until) for d in dates:print(d) dates = [start, until] values = [0, 1] plt.ylabel('Balance') plt.grid() ax = plt.subplot(111) plt.plot_date(dates, values, fmt = 'rx-') ax.xaxis.set_major_locator(MonthLocator(bymonthday = (dates[0].day, -1))) ax.xaxis.set_major_formatter(DateFormatter('%d/%m/%y')) ax.yaxis.set_major_formatter(FormatStrFormatter('£%0.2f')) ax.yaxis.set_minor_locator(MultipleLocator(5)) plt.axis(xmin=dates[0], xmax=dates[-1]) plt.setp(plt.gca().get_xticklabels(), rotation = 45, fontsize = 10) plt.setp(plt.gca().get_yticklabels(), fontsize = 10) plt.show() Seems an apt date to realise that I didn't say much :( Assuming that I'm correct would you like an issue raised on the bug tracker? If not please correct the mistake I've made, presumably in reading the docs, which I think are excellent by the way. -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- Own the Future-Intelreg; Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] MonthLocator doesn't honour rrule bymonthday -1 value for last day of month
Hi all, From http://labix.org/python-dateutil To generate a rrule for the use case of a date on the specified day of the month, unless it is beyond the end of month, in which case it will be the last day of the month use the following: rrule(MONTHLY, bymonthday=(some_day, -1), bysetpos=1) This will generate a value for every calendar month regardless of the day of the month it is started from. Using bymonthday with MonthLocator gives ticks on the day given and the last day of the month, which looks extremely ugly. Code below demonstrates. from dateutil.rrule import * import datetime import matplotlib.pyplot as plt from matplotlib.ticker import FormatStrFormatter, MultipleLocator from matplotlib.dates import DateFormatter, MonthLocator, DayLocator start = datetime.date(2013, 3, 29) until = datetime.date(2014, 3, 29) dates = rrule(MONTHLY, bymonthday=(29, -1), bysetpos=1, until=until) for d in dates:print(d) dates = [start, until] values = [0, 1] plt.ylabel('Balance') plt.grid() ax = plt.subplot(111) plt.plot_date(dates, values, fmt = 'rx-') ax.xaxis.set_major_locator(MonthLocator(bymonthday = (dates[0].day, -1))) ax.xaxis.set_major_formatter(DateFormatter('%d/%m/%y')) ax.yaxis.set_major_formatter(FormatStrFormatter('£%0.2f')) ax.yaxis.set_minor_locator(MultipleLocator(5)) plt.axis(xmin=dates[0], xmax=dates[-1]) plt.setp(plt.gca().get_xticklabels(), rotation = 45, fontsize = 10) plt.setp(plt.gca().get_yticklabels(), fontsize = 10) plt.show() -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence -- Own the Future-Intel(R) Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Aligning xticks and labels with WeekdayLocator
On 19/03/2013 18:35, Paul Hobson wrote: On Tue, Mar 19, 2013 at 11:30 AM, Paul Hobson pmhob...@gmail.com mailto:pmhob...@gmail.com wrote: On Mon, Mar 18, 2013 at 8:34 PM, Mark Lawrence breamore...@yahoo.co.uk mailto:breamore...@yahoo.co.uk wrote: Matplotlib 1.2.0, Windows Vista, Python 3.3.0. I want the first major xtick label aligned with the first date that's plotted. This never happens with the value of day below set in the range zero to six. The first major tick label actually occurs as follows. Day Label date 0 25/03/2013 1 02/04/2013 2 10/04/2013 3 21/03/2013 4 29/03/2013 5 06/04/2013 6 17/03/2013 What am I doing wrong? If day is set to seven then no xticks are displayed but labels for 14/03/2013 and 13/03/2014 are displayed. I expected a ValueError or similar using this number. Could you explain this behaviour please? import matplotlib.pyplot as plt from matplotlib.ticker import FormatStrFormatter, MultipleLocator from matplotlib.dates import DateFormatter, WeekdayLocator import datetime dates = [datetime.date(2013, 3, 14), datetime.date(2014, 3, 13)] values = [0, 1] plt.ylabel('Balance') plt.grid() ax = plt.subplot(111) plt.plot_date(dates, values, fmt = 'rx-') plt.axis(xmin=dates[0], xmax=dates[-1]) day = ? ax.xaxis.set_major_locator(WeekdayLocator(byweekday=day, interval=4)) ax.xaxis.set_minor_locator(WeekdayLocator(byweekday=day)) ax.xaxis.set_major_formatter(DateFormatter('%d/%m/%y')) ax.yaxis.set_major_formatter(FormatStrFormatter('£%0.2f')) ax.yaxis.set_minor_locator(MultipleLocator(5)) plt.setp(plt.gca().get_xticklabels(), rotation = 45, fontsize = 10) plt.setp(plt.gca().get_yticklabels(), fontsize = 10) plt.show() Mark, I've found that rotation_mode='anchor' works best when rotation != 0 So that makes it: plt.setp(plt.gca().get_xticklabels(), rotation = 45, fontsize = 10, rotation_mode='anchor' ) HTH, -paul I misread your question. Try setting your x-axis limits after defining the locators and formatters. -p Please accept my apologies for the delay in replying, plus I should also have mentioned originally that I've only encountered this problem with WeekdayLocator. Setting the x-axis limits after defining the locators and formatters makes no difference. I've resolved my issue by reverting back to using MonthLocator, which I originally disliked as the minor tick locations made the display look poor around that darned month of February. My solution has been to ignore all rrule type computing and use the following code. xticks = ax.get_xticks() minorTicks = [] for i,xt in enumerate(xticks, start=1): try: diff = (xticks[i] - xt) / 4 for i in range(1, 4): minorTicks.append(xt + i * diff) except IndexError: pass ax.set_xticks(minorTicks, minor=True) It works a treat, but if there's a simpler solution please let me know :) -- Cheers. Mark Lawrence -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Aligning xticks and labels with WeekdayLocator
Matplotlib 1.2.0, Windows Vista, Python 3.3.0. I want the first major xtick label aligned with the first date that's plotted. This never happens with the value of day below set in the range zero to six. The first major tick label actually occurs as follows. Day Label date 0 25/03/2013 1 02/04/2013 2 10/04/2013 3 21/03/2013 4 29/03/2013 5 06/04/2013 6 17/03/2013 What am I doing wrong? If day is set to seven then no xticks are displayed but labels for 14/03/2013 and 13/03/2014 are displayed. I expected a ValueError or similar using this number. Could you explain this behaviour please? import matplotlib.pyplot as plt from matplotlib.ticker import FormatStrFormatter, MultipleLocator from matplotlib.dates import DateFormatter, WeekdayLocator import datetime dates = [datetime.date(2013, 3, 14), datetime.date(2014, 3, 13)] values = [0, 1] plt.ylabel('Balance') plt.grid() ax = plt.subplot(111) plt.plot_date(dates, values, fmt = 'rx-') plt.axis(xmin=dates[0], xmax=dates[-1]) day = ? ax.xaxis.set_major_locator(WeekdayLocator(byweekday=day, interval=4)) ax.xaxis.set_minor_locator(WeekdayLocator(byweekday=day)) ax.xaxis.set_major_formatter(DateFormatter('%d/%m/%y')) ax.yaxis.set_major_formatter(FormatStrFormatter('£%0.2f')) ax.yaxis.set_minor_locator(MultipleLocator(5)) plt.setp(plt.gca().get_xticklabels(), rotation = 45, fontsize = 10) plt.setp(plt.gca().get_yticklabels(), fontsize = 10) plt.show() -- Cheers. Mark Lawrence -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] fading line plot
On 24/02/2013 18:28, Paul Anton Letnes wrote: Hi everyone, I've been looking into making an animation of a mechanical system. In its first incarnation, my plan was as follows: 1) Make a fading line plot of two variables (say, x and y) 2) Run a series of such plots through ffmpeg/avencode to generate an animation First, I'm wondering whether there's a built-in way of making a fading line plot, i.e. a plot where one end of the line is plotted with high alpha, the other end with low alpha, and intermediate line segments with linearly scaled alpha. For now, I've done this by manually chunking the x and y arrays and plotting each chunk with different alpha. Is there a better way? Is there interest in creating such a plotting function and adding it to matplotlib? Second, is there a way of integrating the chunked generation of fading lines with the animation generating features of matplotlib? It seems possible, although a bit clunky, at present, but maybe someone has a better idea at what overall approach to take than I do. Cheers Paul -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb I remember this http://www.johndcook.com/blog/2013/02/20/python-animation-for-mechanical-vibrations/ from a few days back, HTH. -- Cheers. Mark Lawrence -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Format date tick labels
On 12/10/2012 20:38, Ethan Gutmann wrote: I'm a little confused by this attitude. I recognize that there are issues around dates, I've written a few date libraries myself to get around insane excel date issues (pop quiz for anyone at MS, was 1900 a leap year?) or just to simplify APIs for my own use. But do neither of you think that nanoseconds are important to scientists? I know of enough projects that work with pico (and a few with femto) seconds. Even though I often work with climate data covering ~100s of years and used to work with geologic data covering ~billions of years, I may start working with raw laser data for distance measurements where nanoseconds can be a pretty big deal. These data would be collected over a few years time, so a date utility that can handle that scale range would be useful. I guess I'll be writing my own date/time library again and hacking together some way of plotting data in a meaningful way in matplotlib. Don't get me wrong, matplotlib shouldn't have to reinvent the wheel here, but claiming that nobody could possibly care about 1e-12 seconds seems a little provincial. My apologies if that is not how the above statements were intended. regards, Ethan I actually said What percentage of computer users wants a delta of 1e-12? I suspect that the vast majority of users couldn't care two hoots about miniscule time deltas in a world where changing time zones can cause chaos How does this translate into claiming that nobody could possibly care about 1e-12 seconds seems a little provincial? -- Cheers. Mark Lawrence. -- 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] Format date tick labels
On 11/10/2012 10:55, Damon McDougall wrote: On Wed, Oct 10, 2012 at 5:00 PM, Benjamin Root ben.r...@ou.edu wrote: On Wed, Oct 10, 2012 at 10:55 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 10/10/2012 15:41, Mark Lawrence wrote: On 10/10/2012 14:29, Benjamin Root wrote: I know of a few people who have difficulties with matplotlib's datetime handling, but they are usually operating on the scale of milliseconds or less (lightning data), in which case, one is already at the edge of the resolution handled by python's datetime objects. However, we would certainly welcome any sort of examples of how matplotlib fails in handling seconds scale and lower plots. Cheers! Ben Root I'll assume that the milliseconds above is a typo. From http://docs.python.org/library/datetime.html class datetime.timedelta A duration expressing the difference between two date, time, or datetime instances to microsecond resolution. Still, what's a factor of 1000 amongst friends? :) http://www.python.org/dev/peps/pep-0418/ has been implemented in Python 3.3 and talks about clocks with nanosecond resolutions. I've flagged it up here just in case people weren't aware. Ah, you are right, I meant microseconds. With apologies to Spaceballs: Prepare to go to microsecond resolution! No, no, microsecond resolution is too slow Microsecond resolution is too slow? Yes, too slow. We must use nanosecond resolution! Prep-- Prepare Python, for nanosecond resolution! Cheers! Ben Root Am I missing something here? Are seconds just floats internally? A delta of 1e-6 is nothing (pardon the pun). A delta of 1e-9 is the *least* I'd expect. Maybe even 1e-12. Perhaps the python interpreter doesn't do any denormalisinghttp://stackoverflow.com/questions/9314534/why-does-changing-0-1f-to-0-slow-down-performance-by-10x when encountered with deltas very close to zero... What percentage of computer users wants a delta of 1e-12? I suspect that the vast majority of users couldn't care two hoots about miniscule time deltas in a world where changing time zones can cause chaos. Where some applications cannot handle years before 1970, or 1904, or 1900 or whatever. Or they can't go too far forward, 2036 I think but don't quote me. Where people like myself had to put a huge amount of effort into changing code so that applications would carry on working when the date flipped over from 31st December 1999 to 1st January 2000. If things were that simple why is matplotlib using third party modules like dateutil and pytz? Why doesn't the batteries included Python already provide this functionality? -- Cheers. Mark Lawrence. -- 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] Format date tick labels
On 10/10/2012 14:29, Benjamin Root wrote: I know of a few people who have difficulties with matplotlib's datetime handling, but they are usually operating on the scale of milliseconds or less (lightning data), in which case, one is already at the edge of the resolution handled by python's datetime objects. However, we would certainly welcome any sort of examples of how matplotlib fails in handling seconds scale and lower plots. Cheers! Ben Root I'll assume that the milliseconds above is a typo. From http://docs.python.org/library/datetime.html class datetime.timedelta A duration expressing the difference between two date, time, or datetime instances to microsecond resolution. Still, what's a factor of 1000 amongst friends? :) -- Cheers. Mark Lawrence. -- 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] Format date tick labels
On 10/10/2012 15:41, Mark Lawrence wrote: On 10/10/2012 14:29, Benjamin Root wrote: I know of a few people who have difficulties with matplotlib's datetime handling, but they are usually operating on the scale of milliseconds or less (lightning data), in which case, one is already at the edge of the resolution handled by python's datetime objects. However, we would certainly welcome any sort of examples of how matplotlib fails in handling seconds scale and lower plots. Cheers! Ben Root I'll assume that the milliseconds above is a typo. From http://docs.python.org/library/datetime.html class datetime.timedelta A duration expressing the difference between two date, time, or datetime instances to microsecond resolution. Still, what's a factor of 1000 amongst friends? :) http://www.python.org/dev/peps/pep-0418/ has been implemented in Python 3.3 and talks about clocks with nanosecond resolutions. I've flagged it up here just in case people weren't aware. -- Cheers. Mark Lawrence. -- 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] How to change the textsize inside a legend?
On 31/08/2012 14:42, Fabien Lafont wrote: Hello, The question is in the title :) Cheers! Fabien I don't wish to appear rude as this list is associated with the Python language, but do you ever try a search engine before you ask a question? -- Cheers. Mark Lawrence. -- 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 change the textsize inside a legend?
On 31/08/2012 16:32, Fabrice Silva wrote: To avoid (not so) rude answer like Mark's one, please try first to refer to: - the documentation of the pyplot's commands you use http://matplotlib.sourceforge.net/api/pyplot_api.html It tries (pretty well IMHO) to be comprehensive, at least for 99% of use cases, - you can set, once for all, the properties of most matplotlib objects in the configuration file. An example is here: http://matplotlib.sourceforge.net/users/customizing.html#a-sample-matplotlibrc-file It may be a good starting point to determine the name of the property you are looking for. Regards, -- 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/ Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime. -- Cheers. Mark Lawrence. -- 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 change the size of the numbers under the axis
On 30/08/2012 19:00, Fabien Lafont wrote: Actually I just want to do it on that plot not on all my future plot. 2012/8/30 Fabrice Silva si...@lma.cnrs-mrs.fr: Le jeudi 30 août 2012 à 19:48 +0200, Fabien Lafont a écrit : I just create two vectors from a .txt file and I plot them. I think I have the latest version of matplotlib. I have at least the last version of python(x,y) from pylab import* import matplotlib matplotlib.rcParams['xtick.labelsize'] = 20.0 In your matplotlib config file axes.titlesize : 10 # fontsize of the axes title axes.labelsize : 10 # fontsize of the x any y labels (see http://matplotlib.sourceforge.net/users/customizing.html ) -- 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/ I think you're looking for this http://matplotlib.sourceforge.net/users/whats_new.html#tick-params -- Cheers. Mark Lawrence. -- 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] help me Velocity depth plot in matplotlib
On 10/08/2012 21:27, Damon McDougall wrote: [snipped] Actually, I discovered today that this is possible. You can use step() to achieve what you want: http://matplotlib.sourceforge.net/examples/pylab_examples/step_demo.html Awesome, my question answered before I'd even asked it :) -- Cheers. Mark Lawrence. -- 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 Change Axis Tick Mark Labels
On 23/07/2012 03:01, JonBL wrote: Using FuncFormatter with my conversion procedure has solved my problem. I did not use the Python datetime module to generate the tickmark labels as some of your examples suggested. Instead, my conversion procedure pulls the required formatted date string for an x-axis ticklabel date serial number from an Oracle database which is the source of my plotted data. This approach has also answered another question I had in mind - how do I get the x= co-ordinate displayed at the bottom of the figure, to report the formatted date rather than its serial number. I also had a response from Phil Elson who suggested using using FuncFormatter as well. Many thanks to both of you for your timely responses to my query. Regards, Jon Brilliant :) I was just about to ask how to do this!!! Benjamin Root-2 wrote: On Sat, Jul 21, 2012 at 10:27 PM, JonBL jc.bl...@bigpond.net.au wrote: I have a line plot where the x-axis values are numbers, with displayed tick mark values of 0, 100, 200 ... 500 - a total of 6 tick marks. These values represent the number of days since a certain date. I have a function which converts a number such as 100, to date string '23-Jun-11', which I want to display as the x-axis label instead of 100. Following the pypib example xaxis_props.py, and printing dir(label) for each label in the x-axis tick labels, I can see that a label object supports a number of methods that might assist in changing the text of tick mark labels. I was hoping to use the get_text() method to retrieve the label's text (eg, 100), transform this to a date string by my function, and then use the set_text() method to re-assign the displayed label. This approach does not work for me. The get_text() method returns a zero-length string (not None) for each label, and the set_text() method does not change the displayed tick mark values. But I can use the set_color() method to change the colour of displayed values as per example xaxis_props.py. Any suggestions on how to change the text of displayed x-axis tick marks? TIA, Jon Without example code, it would be difficult to determine what you are doing incorrectly. That being said, there is an easier solution. If you know the start date, do the following: from datetime import datetime, timedelta startdate = datetime.strptime(datestr, %d-%m-%y) # you need to look up the format character for named months. xdates = np.array([startdate + timedelta(days=i) for i in xrange(501)]) y = np.random.random(xdates.shape) plt.plot(xdates, y)# This should work, but plot_date() definitely will work. Matplotlib recognizes the python datetime object and should format it for you. You can even control the formatting. See the following examples: http://matplotlib.sourceforge.net/examples/pylab_examples/date_demo_convert.html?highlight=datetime%20codex http://matplotlib.sourceforge.net/examples/pylab_examples/date_demo2.html?highlight=datetime%20codex http://matplotlib.sourceforge.net/examples/api/date_demo.html?highlight=datetime%20codex http://matplotlib.sourceforge.net/examples/pylab_examples/date_demo1.html?highlight=datetime%20codex I hope this helps! Ben Root -- 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 -- Cheers. Mark Lawrence. -- 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] wrapping y axis tick labels?
On 21/07/2012 05:15, Benjamin Root wrote: On Fri, Jul 20, 2012 at 10:55 PM, C M cmpyt...@gmail.com wrote: How possible would it be to wrap y axis tick labels after a certain text length? I have a horizontal bar plot where some bars' labels are too long and therefore cut off. I can scrunch the width of the whole plot to accommodate them, but I'd much rather wrap long text and allow a little more space to accommodate two lines. For examples: I'd like to go from this: a short axis label | == A very long axis label that gets cut off | = To this: a short axis label | == A very long axis label | = that gets cut off Is this possible or has it ever been done? Thanks, Che Not automatically, but you can always manually break up a line of text with a '\n' in the string. Automatic/intelligent line wrapping has always been a requested feature, but would be very difficult to implement correctly. Therefore, the recommendation is for manual usage of newlines. For the OP an example is here http://matplotlib.sourceforge.net/examples/pylab_examples/barchart_demo2.html Cheers! Ben Root -- 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 -- Cheers. Mark Lawrence. -- 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] histogram withx axis dates
Sorry if I've missed this in the docs but is it possible to directly plot a histogram with a date x axis or do I have to roll my own? This is critical as I'm on a diet and trying to plot my weight loss against date :) -- Cheers. Mark Lawrence. -- 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 withx axis dates
On 14/07/2012 13:05, Damon McDougall wrote: On Sat, Jul 14, 2012 at 12:49:29PM +0100, Mark Lawrence wrote: Sorry if I've missed this in the docs but is it possible to directly plot a histogram with a date x axis or do I have to roll my own? This I'm assuming you have weight data AND date data. That is, a list of dates and associated with each date a value of your weight for that date. Correct. If you have the dates, you could check out: http://stackoverflow.com/questions/5498510/creating-graph-with-date-and-time-in-axis-labels-with-matplotlib and http://matplotlib.sourceforge.net/users/recipes.html#fixing-common-date-annoyances Will do. is critical as I'm on a diet and trying to plot my weight loss against date :) Good luck :) Thanks. -- Cheers. Mark Lawrence. Finally thanks for the quick response. -- Cheers. Mark Lawrence. -- 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 withx axis dates
On 14/07/2012 13:41, William R. Wing (Bill Wing) wrote: On Jul 14, 2012, at 7:49 AM, Mark Lawrence wrote: Sorry if I've missed this in the docs but is it possible to directly plot a histogram with a date x axis or do I have to roll my own? This is critical as I'm on a diet and trying to plot my weight loss against date :) -- Cheers. Mark Lawrence. Are you sure you want a histogram - weight vs date sounds more like a simple bar graph (which matplotlib does trivially). -Bill -- 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/ You are correct, why did I say histogram when I've been looking at my own code that plots bars? Just shows that a beer free diet is no good for you :) Let's try again, is it possible to directly plot a bar chart with a date x axis or do I have to roll my own? -- Cheers. Mark Lawrence. -- 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] Is the Python Decimal class supported?
Hi all, I regularly use matplotlib for plotting data relating to my personal finances. At the moment I'm converting Decimals to floats. Do I still have to do this? If yes, are there any plans to support Decimals? I've tried searching the latest PDF document, my apologies if I've missed anything, in which case could I have a pointer please. -- Cheers. Mark Lawrence. -- 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] problem in plotting cylinders with differnet colour
On 15/02/2012 17:21, Benjamin Root wrote: On Tue, Feb 14, 2012 at 8:58 AM, Mark Lawrencebreamore...@yahoo.co.ukwrote: On 14/02/2012 13:52, Debashish Saha wrote: import numpy from enthought.mayavi import mlab #def test_mesh(): #A very pretty picture of spherical harmonics translated from #the octaviz example. for r in range (1,5): print r pi = numpy.pi cos = numpy.cos sin = numpy.sin dphi, dtheta, dz = pi/250.0, pi/250.0, 0.01 #[phi,theta] = numpy.mgrid[0:pi+dphi*1.5:dphi,0:2*pi+dtheta*1.5:dtheta] [phi,z] = numpy.mgrid[0:2*pi+dphi*1.5:dphi,0:2+dz*1.5:dz] m0 = 4; m1 = 3; m2 = 2; m3 = 3; m4 = 6; m5 = 2; m6 = 6; m7 = 4; # r = sin(m0*phi)**m1 + cos(m2*phi)**m3 + 5*sin(m4*theta)**m5 + cos(m6*theta)**m7 #x = 1*sin(phi)*cos(theta) #y = 1*sin(phi)*sin(theta) #z = 1*cos(phi); x=r*cos(phi) y=r*sin(phi) z=z i=['Reds','greens','autumn','purples'] print i[r-1] e=i[r-1] mlab.mesh(x, y, z,colormap='e') #print i[r-1] Error: TypeError Traceback (most recent call last) C:\Python27\lib\site-packages\IPython\utils\py3compat.pyc in execfile(fname, glob, loc) 166 else: 167 filename = fname -- 168 exec compile(scripttext, filename, 'exec') in glob, loc 169 else: 170 def execfile(fname, *where): C:\Users\as\jhgf.py inmodule() 24 print i[r-1] 25 e=i[r-1] --- 26 mlab.mesh(x, y, z,'e') 27 #print i[r-1] 28 C:\Python27\lib\site-packages\mayavi\tools\helper_functions.pyc in the_function(*args, **kwargs) 32 def document_pipeline(pipeline): 33 def the_function(*args, **kwargs): --- 34 return pipeline(*args, **kwargs) 35 36 if hasattr(pipeline, 'doc'): C:\Python27\lib\site-packages\mayavi\tools\helper_functions.pyc in __call__(self, *args, **kwargs) 77 scene.disable_render = True 78 # Then call the real logic --- 79 output = self.__call_internal__(*args, **kwargs) 80 # And re-enable the rendering, if needed. 81 if scene is not None: C:\Python27\lib\site-packages\mayavi\tools\helper_functions.pyc in __call_internal__(self, *args, **kwargs) 830 filters. 831 -- 832 self.source = self._source_function(*args, **kwargs) 833 kwargs.pop('name', None) 834 self.store_kwargs(kwargs) TypeError: grid_source() takes exactly 3 arguments (4 given) -- 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 Didn't this get answered on the python tutor mailing list within the last couple of hours? What's with it with you? -- Cheers. Mark Lawrence. A couple of things I would like to point out here: 1.) It is possible that Debashish sent similar questions to multiple mailing lists in the hopes to maximize the chance of getting a response. It may only appear that this thread was started after having the question answered on another mailing list because of the delays that are notorious on this list. I suspect he sent both emails at around the same time, but the python tutors list processed it faster than the matplotlib-users list. Therefore... 2.) I would like to make sure that this mailing list remains a welcoming forum for all users, and for all of us to understand that people have different mailing habits that we may not be familiar with. Therefore, gentle reminders of mailing decorum (such as reminders to bottom-post) should be the response, not chastising. -- Debashish, We are more than happy to help you. Please keep your question to a single mailing list at a time. The users on the mailing list will let you know if you should direct your question elsewhere. In the case of your problem, it is not matplotlib, but mayavi. Hopefully, you have been directed to the mayavi mailing list. Cheers! Ben Root -- Virtualization Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users Please accept my apologies if I breached protocol but there are five threads from
Re: [Matplotlib-users] problem in plotting cylinders with differnet colour
On 15/02/2012 21:34, Benjamin Root wrote: On Wed, Feb 15, 2012 at 2:52 PM, Mark Lawrencebreamore...@yahoo.co.ukwrote: On 15/02/2012 17:21, Benjamin Root wrote: On Tue, Feb 14, 2012 at 8:58 AM, Mark Lawrencebreamore...@yahoo.co.uk wrote: On 14/02/2012 13:52, Debashish Saha wrote: import numpy from enthought.mayavi import mlab #def test_mesh(): #A very pretty picture of spherical harmonics translated from #the octaviz example. for r in range (1,5): print r pi = numpy.pi cos = numpy.cos sin = numpy.sin dphi, dtheta, dz = pi/250.0, pi/250.0, 0.01 #[phi,theta] = numpy.mgrid[0:pi+dphi*1.5:dphi,0:2*pi+dtheta*1.5:dtheta] [phi,z] = numpy.mgrid[0:2*pi+dphi*1.5:dphi,0:2+dz*1.5:dz] m0 = 4; m1 = 3; m2 = 2; m3 = 3; m4 = 6; m5 = 2; m6 = 6; m7 = 4; # r = sin(m0*phi)**m1 + cos(m2*phi)**m3 + 5*sin(m4*theta)**m5 + cos(m6*theta)**m7 #x = 1*sin(phi)*cos(theta) #y = 1*sin(phi)*sin(theta) #z = 1*cos(phi); x=r*cos(phi) y=r*sin(phi) z=z i=['Reds','greens','autumn','purples'] print i[r-1] e=i[r-1] mlab.mesh(x, y, z,colormap='e') #print i[r-1] Error: TypeError Traceback (most recent call last) C:\Python27\lib\site-packages\IPython\utils\py3compat.pyc in execfile(fname, glob, loc) 166 else: 167 filename = fname --168 exec compile(scripttext, filename, 'exec') in glob, loc 169 else: 170 def execfile(fname, *where): C:\Users\as\jhgf.py inmodule() 24 print i[r-1] 25 e=i[r-1] ---26 mlab.mesh(x, y, z,'e') 27 #print i[r-1] 28 C:\Python27\lib\site-packages\mayavi\tools\helper_functions.pyc in the_function(*args, **kwargs) 32 def document_pipeline(pipeline): 33 def the_function(*args, **kwargs): ---34 return pipeline(*args, **kwargs) 35 36 if hasattr(pipeline, 'doc'): C:\Python27\lib\site-packages\mayavi\tools\helper_functions.pyc in __call__(self, *args, **kwargs) 77 scene.disable_render = True 78 # Then call the real logic ---79 output = self.__call_internal__(*args, **kwargs) 80 # And re-enable the rendering, if needed. 81 if scene is not None: C:\Python27\lib\site-packages\mayavi\tools\helper_functions.pyc in __call_internal__(self, *args, **kwargs) 830 filters. 831 --832 self.source = self._source_function(*args, **kwargs) 833 kwargs.pop('name', None) 834 self.store_kwargs(kwargs) TypeError: grid_source() takes exactly 3 arguments (4 given) -- 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 Didn't this get answered on the python tutor mailing list within the last couple of hours? What's with it with you? -- Cheers. Mark Lawrence. A couple of things I would like to point out here: 1.) It is possible that Debashish sent similar questions to multiple mailing lists in the hopes to maximize the chance of getting a response. It may only appear that this thread was started after having the question answered on another mailing list because of the delays that are notorious on this list. I suspect he sent both emails at around the same time, but the python tutors list processed it faster than the matplotlib-users list. Therefore... 2.) I would like to make sure that this mailing list remains a welcoming forum for all users, and for all of us to understand that people have different mailing habits that we may not be familiar with. Therefore, gentle reminders of mailing decorum (such as reminders to bottom-post) should be the response, not chastising. -- Debashish, We are more than happy to help you. Please keep your question to a single mailing list at a time. The users on the mailing list will let you know if you should direct your question elsewhere. In the case of your problem, it is not matplotlib, but mayavi. Hopefully, you have been directed to the mayavi mailing list. Cheers! Ben Root -- Virtualization Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ ___ Matplotlib-users mailing list
Re: [Matplotlib-users] problem in plotting cylinders with differnet colour
On 14/02/2012 13:52, Debashish Saha wrote: import numpy from enthought.mayavi import mlab #def test_mesh(): #A very pretty picture of spherical harmonics translated from #the octaviz example. for r in range (1,5): print r pi = numpy.pi cos = numpy.cos sin = numpy.sin dphi, dtheta, dz = pi/250.0, pi/250.0, 0.01 #[phi,theta] = numpy.mgrid[0:pi+dphi*1.5:dphi,0:2*pi+dtheta*1.5:dtheta] [phi,z] = numpy.mgrid[0:2*pi+dphi*1.5:dphi,0:2+dz*1.5:dz] m0 = 4; m1 = 3; m2 = 2; m3 = 3; m4 = 6; m5 = 2; m6 = 6; m7 = 4; # r = sin(m0*phi)**m1 + cos(m2*phi)**m3 + 5*sin(m4*theta)**m5 + cos(m6*theta)**m7 #x = 1*sin(phi)*cos(theta) #y = 1*sin(phi)*sin(theta) #z = 1*cos(phi); x=r*cos(phi) y=r*sin(phi) z=z i=['Reds','greens','autumn','purples'] print i[r-1] e=i[r-1] mlab.mesh(x, y, z,colormap='e') #print i[r-1] Error: TypeError Traceback (most recent call last) C:\Python27\lib\site-packages\IPython\utils\py3compat.pyc in execfile(fname, glob, loc) 166 else: 167 filename = fname -- 168 exec compile(scripttext, filename, 'exec') in glob, loc 169 else: 170 def execfile(fname, *where): C:\Users\as\jhgf.py inmodule() 24 print i[r-1] 25 e=i[r-1] --- 26 mlab.mesh(x, y, z,'e') 27 #print i[r-1] 28 C:\Python27\lib\site-packages\mayavi\tools\helper_functions.pyc in the_function(*args, **kwargs) 32 def document_pipeline(pipeline): 33 def the_function(*args, **kwargs): --- 34 return pipeline(*args, **kwargs) 35 36 if hasattr(pipeline, 'doc'): C:\Python27\lib\site-packages\mayavi\tools\helper_functions.pyc in __call__(self, *args, **kwargs) 77 scene.disable_render = True 78 # Then call the real logic --- 79 output = self.__call_internal__(*args, **kwargs) 80 # And re-enable the rendering, if needed. 81 if scene is not None: C:\Python27\lib\site-packages\mayavi\tools\helper_functions.pyc in __call_internal__(self, *args, **kwargs) 830 filters. 831 -- 832 self.source = self._source_function(*args, **kwargs) 833 kwargs.pop('name', None) 834 self.store_kwargs(kwargs) TypeError: grid_source() takes exactly 3 arguments (4 given) -- 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 Didn't this get answered on the python tutor mailing list within the last couple of hours? What's with it with you? -- Cheers. Mark Lawrence. -- 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