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
(1) |
2
(1) |
3
(9) |
4
(2) |
5
|
6
(6) |
7
(3) |
8
(1) |
9
(6) |
10
(1) |
11
|
12
|
13
(2) |
14
(8) |
15
(2) |
16
|
17
(11) |
18
(5) |
19
(2) |
20
(2) |
21
(4) |
22
(2) |
23
(5) |
24
(6) |
25
|
26
|
27
(2) |
28
(9) |
|
From: Benjamin R. <ben...@ou...> - 2014-02-14 22:13:40
|
I rolled a 20 today for necromancer, so I am going to do a thread resurrection. Given recent improvements in matplotlib, we should definitely make this web-enabled. That way, we can share our nerdiness with our non-nerdy significant others. Happy Valentine's day! Ben On Mon, Feb 14, 2011 at 8:25 PM, Paul Ivanov <piv...@gm...> wrote: > jules hummon, on 2011-02-14 07:23, wrote: > > Feel free to 'save and run', pass along, or ignore. > > This was my valentine's day present today. > > Thank you for sharing! I took the liberty of livening it up for > my sweetheart. > > #--------------------------------------------------- > # hohumheartbeat.py - a more lively hohumheart.py ;) > > import numpy as np > import matplotlib as mpl > import matplotlib.pyplot as plt > from matplotlib.patches import Polygon > > # force square figure and square axes looks better for polar, IMO > width, height = mpl.rcParams['figure.figsize'] > size = min(width, height) > # make a square figure > fig = plt.figure(figsize=(size, size)) > ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True, axisbg='#ffffff') > ax2 = fig.add_axes([0.45, .9, 0.1, 0.1], polar=True, axisbg='#ffffff') > > ax.set_rmax(2.0) > ax2.set_rmax(4.0) > ax2.spines['polar'].set_visible(False) > ax2.patch.set_alpha(.3) > for a in ax,ax2: > a.set_xticks([]) > a.set_yticks([]) > ax.grid(False) > > theta = np.linspace(0,1,100)*np.pi*2 > r = 1*(1-np.cos(theta)) > > ncards = 5 > step = 2*np.pi/ncards > pdict = dict(fc='r',ec='k', alpha=.5) > for ii in range(ncards): > tr = np.column_stack((theta+ii*step, r)) > ax.add_patch(Polygon(tr, **pdict)) > > # from WolframMath "Heart Curve" > r2 = 2 - 2*np.sin(theta) > r2 += np.sin(theta) * np.sqrt(np.abs(np.cos(theta))) / (np.sin(theta)+1.4) > > tr2 = np.column_stack((theta, r2)) > ax2.add_patch(Polygon(tr2,**pdict)) # heart > > kwargs = dict(transform=ax2.transAxes, va='center', fontsize=20) > ax2.text(0,.45,"I",ha='right',**kwargs) > ax2.text(1,.4,"you",ha='left',**kwargs) > > beat = np.tan(np.linspace(0, np.pi*2, 100)) > beat[0:20] = beat[60:80] > beat[-20:] = beat[20:40] > beat -= beat.min() > beat /= beat.max() > > i=0; beatlen = len(beat)-1; > def heartbeat(e): > global i; > i = (i+1) % (beatlen) > y = beat[i] > ax2.set_rmax(y*4. + 4.) > ax2.draw(ax.figure.canvas.get_renderer()) > ax2.figure.canvas.blit(ax2.bbox) > #plt.draw() #use if the last two lines cause trouble > > # even your mouse movements make my heart skip a bit! > cid = ax.figure.canvas.mpl_connect('idle_event', heartbeat) > > print "ax.figure.canvas.mpl_disconnect(%d)" %cid > print "#run the line above to 'flatline' (stop heartbeat)" > plt.show() > > best, > -- > Paul Ivanov > 314 address only used for lists, off-list direct email at: > http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.10 (GNU/Linux) > > iEYEARECAAYFAk1Z1gcACgkQe+cmRQ8+KPccQACgiCFswsMAqJObseb8yn2dHLR3 > UuwAn0xb2MeaQJffHt70/u8T1j6lmuCJ > =0hq/ > -----END PGP SIGNATURE----- > > > ------------------------------------------------------------------------------ > The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: > Pinpoint memory and threading errors before they happen. > Find and fix more than 250 security defects in the development cycle. > Locate bottlenecks in serial and parallel code that limit performance. > http://p.sf.net/sfu/intel-dev2devfeb > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
From: Paul H. <pmh...@gm...> - 2014-02-14 20:36:22
|
Hey Gabriele, See this example here: http://stackoverflow.com/questions/14762181/adding-a-y-axis-label-to-secondary-y-axis-in-matplotlib/14762601#14762601 On Fri, Feb 14, 2014 at 12:32 PM, Gabriele Brambilla < gb....@gm...> wrote: > Hi, > > I'm trying to plot two functions on the same errorbar picture like the > code below: > > fmlp = plt.figure() > > axop = fmlp.add_subplot(111) > > insp = axop.errorbar(g, Pampli, yerr = ePampli, fmt = '.') > ins1 = axop.errorbar(g, lightcurva, yerr = zeros, fmt = 'x') > > axop.set_title('amplitudes for phases') > > fmlp.canvas.draw() > > but the two functions has a very different range in y values (one near > 10^-15 one near 1): how could I use two different scale (one per function) > on the same plot? > > thanks > > > ------------------------------------------------------------------------------ > Android apps run on BlackBerry 10 > Introducing the new BlackBerry 10.2.1 Runtime for Android apps. > Now with support for Jelly Bean, Bluetooth, Mapview and more. > Get your Android app in front of a whole new audience. Start now. > > http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
From: Gabriele B. <gb....@gm...> - 2014-02-14 20:32:21
|
Hi, I'm trying to plot two functions on the same errorbar picture like the code below: fmlp = plt.figure() axop = fmlp.add_subplot(111) insp = axop.errorbar(g, Pampli, yerr = ePampli, fmt = '.') ins1 = axop.errorbar(g, lightcurva, yerr = zeros, fmt = 'x') axop.set_title('amplitudes for phases') fmlp.canvas.draw() but the two functions has a very different range in y values (one near 10^-15 one near 1): how could I use two different scale (one per function) on the same plot? thanks |
From: Andreas H. <li...@hi...> - 2014-02-14 16:44:21
|
>> Is there a way to have subplots_adjust() automatically chose left, >> right, bottom, top values so that everything that's been drawn tightly >> fits the figure? > What about plt.tight_layout() ? > (or fig.tight_layout ) Yes, thanks, Pierre! Andreas. |
From: Benjamin Trendelkamp-S. <tre...@ze...> - 2014-02-14 10:04:37
|
Hi, I think there is an import warnings statement missing in the setupext.py file in the matplotlib-1.3.1 source package. Adding the missing import made the installation from source work for me. Maybe someone can doublecheck that. Best, Benjamin -- Benjamin Trendelkamp-Schroer Freie Universität Berlin FB Mathematik + Informatik Institut für Mathematik Arnimallee 6 D-14195 Berlin-Dahlem tre...@ze... +49-(0)30-838-75364 |
From: Gaute H. <eg...@ga...> - 2014-02-14 09:20:29
|
Greetings list, I am trying to figure out the differences between mlab.specgram and MATLABs spectrogram functions. I am mostly interested in MATLABs [.., P] output which is the PSD for each segment. It seems to me that the output of mlab.specgram's (Pxx, ..) is in fact the equivialent of MATLABSs [.., P] and not [S, ...], is this correct? Thanks, Gaute |
From: Pierre H. <pie...@cr...> - 2014-02-14 07:46:07
|
Hi Andreas, Le 14/02/2014 08:12, Andreas Hilboll a écrit : > Is there a way to have subplots_adjust() automatically chose left, > right, bottom, top values so that everything that's been drawn tightly > fits the figure? What about plt.tight_layout() ? (or fig.tight_layout ) best, Pierre |
From: Andreas H. <li...@hi...> - 2014-02-14 07:37:09
|
I need some help in saving effort to make a figure fill its canvas: Is there a way to have subplots_adjust() automatically chose left, right, bottom, top values so that everything that's been drawn tightly fits the figure? Basically I'm looking for something similar to bbox_inclues='tight' in savefig, except that I want the figure dimensions to stay the same and have the contents of the figure adjust to the figsize so that no space is wasted. Obviously, the hspace and wspace in subplots_adjust would still have to be choseable by the user. Any ideas? -- Andreas. |
From: Paul H. <pmh...@gm...> - 2014-02-13 14:56:05
|
It's not the wrong place, per se. But I think if you created an issue on the github repository, it's less likely to get lost in the ether. https://github.com/matplotlib/basemap On Wed, Feb 12, 2014 at 7:17 PM, Roman Olson <rom...@un...>wrote: > Hi All, > > I am new to this list so I apologize if this is supposed to be posted > somewhere else. > > Just wanted to report that there is missing documentation in > mpl_toolkits.basemap Basemap for a couple of keyword arguments, namely > o_lon_p and o_lat_p. > > (If this is the wrong place to post this please let me know an email to > report problems or bugs). > > Cheers, > -Roman > > Roman Olson > Postdoctoral Research Associate > Climate Change Research Centre > University of New South Wales > > > ------------------------------------------------------------------------------ > Android apps run on BlackBerry 10 > Introducing the new BlackBerry 10.2.1 Runtime for Android apps. > Now with support for Jelly Bean, Bluetooth, Mapview and more. > Get your Android app in front of a whole new audience. Start now. > > http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
From: Roman O. <rom...@un...> - 2014-02-13 03:30:47
|
Hi All, I am new to this list so I apologize if this is supposed to be posted somewhere else. Just wanted to report that there is missing documentation in mpl_toolkits.basemap Basemap for a couple of keyword arguments, namely o_lon_p and o_lat_p. (If this is the wrong place to post this please let me know an email to report problems or bugs). Cheers, -Roman Roman Olson Postdoctoral Research Associate Climate Change Research Centre University of New South Wales |
From: Nicolas F. <nic...@gm...> - 2014-02-10 00:52:41
|
Hi Gary To get more control on which grid shows / doesn't, you can do: ax1.grid('on') ax2.grid('off') instead of: plt.grid() Nico On 9/02/2014, at 5:34 pm, mat...@li... wrote: > Message: 1 > Date: Sat, 8 Feb 2014 17:29:16 -0800 > From: "garyr" <ga...@fi...> > Subject: [Matplotlib-users] twinx and grid > To: <mat...@li...> > Message-ID: <4ADC6E5C7E0B41E48913F2C42408B5E6@owner59bf8d40c> > Content-Type: text/plain; format=flowed; charset="iso-8859-1"; > reply-type=original > > The script below labels both the left and right x-axes and shows a grid. Is > there a way to force the horizontal grid lines to line up with the tic marks on > the left axis (ax1)? > > import numpy as np > import matplotlib.pyplot as plt > fig = plt.figure() > ax1 = fig.add_subplot(111) > t = np.arange(0.01, 10.0, 0.01) > s1 = np.exp(t) > ax1.plot(t, s1, 'b-') > ax2 = ax1.twinx() > s2 = np.sin(2*np.pi*t) > ax2.plot(t, s2, 'r') > plt.grid() > plt.show() > > -- Dr. Nicolas Fauchereau Climate Scientist – National Climate Centre National Institute of Water and Atmospheric Research (NIWA) Ltd. 41 Market Place Viaduct Precinct, Auckland NEW ZEALAND Tel: +64 (0)9 375 2053 |
From: Sivaram N. <nsi...@gm...> - 2014-02-09 13:54:42
|
I'd appreciate some pointers on how to get a barchart of the following --8<---------------cut here---------------start------------->8--- date|name|empid|app|subapp|hours 20140101|A|0001|IIC|I1|2.5 20140101|A|0001|IIC|I2|3 20140101|A|0001|IIC|I3|4 20140101|A|0001|CAR|C1|2.5 20140101|A|0001|CAR|C2|3 20140101|A|0001|CAR|C3|2 20140101|A|0001|CAR|C4|2 --8<---------------cut here---------------end--------------->8--- I've got the above in a panda dataframe df and I'd like to plot them as blue: 3 bars of IIC (I1-I3) of the hours, bar labelled with subapp and hours on top of the bar red: 4 bars of CAR (C1-C5) of the hours, bar labelled with subapp and hours on top of the bar on the y axis with the date on the x axis. sivaram -- |
From: Matt S. <ma...@pl...> - 2014-02-09 12:57:06
|
Hey matplotlib users, Hi, I'm with Plotly <http://plot.ly>. We thought we'd let you know you can convert matplotlib code to Plotly graphs and our Python API <http://plot.ly>to make interactive, online graphs in Plotly. Your graphs are styled with D3, in the browser, and store your data too. Once you make a graph with the API, you can edit it with a GUI, share it, and embed it. Here is an example translation<http://nbviewer.ipython.org/gist/arsenovic/8375182>, in an IPython Notebook. This feature is something still quite early and that we're exploring (GitHub thread <https://github.com/plotly/python-api/issues/3>). So we'd very much appreciate your advice and suggestions. As a new team, getting suggestions from folks with insider knowledge goes a long way. All my best, Matt |
From: Goyo <goy...@gm...> - 2014-02-09 11:59:15
|
2014-02-09 2:29 GMT+01:00 garyr <ga...@fi...>: > The script below labels both the left and right x-axes and shows a grid. Is > there a way to force the horizontal grid lines to line up with the tic marks on > the left axis (ax1)? > > import numpy as np > import matplotlib.pyplot as plt > fig = plt.figure() > ax1 = fig.add_subplot(111) > t = np.arange(0.01, 10.0, 0.01) > s1 = np.exp(t) > ax1.plot(t, s1, 'b-') > ax2 = ax1.twinx() > s2 = np.sin(2*np.pi*t) > ax2.plot(t, s2, 'r') > plt.grid() > plt.show() plt.grid() affects the current axes so calling it before creating the second one should do. I think it would be more consistent if you used the method ax1.grid() though. Goyo |
From: Joe K. <jof...@gm...> - 2014-02-09 04:34:55
|
Hi Yi, I also posted this as an answer to your question on SO, but here's how I'd approach it. It's simplest to just have a "DraggablePoints" class that accepts multiple artists. That way you can synchronize which artist is "active" and ignore the others. As an example, based on yours: import matplotlib.pyplot as plt import matplotlib.patches as patches class DraggablePoints(object): def __init__(self, artists, tolerance=5): for artist in artists: artist.set_picker(tolerance) self.artists = artists self.currently_dragging = False self.current_artist = None self.offset = (0, 0) for canvas in set(artist.figure.canvas for artist in self.artists): canvas.mpl_connect('button_press_event', self.on_press) canvas.mpl_connect('button_release_event', self.on_release) canvas.mpl_connect('pick_event', self.on_pick) canvas.mpl_connect('motion_notify_event', self.on_motion) def on_press(self, event): self.currently_dragging = True def on_release(self, event): self.currently_dragging = False self.current_artist = None def on_pick(self, event): if self.current_artist is None: self.current_artist = event.artist x0, y0 = event.artist.center x1, y1 = event.mouseevent.xdata, event.mouseevent.ydata self.offset = (x0 - x1), (y0 - y1) def on_motion(self, event): if not self.currently_dragging: return if self.current_artist is None: return dx, dy = self.offset self.current_artist.center = event.xdata + dx, event.ydata + dy self.current_artist.figure.canvas.draw() if __name__ == '__main__': fig, ax = plt.subplots() ax.set(xlim=[-1, 2], ylim=[-1, 2]) circles = [patches.Circle((0.32, 0.3), 0.2, fc='r', alpha=0.5), patches.Circle((0.3, 0.3), 0.2, fc='b', alpha=0.5)] for circ in circles: ax.add_patch(circ) dr = DraggablePoints(circles) plt.show() Hope that helps! -Joe On Sat, Feb 8, 2014 at 7:32 PM, Yi <ide...@gm...> wrote: > Hi Matplotlib community: > > In my case, I only want to drag one point each time. However, since the > two points are heavily overlapping, dragging one point would cause another > point to be dragged. How can I only drag one of the point? Thank you! > > > from pylab import *from scipy import *import matplotlib.pyplot as pltimport matplotlib.patches as patches > > class DraggablePoint: > def __init__(self, p): > self.point = p > self.press = None > > def connect(self): > self.cidpress = self.point.figure.canvas.mpl_connect('button_press_event', self.button_press_event) > self.cidrelease = self.point.figure.canvas.mpl_connect('button_release_event', self.button_release_event) > self.cidmotion = self.point.figure.canvas.mpl_connect('motion_notify_event', self.motion_notify_event) > > def disconnect(self): > 'disconnect all the stored connection ids' > self.point.figure.canvas.mpl_disconnect(self.cidpress) > self.point.figure.canvas.mpl_disconnect(self.cidrelease) > self.point.figure.canvas.mpl_disconnect(self.cidmotion) > > > def button_press_event(self,event): > if event.inaxes != self.point.axes: > return > contains = self.point.contains(event)[0] > if not contains: return > self.press = self.point.center, event.xdata, event.ydata > > > def button_release_event(self,event): > self.press = None > self.point.figure.canvas.draw() > > def motion_notify_event(self, event): > if self.press is None: return > if event.inaxes != self.point.axes: return > self.point.center, xpress, ypress = self.press > dx = event.xdata - xpress > dy = event.ydata - ypress > self.point.center = (self.point.center[0]+dx, self.point.center[1]+dy) > print self.point.center > self.point.figure.canvas.draw() > if __name__ == '__main__': > fig = plt.figure() > ax = fig.add_subplot(111) > ax.set_xlim(-1,2) > ax.set_ylim(-1,2) > circles = [] > circle1 = patches.Circle((0.32,0.3), 0.2, fc='r', alpha=0.5, picker=True) > circle = patches.Circle((0.3,0.3), 0.2, fc='b', alpha=0.5, picker=True) > circles.append(ax.add_patch(circle1)) > circles.append(ax.add_patch(circle)) > drs = [] > for c in circles: > #print c.center[0] > dr = DraggablePoint(c) > dr.connect() > drs.append(dr) > plt.show() > > > > > ------------------------------------------------------------------------------ > Managing the Performance of Cloud-Based Applications > Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. > Read the Whitepaper. > > http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
From: garyr <ga...@fi...> - 2014-02-09 01:51:50
|
The script below labels both the left and right x-axes and shows a grid. Is there a way to force the horizontal grid lines to line up with the tic marks on the left axis (ax1)? import numpy as np import matplotlib.pyplot as plt fig = plt.figure() ax1 = fig.add_subplot(111) t = np.arange(0.01, 10.0, 0.01) s1 = np.exp(t) ax1.plot(t, s1, 'b-') ax2 = ax1.twinx() s2 = np.sin(2*np.pi*t) ax2.plot(t, s2, 'r') plt.grid() plt.show() |
From: Yi <ide...@gm...> - 2014-02-09 01:33:17
|
Hi Matplotlib community: In my case, I only want to drag one point each time. However, since the two points are heavily overlapping, dragging one point would cause another point to be dragged. How can I only drag one of the point? Thank you! from pylab import *from scipy import *import matplotlib.pyplot as pltimport matplotlib.patches as patches class DraggablePoint: def __init__(self, p): self.point = p self.press = None def connect(self): self.cidpress = self.point.figure.canvas.mpl_connect('button_press_event', self.button_press_event) self.cidrelease = self.point.figure.canvas.mpl_connect('button_release_event', self.button_release_event) self.cidmotion = self.point.figure.canvas.mpl_connect('motion_notify_event', self.motion_notify_event) def disconnect(self): 'disconnect all the stored connection ids' self.point.figure.canvas.mpl_disconnect(self.cidpress) self.point.figure.canvas.mpl_disconnect(self.cidrelease) self.point.figure.canvas.mpl_disconnect(self.cidmotion) def button_press_event(self,event): if event.inaxes != self.point.axes: return contains = self.point.contains(event)[0] if not contains: return self.press = self.point.center, event.xdata, event.ydata def button_release_event(self,event): self.press = None self.point.figure.canvas.draw() def motion_notify_event(self, event): if self.press is None: return if event.inaxes != self.point.axes: return self.point.center, xpress, ypress = self.press dx = event.xdata - xpress dy = event.ydata - ypress self.point.center = (self.point.center[0]+dx, self.point.center[1]+dy) print self.point.center self.point.figure.canvas.draw() if __name__ == '__main__': fig = plt.figure() ax = fig.add_subplot(111) ax.set_xlim(-1,2) ax.set_ylim(-1,2) circles = [] circle1 = patches.Circle((0.32,0.3), 0.2, fc='r', alpha=0.5, picker=True) circle = patches.Circle((0.3,0.3), 0.2, fc='b', alpha=0.5, picker=True) circles.append(ax.add_patch(circle1)) circles.append(ax.add_patch(circle)) drs = [] for c in circles: #print c.center[0] dr = DraggablePoint(c) dr.connect() drs.append(dr) plt.show() |
From: Alan G I. <ai...@am...> - 2014-02-08 17:48:25
|
The documentation for FuncAnimation says http://matplotlib.org/api/animation_api.html#matplotlib.animation.FuncAnimation Makes an animation by repeatedly calling a function func, passing in (optional) arguments in fargs. frames can be a generator, an iterable, or a number of frames. I do not think FuncAnimation can be understood from this documentation. (At least, I did not understand it.) I think it should read: Makes an animation by repeatedly calling a function `func`, passing in a value from `frames` and any (optional) arguments in `fargs`. `frames` can be a generator, an iterable, or an integer number of frames. Passing `frames=n` for integer `n` is equivalent to passing `range(n)`. Does this seem correct? Thanks, Alan Isaac PS It would be nice if repeat accepted an integer number of repetitions. |
From: mariusz s. <mar...@gm...> - 2014-02-07 18:24:04
|
Yes I did. I'm using version 1.2 on linux. A friend of mine runs similar scripts on windows and she has no problems. Can it have something to do with version number? On Fri, Feb 7, 2014 at 6:56 PM, Sterling Smith <sm...@fu...>wrote: > Claude, > > Did you try > ax3 = ax1.twinx() > ? > > -Sterling > > On Feb 7, 2014, at 1:30AM, mariusz sapinski wrote: > > > Hi, I'm trying to get a plot with multiple axes on the righ, and it > does not work. Attached is the plot: the second axis (ax2) is not correctly > plotted. The code is below. What is wrong? Why the labels and ticks are > displayed on the left axis? > > > > Many thanks for your suggestions, > > > > Claude > > > > > ... > > # Q signal axis: > > ax2 = ax1.twinx() > ... > > # Q heaters: > > ax3 = ax2.twinx() > > |
From: Sterling S. <sm...@fu...> - 2014-02-07 17:56:46
|
Claude, Did you try ax3 = ax1.twinx() ? -Sterling On Feb 7, 2014, at 1:30AM, mariusz sapinski wrote: > Hi, I'm trying to get a plot with multiple axes on the righ, and it does not work. Attached is the plot: the second axis (ax2) is not correctly plotted. The code is below. What is wrong? Why the labels and ticks are displayed on the left axis? > > Many thanks for your suggestions, > > Claude > > ... > # Q signal axis: > ax2 = ax1.twinx() ... > # Q heaters: > ax3 = ax2.twinx() |
From: mariusz s. <mar...@gm...> - 2014-02-07 09:30:13
|
Hi, I'm trying to get a plot with multiple axes on the righ, and it does not work. Attached is the plot: the second axis (ax2) is not correctly plotted. The code is below. What is wrong? Why the labels and ticks are displayed on the left axis? Many thanks for your suggestions, Claude import numpy import pylab # function needed: def make_patch_spines_invisible(ax): ax.set_frame_on(True) ax.patch.set_visible(False) for sp in ax.spines.itervalues(): sp.set_visible(False) # lists: timeBLM=[] sigBLM=[] timeQPS=[] sigQPS=[] # file to open: file = open("WSQT_PMdata.csv","r") for line in file: tokens=line.split() i=len(tokens) timeBLM.append(float(tokens[0])) sigBLM.append(float(tokens[1])) if i==4: timeQPS.append(float(tokens[2])) sigQPS.append(float(tokens[3])) file.close() # convert lists to numpy arrays: NtimeQPS = numpy.array(timeQPS) NsigQPS = numpy.array(sigQPS) NtimeBLM = numpy.array(timeBLM) NsigBLM = numpy.array(sigBLM) #now also QPS heaters: timeHeaters=numpy.array([-0.56, 0, 0.003, 0.005, 0.01, 0.015, 0.02, 0.025]) sigHeaters=numpy.array([2.999,2.753,2.316,1.960,1.667,1.422,1.218,1.047]) # B data: fig = pylab.figure(1,figsize=(8,6)) pylab.grid(True) pylab.title("Wire scanner quech test data") fig.autofmt_xdate() fig.subplots_adjust(right=0.77) ax1 = fig.add_subplot(111) ax1.set_xlabel("time [s]",fontsize=15) ax1.set_ylabel("BLM signal [Gy/s]",fontsize=15) ax1.set_xlim([-0.1,0.027]) ax1.set_ylim([0.,3.]); ax1.plot(NtimeBLM,NsigBLM,'black',label='BLM signal') # Q signal axis: ax2 = ax1.twinx() ax2.set_ylabel("QPS voltage [V]",fontsize=15,color = 'red') ax2.set_xlim([-0.1,0.027]) ax2.set_ylim([-0.01,0.3]) for tl2 in ax2.get_yticklabels(): tl2.set_color('red') tl2.set_fontsize(15) ax2.plot(NtimeQPS,NsigQPS,color='red',lw=2.5,label = 'QPS signal') # Q heaters: ax3 = ax2.twinx() make_patch_spines_invisible(ax3) ax3.spines["right"].set_position(("axes", 1.2)) ax3.spines["right"].set_visible(True) ax3.set_ylabel("quench heaters", fontsize=15, color = 'green') ax3.set_xlim([-0.1,0.03]) ax3.set_ylim([0.,5.]) ax3.set_color('green') for tl in ax3.get_yticklabels(): tl.set_color('green') tl.set_fontsize(15) ax3.plot(timeHeaters,sigHeaters,color = 'green',lw=2.5,label = 'quench heaters') # check object ID print 'idax1=',id(ax1) print 'idax2=',id(ax2) print 'idax3=',id(ax3) handles1, labels1 = ax1.get_legend_handles_labels() handles2, labels2 = ax2.get_legend_handles_labels() handles3, labels3 = ax3.get_legend_handles_labels() ax1.legend(handles1+handles2+handles3, labels1+labels2+labels3,loc =(0.07,0.75),prop={'size':11}, shadow = False) # show plot on the screen: pylab.show() |
From: Pedro M. <ped...@gm...> - 2014-02-06 18:20:34
|
Yes , I am using the plot_wireframe. Pedro On Thursday, February 6, 2014, Benjamin Root <ben...@ou...> wrote: > I am not sure, but it sounds like you are talking about plot_wireframe()? > > Ben Root > |
From: Mario M. <me...@me...> - 2014-02-06 16:49:14
|
Hi all, I'm trying to make a contourf plot out of 3 2d fields, where one is seconds since 1970. This works! But my problem is the formatting of the xaxes. These I like to have in hh:mm. Since the time is a 2d field, a conversion to datetime didn't work. The other way I tried was plotting a second axis with x as 1d datetime, y (1d) and z as before, removing the collections, plotting the original data and deleting the xticks and labels. But i didn't succeed with that. i get a year out of range error. Any help would be appreciated. here is a small code peace that could help to understand what i like to do. from matplotlib import pyplot, dates import numpy as np x = np.array([[1387029209.,1387029310.,1387029411.,1387029512.], [1387029209.,1387029310.,1387029411.,1387029512.], [1387029209.,1387029310.,1387029411.,1387029512.]]) y = np.array([[143., 143., 133., 143.], [172., 162., 122., 172.], [201., 241., 201., 201.]]) z = np.random.rand(3,4) fig = pyplot.figure() dnt = dates.num2date(dates.epoch2num(x[0])) ax2 = fig.add_axes([0.1,0.1,0.8,0.8]) c = ax2.contour(dnt,y[:,0],z) for coll in c.collections: ax2.collections.remove(coll) ax2.patch.set_alpha(0.0) time_format = dates.DateFormatter('%H:%M') ax2.xaxis.set_major_formatter(time_format) ax1 = fig.add_axes([0.1,0.1,0.8,0.8]) ax1.contourf(x,y,z) #ax1.tick_params(axis='x',which='both',bottom='off',top='off',labelbottom='off') pyplot.show() -- Dr. Mario Mech Institute for Geophysics and Meteorology University of Cologne Pohligstr.3 / Room 3.120 50969 Cologne Germany t: +49(0)221-470-1776 f: +49(0)221-470-5198 e: me...@me... w: http://www.uni-koeln.de/~mmech/ |
From: Benjamin R. <ben...@ou...> - 2014-02-06 14:39:35
|
I am not sure, but it sounds like you are talking about plot_wireframe()? Ben Root |
From: Michael M. <mic...@gm...> - 2014-02-06 02:10:50
|
I'm new to Matplotlib and not sure if it's right for my application. I would like to build a simple audio (sound file) editor with the use of Matplotlib. It will plot a waveform, hence the usefulness of matplotlib. I will also need the user to be able to select regions of the waveform by dragging the mouse or perhaps by clicking at the start and end. I want the regions to be highlighted. I also need a playback cursor.. a line that travels along the waveform as it gets played back. So is there a way to add to Matplotlib custom responses to drags and clicks? Something like an animated playback cursor (moving line)? Can these be based on natural features of Matplotlib or would I have to hack it? Thanks, Mike |