You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
(12) |
Sep
(12) |
Oct
(56) |
Nov
(65) |
Dec
(37) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(59) |
Feb
(78) |
Mar
(153) |
Apr
(205) |
May
(184) |
Jun
(123) |
Jul
(171) |
Aug
(156) |
Sep
(190) |
Oct
(120) |
Nov
(154) |
Dec
(223) |
2005 |
Jan
(184) |
Feb
(267) |
Mar
(214) |
Apr
(286) |
May
(320) |
Jun
(299) |
Jul
(348) |
Aug
(283) |
Sep
(355) |
Oct
(293) |
Nov
(232) |
Dec
(203) |
2006 |
Jan
(352) |
Feb
(358) |
Mar
(403) |
Apr
(313) |
May
(165) |
Jun
(281) |
Jul
(316) |
Aug
(228) |
Sep
(279) |
Oct
(243) |
Nov
(315) |
Dec
(345) |
2007 |
Jan
(260) |
Feb
(323) |
Mar
(340) |
Apr
(319) |
May
(290) |
Jun
(296) |
Jul
(221) |
Aug
(292) |
Sep
(242) |
Oct
(248) |
Nov
(242) |
Dec
(332) |
2008 |
Jan
(312) |
Feb
(359) |
Mar
(454) |
Apr
(287) |
May
(340) |
Jun
(450) |
Jul
(403) |
Aug
(324) |
Sep
(349) |
Oct
(385) |
Nov
(363) |
Dec
(437) |
2009 |
Jan
(500) |
Feb
(301) |
Mar
(409) |
Apr
(486) |
May
(545) |
Jun
(391) |
Jul
(518) |
Aug
(497) |
Sep
(492) |
Oct
(429) |
Nov
(357) |
Dec
(310) |
2010 |
Jan
(371) |
Feb
(657) |
Mar
(519) |
Apr
(432) |
May
(312) |
Jun
(416) |
Jul
(477) |
Aug
(386) |
Sep
(419) |
Oct
(435) |
Nov
(320) |
Dec
(202) |
2011 |
Jan
(321) |
Feb
(413) |
Mar
(299) |
Apr
(215) |
May
(284) |
Jun
(203) |
Jul
(207) |
Aug
(314) |
Sep
(321) |
Oct
(259) |
Nov
(347) |
Dec
(209) |
2012 |
Jan
(322) |
Feb
(414) |
Mar
(377) |
Apr
(179) |
May
(173) |
Jun
(234) |
Jul
(295) |
Aug
(239) |
Sep
(276) |
Oct
(355) |
Nov
(144) |
Dec
(108) |
2013 |
Jan
(170) |
Feb
(89) |
Mar
(204) |
Apr
(133) |
May
(142) |
Jun
(89) |
Jul
(160) |
Aug
(180) |
Sep
(69) |
Oct
(136) |
Nov
(83) |
Dec
(32) |
2014 |
Jan
(71) |
Feb
(90) |
Mar
(161) |
Apr
(117) |
May
(78) |
Jun
(94) |
Jul
(60) |
Aug
(83) |
Sep
(102) |
Oct
(132) |
Nov
(154) |
Dec
(96) |
2015 |
Jan
(45) |
Feb
(138) |
Mar
(176) |
Apr
(132) |
May
(119) |
Jun
(124) |
Jul
(77) |
Aug
(31) |
Sep
(34) |
Oct
(22) |
Nov
(23) |
Dec
(9) |
2016 |
Jan
(26) |
Feb
(17) |
Mar
(10) |
Apr
(8) |
May
(4) |
Jun
(8) |
Jul
(6) |
Aug
(5) |
Sep
(9) |
Oct
(4) |
Nov
|
Dec
|
2017 |
Jan
(5) |
Feb
(7) |
Mar
(1) |
Apr
(5) |
May
|
Jun
(3) |
Jul
(6) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
2018 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
1
(9) |
2
(1) |
3
(4) |
4
(4) |
5
(9) |
6
(5) |
7
(12) |
8
(5) |
9
(27) |
10
(10) |
11
(4) |
12
|
13
(6) |
14
(12) |
15
(16) |
16
(13) |
17
(9) |
18
(1) |
19
(2) |
20
(4) |
21
(9) |
22
(5) |
23
(2) |
24
(6) |
25
|
26
(1) |
27
(9) |
28
(7) |
29
(2) |
30
(9) |
|
|
From: Daπid <dav...@gm...> - 2011-06-14 11:46:26
|
ax.set_xticks(bins) ax.set_xticklabels(n, rotation='vertical') The first one is for creating the ticks in proper places and the second is plotting each number under it. n is already a list, so you don't want to put it again on it. What you are doing with it is to plot under each bar the height of it. Are you sure it is what you want to do? Regards, David. On Tue, Jun 14, 2011 at 11:46 AM, Victor Hooi <vic...@ya...> wrote: > heya, > I'm trying to use Matplotlib to generate a histogram of some measurements: > > import matplotlib > matplotlib.use('Agg') > import matplotlib.pyplot as pyplot > ... > fig = pyplot.figure() > ax = fig.add_subplot(1,1,1,) > n, bins, patches = ax.hist(measurements, bins=50, range=(graph_minimum, > graph_maximum), histtype='bar') > ax.set_xticklabels([n], rotation='vertical') > > for patch in patches: > patch.set_facecolor('r') > pyplot.title='Foobar' > #pyplot.grid(True) > pyplot.xlabel('X-Axis') > pyplot.ylabel('Y-Axis') > pyplot.savefig(output_filename) > > However, the x-tick-labels doesn't seem to be working: > http://i.stack.imgur.com/tpViz.png > Instead of appearing on the bottom underneath each bar, it's rendered as a > single line of numbers at the bottom left - which is also truncated. > Also, the plot title doesn't seem to appear in my ouputed PNG. > Any ideas as to what's going on? > Cheers, > Victor > ------------------------------------------------------------------------------ > 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
From: Bala s. <bal...@gm...> - 2011-06-14 10:36:06
|
Friends, I have a simple array like this data=[0,0,1,1,3,1,0,1,1,3]. I want to make a plot (using pcolor/matshow) by giving distinct color to each integer. Something like green for zero, red for 1 and blue for 3. Your suggestions / any pseudo code would be of great help. Thanks, Bala |
From: Victor H. <vic...@ya...> - 2011-06-14 09:46:38
|
heya, I'm trying to use Matplotlib to generate a histogram of some measurements: import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as pyplot ... fig = pyplot.figure() ax = fig.add_subplot(1,1,1,) n, bins, patches = ax.hist(measurements, bins=50, range=(graph_minimum, graph_maximum), histtype='bar') ax.set_xticklabels([n], rotation='vertical') for patch in patches: patch.set_facecolor('r') pyplot.title='Foobar' #pyplot.grid(True) pyplot.xlabel('X-Axis') pyplot.ylabel('Y-Axis') pyplot.savefig(output_filename) However, the x-tick-labels doesn't seem to be working: http://i.stack.imgur.com/tpViz.png Instead of appearing on the bottom underneath each bar, it's rendered as a single line of numbers at the bottom left - which is also truncated. Also, the plot title doesn't seem to appear in my ouputed PNG. Any ideas as to what's going on? Cheers, Victor |
From: Victor H. <vic...@ya...> - 2011-06-14 09:08:36
|
Goyo, Aha, so I can call .set_facecolor() on the Patch objects, and then force the graph to re-draw(). I've tested it - it works when I do savefig(). And if I'm running it interactive, I just run matplotlib.draw() after modifying the patch list. I suppose I can combine that technique with the calculation tip from Ben to colour-code the different region. I could run a for-loop over the Patch list, and do multiple if's - however, wondering if there's a way to do it with a list-comprehension? Thanks for the tips, guys =). Cheers, Victor On Fri, Feb 25, 2011 at 10:02, Goyo <goy...@gm...> wrote: > 2011/2/22 Benjamin Root <ben...@ou...>: > > > > Admittedly, this isn't using matplotlib's hist() function because it only > > allows for one color per dataset. However, you can use numpy's histogram > > function to get the bins and counts yourself, and then use bar() to make > the > > bars. bar() will allow you to color the bars individually. > > Pylab hist() returns a list of patches so you can also change their > properties. > > Goyo > |
From: Victor H. <vic...@ya...> - 2011-06-14 08:55:56
|
Ben, Awesome - thanks for the sample code. I had to make a slight change - multiplying 'y' by a float doesn't work: TypeError: can't multiply sequence by non-int of type 'float' I just did a cast to int, and it worked - not sure if this is a bad practice in Python though?: cs = (['y'] * int(round(0.25 * len(xs)))) + (['g'] * int(round(0.5 * > len(xs)))) + (['y'] * int(round(0.25 * len(xs)))) Anyhow, it's a pity I can't use your code with Matplotlib's hist() - as that definitely made producing histograms bins much easier. It's strange that colour-coding bars isn't a feature of hist(). I guess I'll have to look at doing all the hist setup/calculations by hand. Ah well. Thanks, Victor On Wed, Feb 23, 2011 at 03:12, Benjamin Root <ben...@ou...> wrote: > > > On Tue, Feb 15, 2011 at 11:07 PM, Victor Hooi <vic...@ya...>wrote: > >> heya, >> >> Is there an easy way to colour-code a Matplotlib histogram with a single >> set of data? >> >> So for example, you'd have a bell-shaped histogram, and the middle 50% >> might be green, the regions 20% to the left and right of that might be >> yellow, and the 5% either side beyond that could be red. >> >> I couldn't seem to find anything in the Matplotlib options for this - any >> suggestions? >> >> Cheers, >> Victor >> >> > Sure, check out the following: > > import matplotlib.pyplot as plt > import numpy as np > > xs = np.arange(20) > ys = np.random.rand(20) > cs = (['y'] * round(0.25 * len(xs))) + (['g'] * round(0.5 * len(xs))) + > (['y'] * round(0.25 * len(xs))) > > plt.bar(xs, ys, color=cs) > plt.show() > > > Admittedly, this isn't using matplotlib's hist() function because it only > allows for one color per dataset. However, you can use numpy's histogram > function to get the bins and counts yourself, and then use bar() to make the > bars. bar() will allow you to color the bars individually. > > I hope this helps! > Ben Root > > |
From: Andrea C. <and...@gm...> - 2011-06-14 04:07:22
|
I found this question asked other times, but trying myself there is no way that I get something working.. So I just want to generate a pdf from a plot with the smallest possible margin, and I was trying for example this: fig = plt.figure(1) fig.frameon = False plt.plot(range(10), range(10)) plt.savefig('prova1.pdf') But the margin is still all there.. Am I missing something? Thanks, Andrea |
From: Xavier G. <xav...@gm...> - 2011-06-13 21:33:57
|
On 06/13/2011 07:38 PM, Darren Dale wrote: > On Mon, Jun 13, 2011 at 12:25 PM, Michael Droettboom<md...@st...> wrote: >> This was recently discussed in the thread "v1.0.x branch seems confused." >> >> I (believe) the consensus was to get out another v1.0.x maintenance >> release out in the near future (which would not support py3k, but would >> still support Python 2.4), and then merge the py3 branch into master so >> it starts to get some more testing before making the next major release. >> >> I'm just today merging master into py3 so that when we are ready to do >> the merge the other way most of the hard work will have already been done. > Are there features already in master that should be supported by > <python-2.6? If so, I think we should consider releasing 1.1.0 and > making a 1.1.x maintenance branch before merging the py3 stuff back > into master. Then mpl-1.2 could be the first to support py3. > > Should we move this discussion to the mpl-dev mailing list? > > Darren Ho I wasn't aware of an mpl-dev mailing list. Sorry. py3 is already ok with python3 *and* python2 isn't it? Maybe the website should advertise a bit on the needs to test the py3 branch. Users used to compile mpl from git should be able to produce valuable technical feedback, shoudn't they? Xavier |
From: Nicholas D. <mis...@gm...> - 2011-06-13 19:58:57
|
I've been seeing weird behaviour with using a colorbar() and adjusting the plot extents, either interactively in the GUI or through figure.subplots_adjust. If I adjust the axes after drawing the colorbar, it is placed incorrectly. This seems to happen independently of the backends that I have and even continues through to the written file with figure.save_fig. I'm using matplotlib.__version__ = 1.1.0, with a git checkout that I recently updated. I have included a short test .py that shows the problem, and two images that it produces: - Adjusting after drawing the plot: http://ndevenish.com/images/post_adjust.png - Adjusting before drawing the plot: http://ndevenish.com/images/pre_adjust.png Is there a way I can avoid or correct this behaviour? It certainly seems erroneous that using the figure GUI to adjust plot bounds doesn't work, and is an especially nice way of tweaking for final plots. Thanks, Nick (apologies if this comes through twice, gmail was acting up) |
From: Darren D. <dsd...@gm...> - 2011-06-13 17:38:54
|
On Mon, Jun 13, 2011 at 12:25 PM, Michael Droettboom <md...@st...> wrote: > This was recently discussed in the thread "v1.0.x branch seems confused." > > I (believe) the consensus was to get out another v1.0.x maintenance > release out in the near future (which would not support py3k, but would > still support Python 2.4), and then merge the py3 branch into master so > it starts to get some more testing before making the next major release. > > I'm just today merging master into py3 so that when we are ready to do > the merge the other way most of the hard work will have already been done. Are there features already in master that should be supported by <python-2.6? If so, I think we should consider releasing 1.1.0 and making a 1.1.x maintenance branch before merging the py3 stuff back into master. Then mpl-1.2 could be the first to support py3. Should we move this discussion to the mpl-dev mailing list? Darren |
From: Michael D. <md...@st...> - 2011-06-13 16:22:53
|
This was recently discussed in the thread "v1.0.x branch seems confused." I (believe) the consensus was to get out another v1.0.x maintenance release out in the near future (which would not support py3k, but would still support Python 2.4), and then merge the py3 branch into master so it starts to get some more testing before making the next major release. I'm just today merging master into py3 so that when we are ready to do the merge the other way most of the hard work will have already been done. Mike On 06/13/2011 10:39 AM, Xavier Gnata wrote: > Hi, > > It looks like the matplotlib-py3 branch is worknig well both with > python2.X and python3.X. > Is there a plan to merge the changes from matplotlib-py3 into the > default trunk anytime soon? > > Xavier > > ------------------------------------------------------------------------------ > 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA |
From: Xavier G. <xav...@gm...> - 2011-06-13 14:39:50
|
Hi, It looks like the matplotlib-py3 branch is worknig well both with python2.X and python3.X. Is there a plan to merge the changes from matplotlib-py3 into the default trunk anytime soon? Xavier |
From: Matthias Q. <mat...@un...> - 2011-06-13 10:30:14
|
Hello, i have some problems formatting my plot with dates on the x-axis. My time array contains datetime objects with year,month,day,hour,minute. Matplotlib shows hour, minute, second and the timezone. I want only hour and minute! I set my timezone in the matplotlibrc to 'UTC', but mpl shows still CEST. Here is a code snippet: fig = figure(figsize=(8,7)) ax = fig.add_subplot(211) xticks(visible=False) ax.plot(...) bx.twinx() bx.plot(...) cx = fig.add_subplot(211,sharex=ax) cx.plot(...) dx = cx.twinx() dx.plot(...) I tried: from matplotlib.dates import DateFormatter fmt = DateFormatter('%H:%M') cx.xaxis.set_major_formatter(fmt) and ax.xaxis.set_major_formatter(fmt) but this doesn't change anything! I hope someone can help me. Greeting MQ |
From: calmar c. <ma...@ca...> - 2011-06-11 08:35:57
|
On Fri, Jun 10, 2011 at 10:50:21PM -0500, Benjamin Root wrote: Hi Ben and Scott and all, > Admittedly, these following examples are for dates (and might even need to > be updated...) > [2]http://matplotlib.sourceforge.net/examples/api/date_demo.html > [3]http://matplotlib.sourceforge.net/examples/api/date_index_formatter.html > > There are others as well. I see, thanks (all your examples here are pretty helpful for understanding matplotlib somebit better - even so I'm using the Formatter-Function now). marco -- (o_ It rocks: LINUX + Command-Line-Interface //\ GPG: 0x59D90F4D V_/_ http://www.calmar.ws |
From: Daniel M. <dan...@go...> - 2011-06-11 08:34:48
|
Hi Karthik, I cannot find any problem with your code. You are mixing modules a little too much to my taste but it's not a technical problem. Loading and saving the data works flawless here. Attached is an infile and a modified script, please try this. 2011/6/11 Karthikraja Velmurugan <vel...@gm...> > *Hi Daniel, * > * * > *I used the code but there is small issue. I forgot to mention that my > values are signed and unsigned decimal values. * > *My values look like this > * > 0.0023 -0.0456 0.0419 0.094 -0.0004 0.0236 -0.0237 -0.0043 -0.0718 > 0.0095 0.0592 -0.0417 0.0023 0.0386 -0.0023 -0.0236 -0.1045 0.098 > -0.0006 0.0516 0.0463 -0.0035 -0.0442 0.1371 0.022 -0.0222 0.256 0.4903 > 0.0662 -0.0763 0.0064 0.1404 > > *After running the code the "pylab.savetxt" saves the same data something > like this* > > > 8.205965840870644800e-01;8.034591567160346300e-01;5.493847743502982000e-01;2.581157685701491700e-01;6.409997826977161800e-01;3.719908502347885100e-01 > I assume you are confused about the many decimals. Whenever floats are processed by Python they are real floats, see here: http://docs.python.org/release/2.5.2/tut/node16.html To me, it looks as if you have truncated the lines, but otherwise there is nothing wrong... *When I tried to extract data and print them they look like this (totally > different from the actual values!)* > > [ 0.18353712 0.30468928 0.16164556 ..., 0.98860032 0.49681098 > 0.77393306] > Yes, these are different numbers. But I assume you are comparing different rows or columns?! > *When I tried not using the "pylab.savetxt" function it gives an error > like below:* > > ValueError: invalid literal for float(): > 0.0023,-0.0456,0.0419,0.094,0.0224,0.0365 > This error message tells you that you are trying to save non-numeric data to a file with that command. Eg. this will cause the same error: scipy.savetxt('asdfasdf.dat', 'asdfasdf') It is *VERY* hard to tell what you are doing since you don't provide exact pieces of code. > *Is there a specific way to handle signed decimal number? If so please > suggest some changes.* And also I did try using the "array[]" to access > individual comulns but I get an error saying the numpy.ndarray object not > callable. > I must ask again? Have you played with the examples that I provided? You are using the function in a wrong way (again, I can't tell for sure since you don't provide code): In order to acces the first row from a data array, you simply use data[0], the first column is data.T[0]. *import matplotlib.pyplot as plt > import pylab > import scipy > import numpy > datafile1 = 'vet1.csv' > data = pylab.rand(98760,6) > pylab.savetxt(datafile1, data, delimiter=';') > a1 = pylab.loadtxt(datafile1, comments='#', delimiter=';').T > print 'loading', datafile1 > v1 = [0,1] > v2 = [-2,2]* > *plt.close('all') > plt.figure()* > *plt.ylim(v2) > for i in range(2): > plt.plot(a1[i])* > *plt.show()* > > -Karthik > Please do provide all steps that cause problems, not just the results. It is impossible to help you with assumptions and guesses :) Best regards, Daniel |
From: Karthikraja V. <vel...@gm...> - 2011-06-11 08:00:15
|
*Hi Daniel, * * * *I used the code but there is small issue. I forgot to mention that my values are signed and unsigned decimal values. * *My values look like this * 0.0023 -0.0456 0.0419 0.094 -0.0004 0.0236 -0.0237 -0.0043 -0.0718 0.0095 0.0592 -0.0417 0.0023 0.0386 -0.0023 -0.0236 -0.1045 0.098 -0.0006 0.0516 0.0463 -0.0035 -0.0442 0.1371 0.022 -0.0222 0.256 0.4903 0.0662 -0.0763 0.0064 0.1404 *After running the code the "pylab.savetxt" saves the same data something like this* 8.205965840870644800e-01;8.034591567160346300e-01;5.493847743502982000e-01;2.581157685701491700e-01;6.409997826977161800e-01;3.719908502347885100e-01 *When I tried to extract data and print them they look like this (totally different from the actual values!)* [ 0.18353712 0.30468928 0.16164556 ..., 0.98860032 0.49681098 0.77393306] *When I tried not using the "pylab.savetxt" function it gives an error like below:* ValueError: invalid literal for float(): 0.0023,-0.0456,0.0419,0.094,0.0224,0.0365 *Is there a specific way to handle signed decimal number? If so please suggest some changes.* And also I did try using the "array[]" to access individual comulns but I get an error saying the numpy.ndarray object not callable. *import matplotlib.pyplot as plt import pylab import scipy import numpy datafile1 = 'vet1.csv' data = pylab.rand(98760,6) pylab.savetxt(datafile1, data, delimiter=';') a1 = pylab.loadtxt(datafile1, comments='#', delimiter=';').T print 'loading', datafile1 v1 = [0,1] v2 = [-2,2]* *plt.close('all') plt.figure()* *plt.ylim(v2) for i in range(2): plt.plot(a1[i])* *plt.show()* -Karthik |
From: Benjamin R. <ben...@ou...> - 2011-06-11 03:50:47
|
On Fri, Jun 10, 2011 at 12:50 PM, calmar c. <ma...@ca...> wrote: > On Fri, Jun 10, 2011 at 11:10:02AM -0500, Benjamin Root wrote: > > > > Why not just use an array of datetime.timedelta objects?� I believe > > matplotlib already supports this, does automatic formatting and even > > allows you to easily modify how the formatting is done. > > I was not able to figure out how it would support them > (datetime.timedelta objects). datetime.datetime objects only as > far as I saw. > > That's right, I forgot about that. Usually, my data would have a starting point anyway, and I just use timedeltas after that point. > So I would have to create some artificial datetime + add the > timedeltas (seconds) to it and providing that to the plot I guess, > right? > > You might be able to get away with using a datetime.time object and add timedeltas. The formatting should be what you would like to see. > So far the solution to just show i.e. 70sec as 00:01:20 via some > little function is almost more sympathetic to me (so far at least). > > Whatever works best for you, that's more important. Note that matplotlib has some special treatment of date, time and datetime objects to do extra things for you. It might be a bit tricky at first, but it becomes easier to use later. Admittedly, these following examples are for dates (and might even need to be updated...) http://matplotlib.sourceforge.net/examples/api/date_demo.html http://matplotlib.sourceforge.net/examples/api/date_index_formatter.html There are others as well. Note that probably half that code can probably be removed for v1.0.x. When I did my graphs a few months ago, I don't recall needing to specify any formatters. Maybe I should dig up my code and update those examples. Cheers, Ben Root |
From: Jorge S. <jor...@ya...> - 2011-06-10 18:08:59
|
Benjamin Root <ben.root@...> writes: > Jorges, > iPython can do some special things with matplotlib's interactivity when > invoked in certain ways (hence why it was called "interactive" python). I > don't know the particulars of what ipython does, but this does not surprise > me. Does everything work as you expect in interactive mode through regular > python? > Ben Root Well, I don't know what's the expected behavior. If I set interactive to no, then my script works OK in python (and also in ipython, btw). If I set it to yes, though, the figures appear and are closed as soon as the script ends in python, and they stay open but with the custom events non-functional in ipython. That might be the expected behavior, and I started to see this behavior because something changed in ipython (maybe the default was non-interactive before, or something more complicated in the way ipython deals with matplotlib). I searched the documentation about details of how interactive works and/or any caveats, but didn't find much, and hence the question here. For now I'll turn off interactive, as that seems to make my scripts work as they did before. Cheers, jorges |
From: calmar c. <ma...@ca...> - 2011-06-10 17:50:38
|
On Fri, Jun 10, 2011 at 11:10:02AM -0500, Benjamin Root wrote: > > Why not just use an array of datetime.timedelta objects?� I believe > matplotlib already supports this, does automatic formatting and even > allows you to easily modify how the formatting is done. I was not able to figure out how it would support them (datetime.timedelta objects). datetime.datetime objects only as far as I saw. So I would have to create some artificial datetime + add the timedeltas (seconds) to it and providing that to the plot I guess, right? So far the solution to just show i.e. 70sec as 00:01:20 via some little function is almost more sympathetic to me (so far at least). Cheers and thanks, marco -- (o_ It rocks: LINUX + Command-Line-Interface //\ GPG: 0x59D90F4D V_/_ http://www.calmar.ws |
From: Benjamin R. <ben...@ou...> - 2011-06-10 16:10:29
|
On Fri, Jun 10, 2011 at 11:01 AM, calmar c. <ma...@ca...> wrote: > On Fri, Jun 10, 2011 at 09:00:28AM -0400, Scott Lasley wrote: > > > > One way would be to use a matplotlib.ticker.FuncFormatter > > > > import matplotlib.pyplot as plt > > import matplotlib.ticker > > > > def HMSFormatter(value, loc): > > h = value // 3600 > > m = (value - h * 3600) // 60 > > s = value % 60 > > return "%02d:%02d:%02d" % (h,m,s) > > > > fig = plt.figure() > > sp = fig.add_subplot(111) > > xaxis = sp.get_xaxis() > > xaxis.set_major_formatter(matplotlib.ticker.FuncFormatter(HMSFormatter)) > > seconds = range(12341,12641,30) > > data = range(10) > > sp.plot(seconds, data) > > fig.canvas.draw() > fig.show() needed here. > > Ah ok, great, many thanks. > > > In the case the x is already HH:MM:SS that's a whole other story I > guess? > > anyway, > cheers > marco > > Why not just use an array of datetime.timedelta objects? I believe matplotlib already supports this, does automatic formatting and even allows you to easily modify how the formatting is done. Ben Root |
From: calmar c. <ma...@ca...> - 2011-06-10 16:01:46
|
On Fri, Jun 10, 2011 at 09:00:28AM -0400, Scott Lasley wrote: > > One way would be to use a matplotlib.ticker.FuncFormatter > > import matplotlib.pyplot as plt > import matplotlib.ticker > > def HMSFormatter(value, loc): > h = value // 3600 > m = (value - h * 3600) // 60 > s = value % 60 > return "%02d:%02d:%02d" % (h,m,s) > > fig = plt.figure() > sp = fig.add_subplot(111) > xaxis = sp.get_xaxis() > xaxis.set_major_formatter(matplotlib.ticker.FuncFormatter(HMSFormatter)) > seconds = range(12341,12641,30) > data = range(10) > sp.plot(seconds, data) > fig.canvas.draw() fig.show() needed here. Ah ok, great, many thanks. In the case the x is already HH:MM:SS that's a whole other story I guess? anyway, cheers marco -- (o_ It rocks: LINUX + Command-Line-Interface //\ GPG: 0x59D90F4D V_/_ http://www.calmar.ws |
From: Benjamin R. <ben...@ou...> - 2011-06-10 15:12:30
|
On Fri, Jun 10, 2011 at 9:24 AM, Jorge Scandaliaris <jor...@ya...>wrote: > Hi, > > Are events supposed to be used in non-interactive mode? I've been having > some > weird issues recently (see > > http://thread.gmane.org/gmane.comp.python.matplotlib.general/26233/focus=26267 > ) > which, just by chance, I pinned down to having matplotlib.interactive(True) > in > my custom ipython's pylab profile. What's the relationship between both > things? > I couldn't find much about interactive mode in the docs. > > Maybe this does not add useful info to the problem, but I have also noticed > a > difference in behavior when running scripts with events handling and > interactive > mode on from ipython compared to python. The figure(s) stay displayed when > using > ipython, although custom events don't work (predefined events like pan/zoom > still work), while in python the figures are closed once the script > finishes. > > At least I have a way now to run my scripts from within ipython, even if I > don't > understand what's going on. > > jorges > > Jorges, iPython can do some special things with matplotlib's interactivity when invoked in certain ways (hence why it was called "interactive" python). I don't know the particulars of what ipython does, but this does not surprise me. Does everything work as you expect in interactive mode through regular python? Ben Root |
From: Jorge S. <jor...@ya...> - 2011-06-10 14:25:23
|
Hi, Are events supposed to be used in non-interactive mode? I've been having some weird issues recently (see http://thread.gmane.org/gmane.comp.python.matplotlib.general/26233/focus=26267) which, just by chance, I pinned down to having matplotlib.interactive(True) in my custom ipython's pylab profile. What's the relationship between both things? I couldn't find much about interactive mode in the docs. Maybe this does not add useful info to the problem, but I have also noticed a difference in behavior when running scripts with events handling and interactive mode on from ipython compared to python. The figure(s) stay displayed when using ipython, although custom events don't work (predefined events like pan/zoom still work), while in python the figures are closed once the script finishes. At least I have a way now to run my scripts from within ipython, even if I don't understand what's going on. jorges |
From: Johannes R. <JRa...@gm...> - 2011-06-10 13:31:55
|
-------- Original-Nachricht -------- > Datum: Fri, 10 Jun 2011 14:40:17 +0200 > Von: Sebastian Berg <seb...@si...> > An: Johannes Radinger <JRa...@gm...> > CC: mat...@li... > Betreff: Re: [Matplotlib-users] fill-between special demand > On Fri, 2011-06-10 at 14:15 +0200, Johannes Radinger wrote: > > Hello, > > > > I know that it is possible to fill an area between to curves (functions) > with "fill between". > > > > In my case I've got let's say 10 curves of different shape. I'd like to > fill the area between the most upper lines and the most lower lines. Is > that somehow possible? One work-around which appeared in my mind was to use > fill-between for all possible combinations of 2 functions out of the 10, but > thats somehow stupid work if there is another possibility... > > > > I hope a made myself clear enough...and hopefully you can help me. > > > > /Johannes > > Hi, > > use numpy to calculate the upper and lower limits first? > > curves = np.random.randn(1000, 10) > plt.fill_between(np.arange(1000), curves.min(1), curves.max(1)) hmm. I am not sure what you mean exactly. In my case i've got following function: def pdf(x,s1,s2,p): return (p/(math.sqrt(2*math.pi*s1**2))*numpy.exp(-((x-0)**(2)/(2*s1**(2)))))+((1-p)/(math.sqrt(2*math.pi*s2**2))*numpy.exp(-((x-0)**(2)/(2*s2**(2))))) and s1,s2 and p are varying... so i have a list like 123, 3215, 0.3 152, 2351, 0.4 521, 4351, 0.6 ... for these three parameters. So the resulting curves are probably intersecting each other and are of different shape. so two questions: 1) what is the best way to supply this list to produce the single curves (about 10) 2) how can I do the fill between to get the "range" of the curves. Maybe you can give me a more detailed example. Thanks /Johannes > > of course if the x values ar enot all the same you will have to > interpolate... > > Regards, > > Sebastian > -- NEU: FreePhone - kostenlos mobil telefonieren! Jetzt informieren: http://www.gmx.net/de/go/freephone |
From: Sebastian B. <seb...@si...> - 2011-06-10 12:40:46
|
On Fri, 2011-06-10 at 14:15 +0200, Johannes Radinger wrote: > Hello, > > I know that it is possible to fill an area between to curves (functions) with "fill between". > > In my case I've got let's say 10 curves of different shape. I'd like to fill the area between the most upper lines and the most lower lines. Is that somehow possible? One work-around which appeared in my mind was to use fill-between for all possible combinations of 2 functions out of the 10, but thats somehow stupid work if there is another possibility... > > I hope a made myself clear enough...and hopefully you can help me. > > /Johannes Hi, use numpy to calculate the upper and lower limits first? curves = np.random.randn(1000, 10) plt.fill_between(np.arange(1000), curves.min(1), curves.max(1)) of course if the x values ar enot all the same you will have to interpolate... Regards, Sebastian |
From: Johannes R. <JRa...@gm...> - 2011-06-10 12:15:16
|
Hello, I know that it is possible to fill an area between to curves (functions) with "fill between". In my case I've got let's say 10 curves of different shape. I'd like to fill the area between the most upper lines and the most lower lines. Is that somehow possible? One work-around which appeared in my mind was to use fill-between for all possible combinations of 2 functions out of the 10, but thats somehow stupid work if there is another possibility... I hope a made myself clear enough...and hopefully you can help me. /Johannes -- NEU: FreePhone - kostenlos mobil telefonieren! Jetzt informieren: http://www.gmx.net/de/go/freephone |