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) |
|
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 --
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
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
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 > >
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()
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()