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
|
From: liu l. <pol...@gm...> - 2015-03-11 14:05:51
|
I dont understand you say it is the first axe but why in my case, only the second legend is draggable? it is in the second axe besides, since I have to use both y-axis on the left and on the right, it seems I have to have two axes, are there any workarounds? thanks! On Wed, Mar 11, 2015 at 2:22 PM, Thomas Caswell <tca...@gm...> wrote: > The mouse events only propagate to the top axes. You will have to add > both legends to the same (top) axes. > > See http://matplotlib.org/users/legend_guide.html#multiple-legend > > > Tom > On Wed, Mar 11, 2015, 08:57 liu lily <pol...@gm...> wrote: > >> Hi, all: >> >> I have two legends, as below, I find that I can't drag the first legend, >> what is the problem? how to deal with it? thanks! >> >> import matplotlib.pyplot as plt >> >> fig1, ax1 = plt.subplots() >> ax2 = ax1.twinx() >> >> ax1.plot([1,2,3],[0.1,0.82,0.3],'y*', label="one") >> ax2.plot([1,2,3],[5,6,7],'ro', label="two") >> >> leg1 = ax1.legend() >> leg2 = ax2.legend() >> >> leg1.draggable(state=True) >> leg2.draggable(state=True) >> plt.show() >> >> ------------------------------------------------------------ >> ------------------ >> Dive into the World of Parallel Programming The Go Parallel Website, >> sponsored >> by Intel and developed in partnership with Slashdot Media, is your hub >> for all >> things parallel software development, from weekly thought leadership >> blogs to >> news, videos, case studies, tutorials and more. Take a look and join the >> conversation now. http://goparallel.sourceforge.net/ >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > |
From: Thomas C. <tca...@gm...> - 2015-03-11 13:22:48
|
The mouse events only propagate to the top axes. You will have to add both legends to the same (top) axes. See http://matplotlib.org/users/legend_guide.html#multiple-legend Tom On Wed, Mar 11, 2015, 08:57 liu lily <pol...@gm...> wrote: > Hi, all: > > I have two legends, as below, I find that I can't drag the first legend, > what is the problem? how to deal with it? thanks! > > import matplotlib.pyplot as plt > > fig1, ax1 = plt.subplots() > ax2 = ax1.twinx() > > ax1.plot([1,2,3],[0.1,0.82,0.3],'y*', label="one") > ax2.plot([1,2,3],[5,6,7],'ro', label="two") > > leg1 = ax1.legend() > leg2 = ax2.legend() > > leg1.draggable(state=True) > leg2.draggable(state=True) > plt.show() > > ------------------------------------------------------------ > ------------------ > Dive into the World of Parallel Programming The Go Parallel Website, > sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for > all > things parallel software development, from weekly thought leadership blogs > to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: liu l. <pol...@gm...> - 2015-03-11 12:56:56
|
Hi, all: I have two legends, as below, I find that I can't drag the first legend, what is the problem? how to deal with it? thanks! import matplotlib.pyplot as plt fig1, ax1 = plt.subplots() ax2 = ax1.twinx() ax1.plot([1,2,3],[0.1,0.82,0.3],'y*', label="one") ax2.plot([1,2,3],[5,6,7],'ro', label="two") leg1 = ax1.legend() leg2 = ax2.legend() leg1.draggable(state=True) leg2.draggable(state=True) plt.show() |
From: Prahas D. N. <pra...@gm...> - 2015-03-10 16:41:56
|
@ Adam -- thanks! @ Everyone: given the Lorenz code shared, is there a way to generate a log file of the x,y,z points generated? Thanks in advance. --Prahas On Tue, Mar 10, 2015 at 8:59 AM, Adam Hughes <hug...@gm...> wrote: > That's pretty swag! > > On Tue, Mar 10, 2015 at 11:49 AM, Benjamin Root <ben...@ou...> wrote: >> >> +1000!! >> >> Great job! Would you mind if I clean it up a bit and add it to the >> mplot3d/animation gallery? Full credit, of course. >> >> >> On Tue, Mar 10, 2015 at 11:30 AM, Prahas David Nafissian >> <pra...@gm...> wrote: >>> >>> Friends, >>> >>> I thought you'd like to see the solution. >>> >>> Many thanks to Jake Vanderplas for his code and teachings: >>> >>> >>> https://jakevdp.github.io/blog/2013/02/16/animating-the-lorentz-system-in-3d/ >>> >>> If you start a new IP Notebook session, run as your first entry: >>> >>> %pylab >>> >>> and then copy and paste the text below and run it, you should be good to >>> go >>> (on a Mac, at least). >>> >>> There are several parameters I've changed from his original, and I've >>> commented as I've changed. The original code is at the link above. >>> >>> There is one error in his code -- I've documented it below. >>> >>> Again, thanks to the community, Jake, and Ben Root. >>> >>> --Prahas >>> >>> ****************** >>> >>> import numpy as np >>> from scipy import integrate >>> >>> from matplotlib import pyplot as plt >>> from mpl_toolkits.mplot3d import Axes3D >>> from matplotlib.colors import cnames >>> from matplotlib import animation >>> >>> # orig value of N_traj was 20 -- very cool this way. >>> >>> N_trajectories = 1 >>> >>> def lorentz_deriv((x, y, z), t0, sigma=10., beta=8./3, rho=28.0): >>> """Compute the time-derivative of a Lorentz system.""" >>> return [sigma * (y - x), x * (rho - z) - y, x * y - beta * z] >>> >>> # Choose random starting points, uniformly distributed from -15 to 15 >>> >>> np.random.seed(1) >>> >>> # changing from -15,30 to 10,5 below starts the drawing in the middle, >>> # rather than getting the long line from below.... >>> # if using N_Traj > 1, return to orig values. >>> >>> # x0 = -15 + 30 * np.random.random((N_trajectories, 3)) >>> >>> x0 = 10 + 5 * np.random.random((N_trajectories, 3)) >>> >>> >>> # Solve for the trajectories >>> >>> # orig values: 0,4,1000 >>> # 3rd value -- lower it, it gets choppier. >>> # 2nd value -- increase it -- more points, but speedier. >>> >>> # change middle num from 4 to 15 -- this adds points!!!!!!!! >>> >>> t = np.linspace(0, 40, 3000) >>> x_t = np.asarray([integrate.odeint(lorentz_deriv, x0i, t) >>> for x0i in x0]) >>> >>> # Set up figure & 3D axis for animation >>> fig = plt.figure() >>> ax = fig.add_axes([0, 0, 1, 1], projection='3d') >>> >>> # changing off to on below adds axises. slows it down but you >>> # can fix that with interval value in the animation call >>> >>> ax.axis('on') >>> >>> # choose a different color for each trajectory >>> colors = plt.cm.jet(np.linspace(0, 1, N_trajectories)) >>> >>> # set up lines and points -- this is a correction from >>> # the orig jake code. the next four lines... >>> >>> lines = [ax.plot([], [], [], '-', c=c)[0] >>> for c in colors] >>> pts = [ax.plot([], [], [], 'o', c=c)[0] >>> for c in colors] >>> >>> # prepare the axes limits >>> ax.set_xlim((-25, 25)) >>> ax.set_ylim((-35, 35)) >>> ax.set_zlim((5, 55)) >>> >>> # set point-of-view: specified by (altitude degrees, azimuth degrees) >>> ax.view_init(30, 0) >>> >>> # initialization function: plot the background of each frame >>> def init(): >>> for line, pt in zip(lines, pts): >>> line.set_data([], []) >>> line.set_3d_properties([]) >>> >>> pt.set_data([], []) >>> pt.set_3d_properties([]) >>> return lines + pts >>> >>> # animation function. This will be called sequentially with the frame >>> number >>> def animate(i): >>> # we'll step two time-steps per frame. This leads to nice results. >>> >>> i = (2 * i) % x_t.shape[1] >>> >>> for line, pt, xi in zip(lines, pts, x_t): >>> x, y, z = xi[:i].T >>> line.set_data(x, y) >>> line.set_3d_properties(z) >>> >>> pt.set_data(x[-1:], y[-1:]) >>> pt.set_3d_properties(z[-1:]) >>> >>> # changed 0.3 to 0.05 below -- this slows the rotation of the >>> view. >>> # changed 30 to 20 below >>> # changing 20 to (20 + (.1 * i)) rotates on the Z axis. trippy. >>> >>> ax.view_init(10, 0.1 * i) >>> # ax.view_init(10, 100) >>> fig.canvas.draw() >>> return lines + pts >>> >>> # instantiate the animator. I've deleted the blit switch (for Mac) >>> # enlarging frames=500 works now -- it failed before because I didn't >>> give it >>> # enough data -- by changing the t=np.linspace line above I generate >>> more points. >>> # interval larger slows it down >>> # changed inteval from 30 to 200, frames from 500 to 3000 >>> >>> anim = animation.FuncAnimation(fig, animate, init_func=init, >>> frames=3000, interval=200) >>> >>> # Save as mp4. This requires mplayer or ffmpeg to be installed. >>> COMPLEX!!!!! >>> # Instead, use a screen record program: Quicktime on the Mac; MS >>> Expression Encoder on PC. >>> # anim.save('PDNlorentz_attractor.mp4', fps=15, extra_args=['-vcodec', >>> 'libx264']) >>> >>> plt.show() >>> >>> ******************************** >>> >>> >>> ------------------------------------------------------------------------------ >>> Dive into the World of Parallel Programming The Go Parallel Website, >>> sponsored >>> by Intel and developed in partnership with Slashdot Media, is your hub >>> for all >>> things parallel software development, from weekly thought leadership >>> blogs to >>> news, videos, case studies, tutorials and more. Take a look and join the >>> conversation now. http://goparallel.sourceforge.net/ >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> >> >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming The Go Parallel Website, >> sponsored >> by Intel and developed in partnership with Slashdot Media, is your hub for >> all >> things parallel software development, from weekly thought leadership blogs >> to >> news, videos, case studies, tutorials and more. Take a look and join the >> conversation now. http://goparallel.sourceforge.net/ >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > |
From: Adam H. <hug...@gm...> - 2015-03-10 15:59:20
|
That's pretty swag! On Tue, Mar 10, 2015 at 11:49 AM, Benjamin Root <ben...@ou...> wrote: > +1000!! > > Great job! Would you mind if I clean it up a bit and add it to the > mplot3d/animation gallery? Full credit, of course. > > > On Tue, Mar 10, 2015 at 11:30 AM, Prahas David Nafissian < > pra...@gm...> wrote: > >> Friends, >> >> I thought you'd like to see the solution. >> >> Many thanks to Jake Vanderplas for his code and teachings: >> >> >> https://jakevdp.github.io/blog/2013/02/16/animating-the-lorentz-system-in-3d/ >> >> If you start a new IP Notebook session, run as your first entry: >> >> %pylab >> >> and then copy and paste the text below and run it, you should be good to >> go >> (on a Mac, at least). >> >> There are several parameters I've changed from his original, and I've >> commented as I've changed. The original code is at the link above. >> >> There is one error in his code -- I've documented it below. >> >> Again, thanks to the community, Jake, and Ben Root. >> >> --Prahas >> >> ****************** >> >> import numpy as np >> from scipy import integrate >> >> from matplotlib import pyplot as plt >> from mpl_toolkits.mplot3d import Axes3D >> from matplotlib.colors import cnames >> from matplotlib import animation >> >> # orig value of N_traj was 20 -- very cool this way. >> >> N_trajectories = 1 >> >> def lorentz_deriv((x, y, z), t0, sigma=10., beta=8./3, rho=28.0): >> """Compute the time-derivative of a Lorentz system.""" >> return [sigma * (y - x), x * (rho - z) - y, x * y - beta * z] >> >> # Choose random starting points, uniformly distributed from -15 to 15 >> >> np.random.seed(1) >> >> # changing from -15,30 to 10,5 below starts the drawing in the middle, >> # rather than getting the long line from below.... >> # if using N_Traj > 1, return to orig values. >> >> # x0 = -15 + 30 * np.random.random((N_trajectories, 3)) >> >> x0 = 10 + 5 * np.random.random((N_trajectories, 3)) >> >> >> # Solve for the trajectories >> >> # orig values: 0,4,1000 >> # 3rd value -- lower it, it gets choppier. >> # 2nd value -- increase it -- more points, but speedier. >> >> # change middle num from 4 to 15 -- this adds points!!!!!!!! >> >> t = np.linspace(0, 40, 3000) >> x_t = np.asarray([integrate.odeint(lorentz_deriv, x0i, t) >> for x0i in x0]) >> >> # Set up figure & 3D axis for animation >> fig = plt.figure() >> ax = fig.add_axes([0, 0, 1, 1], projection='3d') >> >> # changing off to on below adds axises. slows it down but you >> # can fix that with interval value in the animation call >> >> ax.axis('on') >> >> # choose a different color for each trajectory >> colors = plt.cm.jet(np.linspace(0, 1, N_trajectories)) >> >> # set up lines and points -- this is a correction from >> # the orig jake code. the next four lines... >> >> lines = [ax.plot([], [], [], '-', c=c)[0] >> for c in colors] >> pts = [ax.plot([], [], [], 'o', c=c)[0] >> for c in colors] >> >> # prepare the axes limits >> ax.set_xlim((-25, 25)) >> ax.set_ylim((-35, 35)) >> ax.set_zlim((5, 55)) >> >> # set point-of-view: specified by (altitude degrees, azimuth degrees) >> ax.view_init(30, 0) >> >> # initialization function: plot the background of each frame >> def init(): >> for line, pt in zip(lines, pts): >> line.set_data([], []) >> line.set_3d_properties([]) >> >> pt.set_data([], []) >> pt.set_3d_properties([]) >> return lines + pts >> >> # animation function. This will be called sequentially with the frame >> number >> def animate(i): >> # we'll step two time-steps per frame. This leads to nice results. >> >> i = (2 * i) % x_t.shape[1] >> >> for line, pt, xi in zip(lines, pts, x_t): >> x, y, z = xi[:i].T >> line.set_data(x, y) >> line.set_3d_properties(z) >> >> pt.set_data(x[-1:], y[-1:]) >> pt.set_3d_properties(z[-1:]) >> >> # changed 0.3 to 0.05 below -- this slows the rotation of the >> view. >> # changed 30 to 20 below >> # changing 20 to (20 + (.1 * i)) rotates on the Z axis. trippy. >> >> ax.view_init(10, 0.1 * i) >> # ax.view_init(10, 100) >> fig.canvas.draw() >> return lines + pts >> >> # instantiate the animator. I've deleted the blit switch (for Mac) >> # enlarging frames=500 works now -- it failed before because I didn't >> give it >> # enough data -- by changing the t=np.linspace line above I generate >> more points. >> # interval larger slows it down >> # changed inteval from 30 to 200, frames from 500 to 3000 >> >> anim = animation.FuncAnimation(fig, animate, init_func=init, >> frames=3000, interval=200) >> >> # Save as mp4. This requires mplayer or ffmpeg to be installed. >> COMPLEX!!!!! >> # Instead, use a screen record program: Quicktime on the Mac; MS >> Expression Encoder on PC. >> # anim.save('PDNlorentz_attractor.mp4', fps=15, extra_args=['-vcodec', >> 'libx264']) >> >> plt.show() >> >> ******************************** >> >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming The Go Parallel Website, >> sponsored >> by Intel and developed in partnership with Slashdot Media, is your hub >> for all >> things parallel software development, from weekly thought leadership >> blogs to >> news, videos, case studies, tutorials and more. Take a look and join the >> conversation now. http://goparallel.sourceforge.net/ >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, > sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for > all > things parallel software development, from weekly thought leadership blogs > to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
From: Prahas D. N. <pra...@gm...> - 2015-03-10 15:54:01
|
I think you need to ask Jake Vanderplas -- the code is all his! See the link in the email to get to his blog... Thanks again! On Tue, Mar 10, 2015 at 8:49 AM, Benjamin Root <ben...@ou...> wrote: > +1000!! > > Great job! Would you mind if I clean it up a bit and add it to the > mplot3d/animation gallery? Full credit, of course. > > > On Tue, Mar 10, 2015 at 11:30 AM, Prahas David Nafissian > <pra...@gm...> wrote: >> >> Friends, >> >> I thought you'd like to see the solution. >> >> Many thanks to Jake Vanderplas for his code and teachings: >> >> >> https://jakevdp.github.io/blog/2013/02/16/animating-the-lorentz-system-in-3d/ >> >> If you start a new IP Notebook session, run as your first entry: >> >> %pylab >> >> and then copy and paste the text below and run it, you should be good to >> go >> (on a Mac, at least). >> >> There are several parameters I've changed from his original, and I've >> commented as I've changed. The original code is at the link above. >> >> There is one error in his code -- I've documented it below. >> >> Again, thanks to the community, Jake, and Ben Root. >> >> --Prahas >> >> ****************** >> >> import numpy as np >> from scipy import integrate >> >> from matplotlib import pyplot as plt >> from mpl_toolkits.mplot3d import Axes3D >> from matplotlib.colors import cnames >> from matplotlib import animation >> >> # orig value of N_traj was 20 -- very cool this way. >> >> N_trajectories = 1 >> >> def lorentz_deriv((x, y, z), t0, sigma=10., beta=8./3, rho=28.0): >> """Compute the time-derivative of a Lorentz system.""" >> return [sigma * (y - x), x * (rho - z) - y, x * y - beta * z] >> >> # Choose random starting points, uniformly distributed from -15 to 15 >> >> np.random.seed(1) >> >> # changing from -15,30 to 10,5 below starts the drawing in the middle, >> # rather than getting the long line from below.... >> # if using N_Traj > 1, return to orig values. >> >> # x0 = -15 + 30 * np.random.random((N_trajectories, 3)) >> >> x0 = 10 + 5 * np.random.random((N_trajectories, 3)) >> >> >> # Solve for the trajectories >> >> # orig values: 0,4,1000 >> # 3rd value -- lower it, it gets choppier. >> # 2nd value -- increase it -- more points, but speedier. >> >> # change middle num from 4 to 15 -- this adds points!!!!!!!! >> >> t = np.linspace(0, 40, 3000) >> x_t = np.asarray([integrate.odeint(lorentz_deriv, x0i, t) >> for x0i in x0]) >> >> # Set up figure & 3D axis for animation >> fig = plt.figure() >> ax = fig.add_axes([0, 0, 1, 1], projection='3d') >> >> # changing off to on below adds axises. slows it down but you >> # can fix that with interval value in the animation call >> >> ax.axis('on') >> >> # choose a different color for each trajectory >> colors = plt.cm.jet(np.linspace(0, 1, N_trajectories)) >> >> # set up lines and points -- this is a correction from >> # the orig jake code. the next four lines... >> >> lines = [ax.plot([], [], [], '-', c=c)[0] >> for c in colors] >> pts = [ax.plot([], [], [], 'o', c=c)[0] >> for c in colors] >> >> # prepare the axes limits >> ax.set_xlim((-25, 25)) >> ax.set_ylim((-35, 35)) >> ax.set_zlim((5, 55)) >> >> # set point-of-view: specified by (altitude degrees, azimuth degrees) >> ax.view_init(30, 0) >> >> # initialization function: plot the background of each frame >> def init(): >> for line, pt in zip(lines, pts): >> line.set_data([], []) >> line.set_3d_properties([]) >> >> pt.set_data([], []) >> pt.set_3d_properties([]) >> return lines + pts >> >> # animation function. This will be called sequentially with the frame >> number >> def animate(i): >> # we'll step two time-steps per frame. This leads to nice results. >> >> i = (2 * i) % x_t.shape[1] >> >> for line, pt, xi in zip(lines, pts, x_t): >> x, y, z = xi[:i].T >> line.set_data(x, y) >> line.set_3d_properties(z) >> >> pt.set_data(x[-1:], y[-1:]) >> pt.set_3d_properties(z[-1:]) >> >> # changed 0.3 to 0.05 below -- this slows the rotation of the >> view. >> # changed 30 to 20 below >> # changing 20 to (20 + (.1 * i)) rotates on the Z axis. trippy. >> >> ax.view_init(10, 0.1 * i) >> # ax.view_init(10, 100) >> fig.canvas.draw() >> return lines + pts >> >> # instantiate the animator. I've deleted the blit switch (for Mac) >> # enlarging frames=500 works now -- it failed before because I didn't give >> it >> # enough data -- by changing the t=np.linspace line above I generate >> more points. >> # interval larger slows it down >> # changed inteval from 30 to 200, frames from 500 to 3000 >> >> anim = animation.FuncAnimation(fig, animate, init_func=init, >> frames=3000, interval=200) >> >> # Save as mp4. This requires mplayer or ffmpeg to be installed. >> COMPLEX!!!!! >> # Instead, use a screen record program: Quicktime on the Mac; MS >> Expression Encoder on PC. >> # anim.save('PDNlorentz_attractor.mp4', fps=15, extra_args=['-vcodec', >> 'libx264']) >> >> plt.show() >> >> ******************************** >> >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming The Go Parallel Website, >> sponsored >> by Intel and developed in partnership with Slashdot Media, is your hub for >> all >> things parallel software development, from weekly thought leadership blogs >> to >> news, videos, case studies, tutorials and more. Take a look and join the >> conversation now. http://goparallel.sourceforge.net/ >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
From: Benjamin R. <ben...@ou...> - 2015-03-10 15:49:47
|
+1000!! Great job! Would you mind if I clean it up a bit and add it to the mplot3d/animation gallery? Full credit, of course. On Tue, Mar 10, 2015 at 11:30 AM, Prahas David Nafissian < pra...@gm...> wrote: > Friends, > > I thought you'd like to see the solution. > > Many thanks to Jake Vanderplas for his code and teachings: > > > https://jakevdp.github.io/blog/2013/02/16/animating-the-lorentz-system-in-3d/ > > If you start a new IP Notebook session, run as your first entry: > > %pylab > > and then copy and paste the text below and run it, you should be good to go > (on a Mac, at least). > > There are several parameters I've changed from his original, and I've > commented as I've changed. The original code is at the link above. > > There is one error in his code -- I've documented it below. > > Again, thanks to the community, Jake, and Ben Root. > > --Prahas > > ****************** > > import numpy as np > from scipy import integrate > > from matplotlib import pyplot as plt > from mpl_toolkits.mplot3d import Axes3D > from matplotlib.colors import cnames > from matplotlib import animation > > # orig value of N_traj was 20 -- very cool this way. > > N_trajectories = 1 > > def lorentz_deriv((x, y, z), t0, sigma=10., beta=8./3, rho=28.0): > """Compute the time-derivative of a Lorentz system.""" > return [sigma * (y - x), x * (rho - z) - y, x * y - beta * z] > > # Choose random starting points, uniformly distributed from -15 to 15 > > np.random.seed(1) > > # changing from -15,30 to 10,5 below starts the drawing in the middle, > # rather than getting the long line from below.... > # if using N_Traj > 1, return to orig values. > > # x0 = -15 + 30 * np.random.random((N_trajectories, 3)) > > x0 = 10 + 5 * np.random.random((N_trajectories, 3)) > > > # Solve for the trajectories > > # orig values: 0,4,1000 > # 3rd value -- lower it, it gets choppier. > # 2nd value -- increase it -- more points, but speedier. > > # change middle num from 4 to 15 -- this adds points!!!!!!!! > > t = np.linspace(0, 40, 3000) > x_t = np.asarray([integrate.odeint(lorentz_deriv, x0i, t) > for x0i in x0]) > > # Set up figure & 3D axis for animation > fig = plt.figure() > ax = fig.add_axes([0, 0, 1, 1], projection='3d') > > # changing off to on below adds axises. slows it down but you > # can fix that with interval value in the animation call > > ax.axis('on') > > # choose a different color for each trajectory > colors = plt.cm.jet(np.linspace(0, 1, N_trajectories)) > > # set up lines and points -- this is a correction from > # the orig jake code. the next four lines... > > lines = [ax.plot([], [], [], '-', c=c)[0] > for c in colors] > pts = [ax.plot([], [], [], 'o', c=c)[0] > for c in colors] > > # prepare the axes limits > ax.set_xlim((-25, 25)) > ax.set_ylim((-35, 35)) > ax.set_zlim((5, 55)) > > # set point-of-view: specified by (altitude degrees, azimuth degrees) > ax.view_init(30, 0) > > # initialization function: plot the background of each frame > def init(): > for line, pt in zip(lines, pts): > line.set_data([], []) > line.set_3d_properties([]) > > pt.set_data([], []) > pt.set_3d_properties([]) > return lines + pts > > # animation function. This will be called sequentially with the frame > number > def animate(i): > # we'll step two time-steps per frame. This leads to nice results. > > i = (2 * i) % x_t.shape[1] > > for line, pt, xi in zip(lines, pts, x_t): > x, y, z = xi[:i].T > line.set_data(x, y) > line.set_3d_properties(z) > > pt.set_data(x[-1:], y[-1:]) > pt.set_3d_properties(z[-1:]) > > # changed 0.3 to 0.05 below -- this slows the rotation of the view. > # changed 30 to 20 below > # changing 20 to (20 + (.1 * i)) rotates on the Z axis. trippy. > > ax.view_init(10, 0.1 * i) > # ax.view_init(10, 100) > fig.canvas.draw() > return lines + pts > > # instantiate the animator. I've deleted the blit switch (for Mac) > # enlarging frames=500 works now -- it failed before because I didn't give > it > # enough data -- by changing the t=np.linspace line above I generate > more points. > # interval larger slows it down > # changed inteval from 30 to 200, frames from 500 to 3000 > > anim = animation.FuncAnimation(fig, animate, init_func=init, > frames=3000, interval=200) > > # Save as mp4. This requires mplayer or ffmpeg to be installed. > COMPLEX!!!!! > # Instead, use a screen record program: Quicktime on the Mac; MS > Expression Encoder on PC. > # anim.save('PDNlorentz_attractor.mp4', fps=15, extra_args=['-vcodec', > 'libx264']) > > plt.show() > > ******************************** > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, > sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for > all > things parallel software development, from weekly thought leadership blogs > to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Prahas D. N. <pra...@gm...> - 2015-03-10 15:30:29
|
Friends, I thought you'd like to see the solution. Many thanks to Jake Vanderplas for his code and teachings: https://jakevdp.github.io/blog/2013/02/16/animating-the-lorentz-system-in-3d/ If you start a new IP Notebook session, run as your first entry: %pylab and then copy and paste the text below and run it, you should be good to go (on a Mac, at least). There are several parameters I've changed from his original, and I've commented as I've changed. The original code is at the link above. There is one error in his code -- I've documented it below. Again, thanks to the community, Jake, and Ben Root. --Prahas ****************** import numpy as np from scipy import integrate from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib.colors import cnames from matplotlib import animation # orig value of N_traj was 20 -- very cool this way. N_trajectories = 1 def lorentz_deriv((x, y, z), t0, sigma=10., beta=8./3, rho=28.0): """Compute the time-derivative of a Lorentz system.""" return [sigma * (y - x), x * (rho - z) - y, x * y - beta * z] # Choose random starting points, uniformly distributed from -15 to 15 np.random.seed(1) # changing from -15,30 to 10,5 below starts the drawing in the middle, # rather than getting the long line from below.... # if using N_Traj > 1, return to orig values. # x0 = -15 + 30 * np.random.random((N_trajectories, 3)) x0 = 10 + 5 * np.random.random((N_trajectories, 3)) # Solve for the trajectories # orig values: 0,4,1000 # 3rd value -- lower it, it gets choppier. # 2nd value -- increase it -- more points, but speedier. # change middle num from 4 to 15 -- this adds points!!!!!!!! t = np.linspace(0, 40, 3000) x_t = np.asarray([integrate.odeint(lorentz_deriv, x0i, t) for x0i in x0]) # Set up figure & 3D axis for animation fig = plt.figure() ax = fig.add_axes([0, 0, 1, 1], projection='3d') # changing off to on below adds axises. slows it down but you # can fix that with interval value in the animation call ax.axis('on') # choose a different color for each trajectory colors = plt.cm.jet(np.linspace(0, 1, N_trajectories)) # set up lines and points -- this is a correction from # the orig jake code. the next four lines... lines = [ax.plot([], [], [], '-', c=c)[0] for c in colors] pts = [ax.plot([], [], [], 'o', c=c)[0] for c in colors] # prepare the axes limits ax.set_xlim((-25, 25)) ax.set_ylim((-35, 35)) ax.set_zlim((5, 55)) # set point-of-view: specified by (altitude degrees, azimuth degrees) ax.view_init(30, 0) # initialization function: plot the background of each frame def init(): for line, pt in zip(lines, pts): line.set_data([], []) line.set_3d_properties([]) pt.set_data([], []) pt.set_3d_properties([]) return lines + pts # animation function. This will be called sequentially with the frame number def animate(i): # we'll step two time-steps per frame. This leads to nice results. i = (2 * i) % x_t.shape[1] for line, pt, xi in zip(lines, pts, x_t): x, y, z = xi[:i].T line.set_data(x, y) line.set_3d_properties(z) pt.set_data(x[-1:], y[-1:]) pt.set_3d_properties(z[-1:]) # changed 0.3 to 0.05 below -- this slows the rotation of the view. # changed 30 to 20 below # changing 20 to (20 + (.1 * i)) rotates on the Z axis. trippy. ax.view_init(10, 0.1 * i) # ax.view_init(10, 100) fig.canvas.draw() return lines + pts # instantiate the animator. I've deleted the blit switch (for Mac) # enlarging frames=500 works now -- it failed before because I didn't give it # enough data -- by changing the t=np.linspace line above I generate more points. # interval larger slows it down # changed inteval from 30 to 200, frames from 500 to 3000 anim = animation.FuncAnimation(fig, animate, init_func=init, frames=3000, interval=200) # Save as mp4. This requires mplayer or ffmpeg to be installed. COMPLEX!!!!! # Instead, use a screen record program: Quicktime on the Mac; MS Expression Encoder on PC. # anim.save('PDNlorentz_attractor.mp4', fps=15, extra_args=['-vcodec', 'libx264']) plt.show() ******************************** |
From: Eric F. <ef...@ha...> - 2015-03-10 07:28:00
|
On 2015/03/09 8:56 PM, Marin GILLES wrote: > Actually, I just brute loaded mpl for source... I am not really used to it. > So I guess I'll have to make a virtual env and install mpl in it? You have to build and install it somewhere, where it will be found when you try to import it; whether you use a virtual env is up to you. I managed for years without using virtual envs. Recently I've found them quite helpful, but a bit tricky and confusing at times. Eric |
From: Marin G. <mrn...@gm...> - 2015-03-10 06:56:55
|
Le 10/03/2015 07:52, Eric Firing a écrit : > On 2015/03/09 8:14 PM, Marin GILLES wrote: >> Hi, >> As suggested in PR 2702 >> <https://github.com/matplotlib/matplotlib/pull/2702>, I have been trying >> to tell |scatter| to |get_current_color_cycle| for the facecolor. I >> guess I can use |axes.get_color()|to get the current color in the color >> cycle. >> However, I was not able to try this, as when I try to import pyplot I >> get an |ImportError: No module named _path|. It seems to be library >> related, but I’m not quite sure how I can solve this… > It sounds like your installation is broken; _path is an extension module > compiled from C++, and central to matplotlib's functionality. > > In what environment are you working? Did this failure arise after you > modified code and then executed "python setup.py install" or something > of that sort? > > Eric > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for all > things parallel software development, from weekly thought leadership blogs to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users Actually, I just brute loaded mpl for source... I am not really used to it. So I guess I'll have to make a virtual env and install mpl in it? -- *Marin GILLES* /PhD student CNRS / /Laboratoire Interdisciplinaire Carnot de Bourgogne (ICB) UMR 6303 CNRS - Université de Bourgogne 9 av Alain Savary, BP 47870 21078, Dijon (France) / ☎ (+33)6.79.35.30.11 ✉ mar...@u-... <mailto:mar...@u-...> |
From: Eric F. <ef...@ha...> - 2015-03-10 06:52:45
|
On 2015/03/09 8:14 PM, Marin GILLES wrote: > Hi, > As suggested in PR 2702 > <https://github.com/matplotlib/matplotlib/pull/2702>, I have been trying > to tell |scatter| to |get_current_color_cycle| for the facecolor. I > guess I can use |axes.get_color()|to get the current color in the color > cycle. > However, I was not able to try this, as when I try to import pyplot I > get an |ImportError: No module named _path|. It seems to be library > related, but I’m not quite sure how I can solve this… It sounds like your installation is broken; _path is an extension module compiled from C++, and central to matplotlib's functionality. In what environment are you working? Did this failure arise after you modified code and then executed "python setup.py install" or something of that sort? Eric |
From: Marin G. <mrn...@gm...> - 2015-03-10 06:14:44
|
Le 06/03/2015 22:42, Marin GILLES a écrit : > This package is indeeed pretty nice, and I will surely take a look > into it, but the way styles are added does not seem quite practical or > shareable. > In my opinion, having a style file for each paper makes things more > flexible, although this package may get more control out of the box. > Also, not being built-in makes you install an other package, and I > think some people either do not want to do it, nor know how to do it. > > On an other topic, I started working on some of the features you > wanted to integrate with your PR > <https://github.com/matplotlib/matplotlib/pull/2702>. I guessed that > when you talked about adding the |set_ticks_location| to the rcParams, > you wanted to control whether the ticks are in or out of the axes box? > > Finally, I added a |style| parameter to the rcParams. It lets you > choose from your |matplotlibrc| which style you want to use. On top of > that, I made it recursive, so that you can design a style directly > from other styles. > The only thing I could not get to work was to have your style loading > directly when importing matplotlib (when defining from your rc file). > You actually have to import the |matplotlib.style| lib to get your rc > defined style to load up. > > I will continue working on the other features described in olga’s PR > <https://github.com/matplotlib/matplotlib/pull/2702> before submitting > one on my own. But if you want to take a look, and tell me how I can > improve what I did, you can find it on my repo > <https://github.com/Mrngilles/matplotlib>. > > Thanks > Marin > > Le 06/03/2015 22:18, Olga Botvinnik a écrit : > >> There's also the "plotsettings" package which makes it easy to switch >> between styles required by different papers. >> >> https://pypi.python.org/pypi/plotsettings >> >> On Wed, Mar 4, 2015 at 1:29 PM Marin GILLES <mrn...@gm... >> <mailto:mrn...@gm...>> wrote: >> >> Le 04/03/2015 06:21, Tony Yu a écrit : >>> On Tue, Mar 3, 2015 at 11:50 AM, Gökhan Sever >>> <gok...@gm... <mailto:gok...@gm...>> wrote: >>> >>> I see seaborn has "paper, notebook, talk, and poster" options. >>> http://stanford.edu/~mwaskom/software/seaborn-dev/aesthetics.html >>> <http://stanford.edu/%7Emwaskom/software/seaborn-dev/aesthetics.html> >>> Apperantly he scales each parameter to get modified views. >>> This would be a good addition for any of the styles >>> available in matplotlib. >>> >>> >>> A similar pattern with `matplotlib.style` would use chained >>> stylesheets. The idea would be to make stylesheets either >>> aesthetics focused or layout focused. By aesthetics, I mean >>> things like colors and marker shape, and by layout, I mean >>> things like default figure size, figure padding, font size, etc. >>> Then you can easily have a style that defines the general >>> aesthetics and easily modify it for papers, talks, etc. >>> >>> Here's an example from `mpltools`, but the same syntax applies >>> to the `style` module in `matplotlib`: >>> >>> http://tonysyu.github.io/mpltools/auto_examples/style/plot_multiple_styles.html >>> >>> (PoF = Physics of Fluids journal; IIRC I think I have some >>> personal stylesheets that take the normal two-column figure >>> layout and convert it to a full-page layout.) >>> >>> -Tony >>> >>> >>> On Tue, Mar 3, 2015 at 12:35 PM, Marin GILLES >>> <mrn...@gm... <mailto:mrn...@gm...>> wrote: >>> >>> Le 03/03/2015 18:15, Gökhan Sever a écrit : >>>> >>>> >>>> On Tue, Mar 3, 2015 at 12:07 PM, Marin GILLES >>>> <mrn...@gm... <mailto:mrn...@gm...>> wrote: >>>> >>>>> >>>> Sure, I'll be careful about that. >>>> I'm going to go try and design some new interesting >>>> ones. >>>> Maybe adding some styles specific to some plot >>>> types could be useful. >>>> Also some styles specific for some applications >>>> (geoscience, biology)? >>>> If you have any other ideas, please let me know. >>>> >>>> -- >>>> *Marin GILLES* >>>> >>>> >>>> It would be good to have styles for "paper" and >>>> "presentation" modes. The former would have smaller >>>> ticks, labels, linewidths, other axis elements that >>>> goes into a journal publication, while the latter with >>>> much magnified elements to be clearly visible on a >>>> screen from the back of a room. >>> Indeed it would be a very good idea. >>> I've seen that already in the seaborn lib I guess. >>> >>> -- >>> *Marin GILLES* >>> /PhD student CNRS >>> / /Laboratoire Interdisciplinaire Carnot de Bourgogne (ICB) >>> UMR 6303 CNRS - Université de Bourgogne >>> 9 av Alain Savary, BP 47870 >>> 21078, Dijon (France) >>> / ☎ (+33)6.79.35.30.11 <tel:%28%2B33%296.79.35.30.11> >>> ✉ mar...@u-... >>> <mailto:mar...@u-...> >>> >>> >>> >>> >>> -- >>> Gökhan >>> >>> ------------------------------------------------------------------------------ >>> Dive into the World of Parallel Programming The Go Parallel >>> Website, sponsored >>> by Intel and developed in partnership with Slashdot Media, >>> is your hub for all >>> things parallel software development, from weekly thought >>> leadership blogs to >>> news, videos, case studies, tutorials and more. Take a look >>> and join the >>> conversation now. http://goparallel.sourceforge.net/ >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> <mailto:Mat...@li...> >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >>> >> Hi, >> >> I started working on styles based on which support the figure is >> designed for (as of now, I've got 'paper', 'notebook', 'talk', >> 'poster'). >> >> For those, in a style point of view, I think only the text size >> should be modified (got it done, just need to get the proper >> sizes for each style), which is unlike the 'seaborn' way of doing >> it. Thing is, by doing so, we don't mess with any style we could >> apply using Cascading styles. >> >> Also, I was thinking that I should set the export settings for >> each of those styles, but also get an export style folder (with a >> few good parameters). This would mean no more need to adjust dpi, >> file format, figure size... >> >> Finally, I could add a folder for specific papers, in which the >> figure parameters would be tweaked so that we can directly be in >> a specific paper format. I guess it would take into account both >> text size and export parameters for each paper. >> >> Let me know what you think about it. >> >> >> Marin Gilles >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming The Go Parallel >> Website, sponsored >> by Intel and developed in partnership with Slashdot Media, is >> your hub for all >> things parallel software development, from weekly thought >> leadership blogs to >> news, videos, case studies, tutorials and more. Take a look and >> join the >> conversation now. >> http://goparallel.sourceforge.net/_______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> <mailto:Mat...@li...> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > Hi, As suggested in PR 2702 <https://github.com/matplotlib/matplotlib/pull/2702>, I have been trying to tell |scatter| to |get_current_color_cycle| for the facecolor. I guess I can use |axes.get_color()|to get the current color in the color cycle. However, I was not able to try this, as when I try to import pyplot I get an |ImportError: No module named _path|. It seems to be library related, but I’m not quite sure how I can solve this… Thanks -- *Marin GILLES* /PhD student CNRS / /Laboratoire Interdisciplinaire Carnot de Bourgogne (ICB) UMR 6303 CNRS - Université de Bourgogne 9 av Alain Savary, BP 47870 21078, Dijon (France) / ☎ (+33)6.79.35.30.11 ✉ mar...@u-... <mailto:mar...@u-...> |
From: Benjamin R. <ben...@ou...> - 2015-03-09 18:57:53
|
You might need to put parentheses around the statement for the lambda... formatter = FuncFormatter(lambda x, pos: ("%d" % x/10)) Also, a tweak to my code. Change most of the "plt" to "ax" and use the appropriate methods. I suspect that the ipython session you are in is messing up the pyplot state machine and so being explicit for which axes object you are operating on can prevent those blank plots. ax.plot(D.dtrajs[0]) ax.set_ylabel('O2-Fe distance') ax.set_xlabel('Frame') plt.show() Cheers! Ben Root On Mon, Mar 9, 2015 at 2:49 PM, Christian Jorgensen <chr...@gm...> wrote: > I want to thank the users for their invaluable help. > > > > > My final error concerns the plotting: > > > > <ipython-input-157-043a2bfb8704> in <lambda>(x, pos)----> 1 formatter = FuncFormatter(lambda x, pos: "%d" % x/10) 2 3 fig, ax = plt.subplots() 4 ax.yaxis.set_major_formatter(formatter) 5 a= plt.plot(D.dtrajs[0]) > TypeError: unsupported operand type(s) for /: 'str' and 'int' > > > > > > On Mon, Mar 9, 2015 at 6:40 PM, Christian Jorgensen <chr...@gm...> > wrote: > >> Sterling, >> >> this doesn't work, as it's using the array as a function >> >> x = D.dtrajs[0](range(len(D.dtrajs[0]))) >> >> plt.plot(D.dtrajs[0]) >> >> plt.ylabel('O2-Fe distance') >> >> plt.xlabel('Frame') >> >> >> >> ---------------------------------------------------------------------------TypeError Traceback (most recent call last)<ipython-input-147-8bbee6b254c1> in <module>()----> 1 x = D.dtrajs[0](range(len(D.dtrajs[0]))) 2 plt.plot(D.dtrajs[0]) 3 plt.ylabel('O2-Fe distance') 4 plt.xlabel('Frame') >> TypeError: 'numpy.ndarray' object is not callable >> >> >> >> On Mon, Mar 9, 2015 at 6:35 PM, Christian Jorgensen <chr...@gm...> >> wrote: >> >>> Thanks, >>> >>> >>> I ran Benjamin's code but it doesn't display the >>> figure anymore. It only prints a text about the figure >>> >>> >>> formatter = FuncFormatter(lambda x, pos: "%d" % x/10) >>> >>> >>> >>> fig, ax = plt.subplots() >>> >>> ax.yaxis.set_major_formatter(formatter) >>> >>> plt.plot(D.dtrajs[0]) >>> >>> plt.ylabel('O2-Fe distance') >>> >>> plt.xlabel('Frame') >>> >>> plt.show() >>> >>> <matplotlib.figure.Figure at 0x11b1f2090> >>> >>> >>> >>> >>> >>> On Mon, Mar 9, 2015 at 6:16 PM, Benjamin Root <ben...@ou...> wrote: >>> >>>> Or just do this: >>>> >>>> formatter = FuncFormatter(lambda x, pos: "%d" % x/10) >>>> fig, ax = plt.subplots()ax.yaxis.set_major_formatter(formatter)plt.plot(D.dtrajs[0]) >>>> plt.ylabel('O2-Fe distance') >>>> plt.xlabel('Frame') >>>> plt.show() >>>> >>>> >>>> >>>> On Mon, Mar 9, 2015 at 2:11 PM, Sterling Smith <sm...@fu...> >>>> wrote: >>>> >>>>> Christian, >>>>> >>>>> To define your x coordinate, try >>>>> x = range(len(array)) >>>>> x = x/10. >>>>> plot(x,array) >>>>> >>>>> -Sterling >>>>> >>>>> On Mar 9, 2015, at 10:57AM, Christian Jorgensen <chr...@gm...> >>>>> wrote: >>>>> >>>>> > >>>>> > My array does not have an explicit x-coordinate >>>>> > representation. The x-coordinate is simply the index. >>>>> > >>>>> > print(array) >>>>> > [ 0 0 20 ..., 8 8 8] >>>>> > >>>>> > >>>>> > Thus what I would like is to adjoin the element >>>>> > index as another row, how is this possible? >>>>> > >>>>> > >>>>> > I cannot format x because it is not explicitly defined. >>>>> > >>>>> > >>>>> > >>>>> > On Mon, Mar 9, 2015 at 5:52 PM, Benjamin Root<ben...@ou...> >>>>> wrote: >>>>> > Ok, this really should be simple (and I am sure it is), but I >>>>> cannot, for the life of me, find the appropriate documentation for it. We >>>>> need better documentation about how to utilize the offset-text feature of >>>>> tickers. It can be either a multiple offset or an additive offset. >>>>> > >>>>> > In any case, I know there is a better way to do this, but here is a >>>>> quick-n-dirty example that can get you where you want. Just modify the >>>>> formatter used by the tickers to report the value as divided by 10. >>>>> > http://matplotlib.org/examples/pylab_examples/custom_ticker1.html >>>>> > >>>>> > Cheers! >>>>> > Ben Root >>>>> > >>>>> > >>>>> > On Mon, Mar 9, 2015 at 1:38 PM, Christian Jorgensen< >>>>> chr...@gm...> wrote: >>>>> > How can I scale my x-axis [0,3000] for the data to now >>>>> correspond/show up >>>>> > as [0, 300]? >>>>> > >>>>> > >>>>> > In xmgrace, this is done with a linear transformation, but I cannot >>>>> seem >>>>> > to find the command to do this with matplotlib. >>>>> > >>>>> > Best >>>>> > >>>>> > >>>>> > >>>>> > >>>>> ------------------------------------------------------------------------------ >>>>> > Dive into the World of Parallel Programming The Go Parallel Website, >>>>> sponsored >>>>> > by Intel and developed in partnership with Slashdot Media, is your >>>>> hub for all >>>>> > things parallel software development, from weekly thought leadership >>>>> blogs to >>>>> > news, videos, case studies, tutorials and more. Take a look and join >>>>> the >>>>> > conversation now. http://goparallel.sourceforge.net/ >>>>> > _______________________________________________ >>>>> > Matplotlib-users mailing list >>>>> > Mat...@li... >>>>> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > -- >>>>> > _______ >>>>> > >>>>> > Christian Jørgensen >>>>> > >>>>> > >>>>> > >>>>> > -- >>>>> > _______ >>>>> > >>>>> > Christian Jørgensen >>>>> > >>>>> ------------------------------------------------------------------------------ >>>>> > Dive into the World of Parallel Programming The Go Parallel Website, >>>>> sponsored >>>>> > by Intel and developed in partnership with Slashdot Media, is your >>>>> hub for all >>>>> > things parallel software development, from weekly thought leadership >>>>> blogs to >>>>> > news, videos, case studies, tutorials and more. Take a look and join >>>>> the >>>>> > conversation now. >>>>> http://goparallel.sourceforge.net/_______________________________________________ >>>>> > Matplotlib-users mailing list >>>>> > Mat...@li... >>>>> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>>>> >>>>> >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> Dive into the World of Parallel Programming The Go Parallel Website, >>>>> sponsored >>>>> by Intel and developed in partnership with Slashdot Media, is your hub >>>>> for all >>>>> things parallel software development, from weekly thought leadership >>>>> blogs to >>>>> news, videos, case studies, tutorials and more. Take a look and join >>>>> the >>>>> conversation now. http://goparallel.sourceforge.net/ >>>>> _______________________________________________ >>>>> Matplotlib-users mailing list >>>>> Mat...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>>>> >>>> >>>> >>> >>> >>> -- >>> _______ >>> >>> Christian Jørgensen >>> >> >> >> >> -- >> _______ >> >> Christian Jørgensen >> > > > > -- > _______ > > Christian Jørgensen > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, > sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for > all > things parallel software development, from weekly thought leadership blogs > to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
From: Christian J. <chr...@gm...> - 2015-03-09 18:49:14
|
I want to thank the users for their invaluable help. My final error concerns the plotting: <ipython-input-157-043a2bfb8704> in <lambda>(x, pos)----> 1 formatter = FuncFormatter(lambda x, pos: "%d" % x/10) 2 3 fig, ax = plt.subplots() 4 ax.yaxis.set_major_formatter(formatter) 5 a= plt.plot(D.dtrajs[0]) TypeError: unsupported operand type(s) for /: 'str' and 'int' On Mon, Mar 9, 2015 at 6:40 PM, Christian Jorgensen <chr...@gm...> wrote: > Sterling, > > this doesn't work, as it's using the array as a function > > x = D.dtrajs[0](range(len(D.dtrajs[0]))) > > plt.plot(D.dtrajs[0]) > > plt.ylabel('O2-Fe distance') > > plt.xlabel('Frame') > > > > ---------------------------------------------------------------------------TypeError Traceback (most recent call last)<ipython-input-147-8bbee6b254c1> in <module>()----> 1 x = D.dtrajs[0](range(len(D.dtrajs[0]))) 2 plt.plot(D.dtrajs[0]) 3 plt.ylabel('O2-Fe distance') 4 plt.xlabel('Frame') > TypeError: 'numpy.ndarray' object is not callable > > > > On Mon, Mar 9, 2015 at 6:35 PM, Christian Jorgensen <chr...@gm...> > wrote: > >> Thanks, >> >> >> I ran Benjamin's code but it doesn't display the >> figure anymore. It only prints a text about the figure >> >> >> formatter = FuncFormatter(lambda x, pos: "%d" % x/10) >> >> >> >> fig, ax = plt.subplots() >> >> ax.yaxis.set_major_formatter(formatter) >> >> plt.plot(D.dtrajs[0]) >> >> plt.ylabel('O2-Fe distance') >> >> plt.xlabel('Frame') >> >> plt.show() >> >> <matplotlib.figure.Figure at 0x11b1f2090> >> >> >> >> >> >> On Mon, Mar 9, 2015 at 6:16 PM, Benjamin Root <ben...@ou...> wrote: >> >>> Or just do this: >>> >>> formatter = FuncFormatter(lambda x, pos: "%d" % x/10) >>> fig, ax = plt.subplots()ax.yaxis.set_major_formatter(formatter)plt.plot(D.dtrajs[0]) >>> plt.ylabel('O2-Fe distance') >>> plt.xlabel('Frame') >>> plt.show() >>> >>> >>> >>> On Mon, Mar 9, 2015 at 2:11 PM, Sterling Smith <sm...@fu...> >>> wrote: >>> >>>> Christian, >>>> >>>> To define your x coordinate, try >>>> x = range(len(array)) >>>> x = x/10. >>>> plot(x,array) >>>> >>>> -Sterling >>>> >>>> On Mar 9, 2015, at 10:57AM, Christian Jorgensen <chr...@gm...> >>>> wrote: >>>> >>>> > >>>> > My array does not have an explicit x-coordinate >>>> > representation. The x-coordinate is simply the index. >>>> > >>>> > print(array) >>>> > [ 0 0 20 ..., 8 8 8] >>>> > >>>> > >>>> > Thus what I would like is to adjoin the element >>>> > index as another row, how is this possible? >>>> > >>>> > >>>> > I cannot format x because it is not explicitly defined. >>>> > >>>> > >>>> > >>>> > On Mon, Mar 9, 2015 at 5:52 PM, Benjamin Root<ben...@ou...> wrote: >>>> > Ok, this really should be simple (and I am sure it is), but I cannot, >>>> for the life of me, find the appropriate documentation for it. We need >>>> better documentation about how to utilize the offset-text feature of >>>> tickers. It can be either a multiple offset or an additive offset. >>>> > >>>> > In any case, I know there is a better way to do this, but here is a >>>> quick-n-dirty example that can get you where you want. Just modify the >>>> formatter used by the tickers to report the value as divided by 10. >>>> > http://matplotlib.org/examples/pylab_examples/custom_ticker1.html >>>> > >>>> > Cheers! >>>> > Ben Root >>>> > >>>> > >>>> > On Mon, Mar 9, 2015 at 1:38 PM, Christian Jorgensen< >>>> chr...@gm...> wrote: >>>> > How can I scale my x-axis [0,3000] for the data to now >>>> correspond/show up >>>> > as [0, 300]? >>>> > >>>> > >>>> > In xmgrace, this is done with a linear transformation, but I cannot >>>> seem >>>> > to find the command to do this with matplotlib. >>>> > >>>> > Best >>>> > >>>> > >>>> > >>>> > >>>> ------------------------------------------------------------------------------ >>>> > Dive into the World of Parallel Programming The Go Parallel Website, >>>> sponsored >>>> > by Intel and developed in partnership with Slashdot Media, is your >>>> hub for all >>>> > things parallel software development, from weekly thought leadership >>>> blogs to >>>> > news, videos, case studies, tutorials and more. Take a look and join >>>> the >>>> > conversation now. http://goparallel.sourceforge.net/ >>>> > _______________________________________________ >>>> > Matplotlib-users mailing list >>>> > Mat...@li... >>>> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>>> > >>>> > >>>> > >>>> > >>>> > >>>> > -- >>>> > _______ >>>> > >>>> > Christian Jørgensen >>>> > >>>> > >>>> > >>>> > -- >>>> > _______ >>>> > >>>> > Christian Jørgensen >>>> > >>>> ------------------------------------------------------------------------------ >>>> > Dive into the World of Parallel Programming The Go Parallel Website, >>>> sponsored >>>> > by Intel and developed in partnership with Slashdot Media, is your >>>> hub for all >>>> > things parallel software development, from weekly thought leadership >>>> blogs to >>>> > news, videos, case studies, tutorials and more. Take a look and join >>>> the >>>> > conversation now. >>>> http://goparallel.sourceforge.net/_______________________________________________ >>>> > Matplotlib-users mailing list >>>> > Mat...@li... >>>> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>>> >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Dive into the World of Parallel Programming The Go Parallel Website, >>>> sponsored >>>> by Intel and developed in partnership with Slashdot Media, is your hub >>>> for all >>>> things parallel software development, from weekly thought leadership >>>> blogs to >>>> news, videos, case studies, tutorials and more. Take a look and join the >>>> conversation now. http://goparallel.sourceforge.net/ >>>> _______________________________________________ >>>> Matplotlib-users mailing list >>>> Mat...@li... >>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>>> >>> >>> >> >> >> -- >> _______ >> >> Christian Jørgensen >> > > > > -- > _______ > > Christian Jørgensen > -- _______ Christian Jørgensen |
From: Christian J. <chr...@gm...> - 2015-03-09 18:40:46
|
Sterling, this doesn't work, as it's using the array as a function x = D.dtrajs[0](range(len(D.dtrajs[0]))) plt.plot(D.dtrajs[0]) plt.ylabel('O2-Fe distance') plt.xlabel('Frame') ---------------------------------------------------------------------------TypeError Traceback (most recent call last)<ipython-input-147-8bbee6b254c1> in <module>()----> 1 x = D.dtrajs[0](range(len(D.dtrajs[0]))) 2 plt.plot(D.dtrajs[0]) 3 plt.ylabel('O2-Fe distance') 4 plt.xlabel('Frame') TypeError: 'numpy.ndarray' object is not callable On Mon, Mar 9, 2015 at 6:35 PM, Christian Jorgensen <chr...@gm...> wrote: > Thanks, > > > I ran Benjamin's code but it doesn't display the > figure anymore. It only prints a text about the figure > > > formatter = FuncFormatter(lambda x, pos: "%d" % x/10) > > > > fig, ax = plt.subplots() > > ax.yaxis.set_major_formatter(formatter) > > plt.plot(D.dtrajs[0]) > > plt.ylabel('O2-Fe distance') > > plt.xlabel('Frame') > > plt.show() > > <matplotlib.figure.Figure at 0x11b1f2090> > > > > > > On Mon, Mar 9, 2015 at 6:16 PM, Benjamin Root <ben...@ou...> wrote: > >> Or just do this: >> >> formatter = FuncFormatter(lambda x, pos: "%d" % x/10) >> fig, ax = plt.subplots()ax.yaxis.set_major_formatter(formatter)plt.plot(D.dtrajs[0]) >> plt.ylabel('O2-Fe distance') >> plt.xlabel('Frame') >> plt.show() >> >> >> >> On Mon, Mar 9, 2015 at 2:11 PM, Sterling Smith <sm...@fu...> >> wrote: >> >>> Christian, >>> >>> To define your x coordinate, try >>> x = range(len(array)) >>> x = x/10. >>> plot(x,array) >>> >>> -Sterling >>> >>> On Mar 9, 2015, at 10:57AM, Christian Jorgensen <chr...@gm...> >>> wrote: >>> >>> > >>> > My array does not have an explicit x-coordinate >>> > representation. The x-coordinate is simply the index. >>> > >>> > print(array) >>> > [ 0 0 20 ..., 8 8 8] >>> > >>> > >>> > Thus what I would like is to adjoin the element >>> > index as another row, how is this possible? >>> > >>> > >>> > I cannot format x because it is not explicitly defined. >>> > >>> > >>> > >>> > On Mon, Mar 9, 2015 at 5:52 PM, Benjamin Root<ben...@ou...> wrote: >>> > Ok, this really should be simple (and I am sure it is), but I cannot, >>> for the life of me, find the appropriate documentation for it. We need >>> better documentation about how to utilize the offset-text feature of >>> tickers. It can be either a multiple offset or an additive offset. >>> > >>> > In any case, I know there is a better way to do this, but here is a >>> quick-n-dirty example that can get you where you want. Just modify the >>> formatter used by the tickers to report the value as divided by 10. >>> > http://matplotlib.org/examples/pylab_examples/custom_ticker1.html >>> > >>> > Cheers! >>> > Ben Root >>> > >>> > >>> > On Mon, Mar 9, 2015 at 1:38 PM, Christian Jorgensen< >>> chr...@gm...> wrote: >>> > How can I scale my x-axis [0,3000] for the data to now correspond/show >>> up >>> > as [0, 300]? >>> > >>> > >>> > In xmgrace, this is done with a linear transformation, but I cannot >>> seem >>> > to find the command to do this with matplotlib. >>> > >>> > Best >>> > >>> > >>> > >>> > >>> ------------------------------------------------------------------------------ >>> > Dive into the World of Parallel Programming The Go Parallel Website, >>> sponsored >>> > by Intel and developed in partnership with Slashdot Media, is your hub >>> for all >>> > things parallel software development, from weekly thought leadership >>> blogs to >>> > news, videos, case studies, tutorials and more. Take a look and join >>> the >>> > conversation now. http://goparallel.sourceforge.net/ >>> > _______________________________________________ >>> > Matplotlib-users mailing list >>> > Mat...@li... >>> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> > >>> > >>> > >>> > >>> > >>> > -- >>> > _______ >>> > >>> > Christian Jørgensen >>> > >>> > >>> > >>> > -- >>> > _______ >>> > >>> > Christian Jørgensen >>> > >>> ------------------------------------------------------------------------------ >>> > Dive into the World of Parallel Programming The Go Parallel Website, >>> sponsored >>> > by Intel and developed in partnership with Slashdot Media, is your hub >>> for all >>> > things parallel software development, from weekly thought leadership >>> blogs to >>> > news, videos, case studies, tutorials and more. Take a look and join >>> the >>> > conversation now. >>> http://goparallel.sourceforge.net/_______________________________________________ >>> > Matplotlib-users mailing list >>> > Mat...@li... >>> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Dive into the World of Parallel Programming The Go Parallel Website, >>> sponsored >>> by Intel and developed in partnership with Slashdot Media, is your hub >>> for all >>> things parallel software development, from weekly thought leadership >>> blogs to >>> news, videos, case studies, tutorials and more. Take a look and join the >>> conversation now. http://goparallel.sourceforge.net/ >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >> >> > > > -- > _______ > > Christian Jørgensen > -- _______ Christian Jørgensen |
From: Christian J. <chr...@gm...> - 2015-03-09 18:35:07
|
Thanks, I ran Benjamin's code but it doesn't display the figure anymore. It only prints a text about the figure formatter = FuncFormatter(lambda x, pos: "%d" % x/10) fig, ax = plt.subplots() ax.yaxis.set_major_formatter(formatter) plt.plot(D.dtrajs[0]) plt.ylabel('O2-Fe distance') plt.xlabel('Frame') plt.show() <matplotlib.figure.Figure at 0x11b1f2090> On Mon, Mar 9, 2015 at 6:16 PM, Benjamin Root <ben...@ou...> wrote: > Or just do this: > > formatter = FuncFormatter(lambda x, pos: "%d" % x/10) > fig, ax = plt.subplots()ax.yaxis.set_major_formatter(formatter)plt.plot(D.dtrajs[0]) > plt.ylabel('O2-Fe distance') > plt.xlabel('Frame') > plt.show() > > > > On Mon, Mar 9, 2015 at 2:11 PM, Sterling Smith <sm...@fu...> > wrote: > >> Christian, >> >> To define your x coordinate, try >> x = range(len(array)) >> x = x/10. >> plot(x,array) >> >> -Sterling >> >> On Mar 9, 2015, at 10:57AM, Christian Jorgensen <chr...@gm...> >> wrote: >> >> > >> > My array does not have an explicit x-coordinate >> > representation. The x-coordinate is simply the index. >> > >> > print(array) >> > [ 0 0 20 ..., 8 8 8] >> > >> > >> > Thus what I would like is to adjoin the element >> > index as another row, how is this possible? >> > >> > >> > I cannot format x because it is not explicitly defined. >> > >> > >> > >> > On Mon, Mar 9, 2015 at 5:52 PM, Benjamin Root<ben...@ou...> wrote: >> > Ok, this really should be simple (and I am sure it is), but I cannot, >> for the life of me, find the appropriate documentation for it. We need >> better documentation about how to utilize the offset-text feature of >> tickers. It can be either a multiple offset or an additive offset. >> > >> > In any case, I know there is a better way to do this, but here is a >> quick-n-dirty example that can get you where you want. Just modify the >> formatter used by the tickers to report the value as divided by 10. >> > http://matplotlib.org/examples/pylab_examples/custom_ticker1.html >> > >> > Cheers! >> > Ben Root >> > >> > >> > On Mon, Mar 9, 2015 at 1:38 PM, Christian Jorgensen<chr...@gm...> >> wrote: >> > How can I scale my x-axis [0,3000] for the data to now correspond/show >> up >> > as [0, 300]? >> > >> > >> > In xmgrace, this is done with a linear transformation, but I cannot seem >> > to find the command to do this with matplotlib. >> > >> > Best >> > >> > >> > >> > >> ------------------------------------------------------------------------------ >> > Dive into the World of Parallel Programming The Go Parallel Website, >> sponsored >> > by Intel and developed in partnership with Slashdot Media, is your hub >> for all >> > things parallel software development, from weekly thought leadership >> blogs to >> > news, videos, case studies, tutorials and more. Take a look and join the >> > conversation now. http://goparallel.sourceforge.net/ >> > _______________________________________________ >> > Matplotlib-users mailing list >> > Mat...@li... >> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > >> > >> > >> > >> > >> > -- >> > _______ >> > >> > Christian Jørgensen >> > >> > >> > >> > -- >> > _______ >> > >> > Christian Jørgensen >> > >> ------------------------------------------------------------------------------ >> > Dive into the World of Parallel Programming The Go Parallel Website, >> sponsored >> > by Intel and developed in partnership with Slashdot Media, is your hub >> for all >> > things parallel software development, from weekly thought leadership >> blogs to >> > news, videos, case studies, tutorials and more. Take a look and join the >> > conversation now. >> http://goparallel.sourceforge.net/_______________________________________________ >> > Matplotlib-users mailing list >> > Mat...@li... >> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming The Go Parallel Website, >> sponsored >> by Intel and developed in partnership with Slashdot Media, is your hub >> for all >> things parallel software development, from weekly thought leadership >> blogs to >> news, videos, case studies, tutorials and more. Take a look and join the >> conversation now. http://goparallel.sourceforge.net/ >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > -- _______ Christian Jørgensen |
From: Benjamin R. <ben...@ou...> - 2015-03-09 18:16:50
|
Or just do this: formatter = FuncFormatter(lambda x, pos: "%d" % x/10) fig, ax = plt.subplots()ax.yaxis.set_major_formatter(formatter)plt.plot(D.dtrajs[0]) plt.ylabel('O2-Fe distance') plt.xlabel('Frame') plt.show() On Mon, Mar 9, 2015 at 2:11 PM, Sterling Smith <sm...@fu...> wrote: > Christian, > > To define your x coordinate, try > x = range(len(array)) > x = x/10. > plot(x,array) > > -Sterling > > On Mar 9, 2015, at 10:57AM, Christian Jorgensen <chr...@gm...> > wrote: > > > > > My array does not have an explicit x-coordinate > > representation. The x-coordinate is simply the index. > > > > print(array) > > [ 0 0 20 ..., 8 8 8] > > > > > > Thus what I would like is to adjoin the element > > index as another row, how is this possible? > > > > > > I cannot format x because it is not explicitly defined. > > > > > > > > On Mon, Mar 9, 2015 at 5:52 PM, Benjamin Root<ben...@ou...> wrote: > > Ok, this really should be simple (and I am sure it is), but I cannot, > for the life of me, find the appropriate documentation for it. We need > better documentation about how to utilize the offset-text feature of > tickers. It can be either a multiple offset or an additive offset. > > > > In any case, I know there is a better way to do this, but here is a > quick-n-dirty example that can get you where you want. Just modify the > formatter used by the tickers to report the value as divided by 10. > > http://matplotlib.org/examples/pylab_examples/custom_ticker1.html > > > > Cheers! > > Ben Root > > > > > > On Mon, Mar 9, 2015 at 1:38 PM, Christian Jorgensen<chr...@gm...> > wrote: > > How can I scale my x-axis [0,3000] for the data to now correspond/show up > > as [0, 300]? > > > > > > In xmgrace, this is done with a linear transformation, but I cannot seem > > to find the command to do this with matplotlib. > > > > Best > > > > > > > > > ------------------------------------------------------------------------------ > > Dive into the World of Parallel Programming The Go Parallel Website, > sponsored > > by Intel and developed in partnership with Slashdot Media, is your hub > for all > > things parallel software development, from weekly thought leadership > blogs to > > news, videos, case studies, tutorials and more. Take a look and join the > > conversation now. http://goparallel.sourceforge.net/ > > _______________________________________________ > > Matplotlib-users mailing list > > Mat...@li... > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > > > > > > > > -- > > _______ > > > > Christian Jørgensen > > > > > > > > -- > > _______ > > > > Christian Jørgensen > > > ------------------------------------------------------------------------------ > > Dive into the World of Parallel Programming The Go Parallel Website, > sponsored > > by Intel and developed in partnership with Slashdot Media, is your hub > for all > > things parallel software development, from weekly thought leadership > blogs to > > news, videos, case studies, tutorials and more. Take a look and join the > > conversation now. > http://goparallel.sourceforge.net/_______________________________________________ > > Matplotlib-users mailing list > > Mat...@li... > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, > sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for > all > things parallel software development, from weekly thought leadership blogs > to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Sterling S. <sm...@fu...> - 2015-03-09 18:13:17
|
That was untested. It should start with (still untested) x = array(range(len(array)) On Mar 9, 2015, at 11:11AM, Sterling Smith <sm...@fu...> wrote: > Christian, > > To define your x coordinate, try > x = range(len(array)) > x = x/10. > plot(x,array) > > -Sterling > > On Mar 9, 2015, at 10:57AM, Christian Jorgensen <chr...@gm...> wrote: > >> >> My array does not have an explicit x-coordinate >> representation. The x-coordinate is simply the index. >> >> print(array) >> [ 0 0 20 ..., 8 8 8] >> >> >> Thus what I would like is to adjoin the element >> index as another row, how is this possible? >> >> >> I cannot format x because it is not explicitly defined. >> >> >> >> On Mon, Mar 9, 2015 at 5:52 PM, Benjamin Root<ben...@ou...> wrote: >> Ok, this really should be simple (and I am sure it is), but I cannot, for the life of me, find the appropriate documentation for it. We need better documentation about how to utilize the offset-text feature of tickers. It can be either a multiple offset or an additive offset. >> >> In any case, I know there is a better way to do this, but here is a quick-n-dirty example that can get you where you want. Just modify the formatter used by the tickers to report the value as divided by 10. >> http://matplotlib.org/examples/pylab_examples/custom_ticker1.html >> >> Cheers! >> Ben Root >> >> >> On Mon, Mar 9, 2015 at 1:38 PM, Christian Jorgensen<chr...@gm...> wrote: >> How can I scale my x-axis [0,3000] for the data to now correspond/show up >> as [0, 300]? >> >> >> In xmgrace, this is done with a linear transformation, but I cannot seem >> to find the command to do this with matplotlib. >> >> Best >> >> >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming The Go Parallel Website, sponsored >> by Intel and developed in partnership with Slashdot Media, is your hub for all >> things parallel software development, from weekly thought leadership blogs to >> news, videos, case studies, tutorials and more. Take a look and join the >> conversation now. http://goparallel.sourceforge.net/ >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> >> >> >> >> -- >> _______ >> >> Christian Jørgensen >> >> >> >> -- >> _______ >> >> Christian Jørgensen >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming The Go Parallel Website, sponsored >> by Intel and developed in partnership with Slashdot Media, is your hub for all >> things parallel software development, from weekly thought leadership blogs to >> news, videos, case studies, tutorials and more. Take a look and join the >> conversation now. http://goparallel.sourceforge.net/_______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for all > things parallel software development, from weekly thought leadership blogs to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Christian J. <chr...@gm...> - 2015-03-09 18:12:25
|
My array is called D.dtrajs[0] I'm plotting it as plt.plot(D.dtrajs[0]) plt.ylabel('O2-Fe distance') plt.xlabel('Frame') There is thus no x-variable defined to scale or modify. How would you do this? > > > On Mon, Mar 9, 2015 at 6:03 PM, Benjamin Root <ben...@ou...> wrote: > >> I am not sure I understand. I took your question as "how do I make my x >> tick labels show values as [0, 300] when my values really are [0, 3000]?". >> Are the indexes you speak of ranging from 0 to 3000? If so, I don't see how >> our examples aren't sufficient. As for formatting x "because it is not >> defined", what is not defined? The formatting or x? >> >> On Mon, Mar 9, 2015 at 1:57 PM, Christian Jorgensen <chr...@gm...> >> wrote: >> >>> >>> My array does not have an explicit x-coordinate >>>> representation. The x-coordinate is simply the index. >>>> >>>> print(array) >>>> [ 0 0 20 ..., 8 8 8] >>>> >>>> >>>> Thus what I would like is to adjoin the element >>>> index as another row, how is this possible? >>>> >>>> >>>> I cannot format x because it is not explicitly defined. >>>> >>>> >>>> >>>> On Mon, Mar 9, 2015 at 5:52 PM, Benjamin Root <ben...@ou...> wrote: >>>> >>>>> Ok, this really should be simple (and I am sure it is), but I cannot, >>>>> for the life of me, find the appropriate documentation for it. We need >>>>> better documentation about how to utilize the offset-text feature of >>>>> tickers. It can be either a multiple offset or an additive offset. >>>>> >>>>> In any case, I know there is a better way to do this, but here is a >>>>> quick-n-dirty example that can get you where you want. Just modify the >>>>> formatter used by the tickers to report the value as divided by 10. >>>>> http://matplotlib.org/examples/pylab_examples/custom_ticker1.html >>>>> >>>>> Cheers! >>>>> Ben Root >>>>> >>>>> >>>>> On Mon, Mar 9, 2015 at 1:38 PM, Christian Jorgensen < >>>>> chr...@gm...> wrote: >>>>> >>>>>> How can I scale my x-axis [0,3000] for the data to now >>>>>> correspond/show up >>>>>> as [0, 300]? >>>>>> >>>>>> >>>>>> In xmgrace, this is done with a linear transformation, but I cannot >>>>>> seem >>>>>> to find the command to do this with matplotlib. >>>>>> >>>>>> Best >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> ------------------------------------------------------------------------------ >>>>>> Dive into the World of Parallel Programming The Go Parallel Website, >>>>>> sponsored >>>>>> by Intel and developed in partnership with Slashdot Media, is your >>>>>> hub for all >>>>>> things parallel software development, from weekly thought leadership >>>>>> blogs to >>>>>> news, videos, case studies, tutorials and more. Take a look and join >>>>>> the >>>>>> conversation now. http://goparallel.sourceforge.net/ >>>>>> _______________________________________________ >>>>>> Matplotlib-users mailing list >>>>>> Mat...@li... >>>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>>>>> >>>>>> >>>>> >>>> >>>> >>>> -- >>>> _______ >>>> >>>> Christian Jørgensen >>>> >>> >>> >>> >>> -- >>> _______ >>> >>> Christian Jørgensen >>> >>> >>> ------------------------------------------------------------------------------ >>> Dive into the World of Parallel Programming The Go Parallel Website, >>> sponsored >>> by Intel and developed in partnership with Slashdot Media, is your hub >>> for all >>> things parallel software development, from weekly thought leadership >>> blogs to >>> news, videos, case studies, tutorials and more. Take a look and join the >>> conversation now. http://goparallel.sourceforge.net/ >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >>> >> > > > -- > _______ > > Christian Jørgensen > -- _______ Christian Jørgensen |
From: Sterling S. <sm...@fu...> - 2015-03-09 18:11:44
|
Christian, To define your x coordinate, try x = range(len(array)) x = x/10. plot(x,array) -Sterling On Mar 9, 2015, at 10:57AM, Christian Jorgensen <chr...@gm...> wrote: > > My array does not have an explicit x-coordinate > representation. The x-coordinate is simply the index. > > print(array) > [ 0 0 20 ..., 8 8 8] > > > Thus what I would like is to adjoin the element > index as another row, how is this possible? > > > I cannot format x because it is not explicitly defined. > > > > On Mon, Mar 9, 2015 at 5:52 PM, Benjamin Root<ben...@ou...> wrote: > Ok, this really should be simple (and I am sure it is), but I cannot, for the life of me, find the appropriate documentation for it. We need better documentation about how to utilize the offset-text feature of tickers. It can be either a multiple offset or an additive offset. > > In any case, I know there is a better way to do this, but here is a quick-n-dirty example that can get you where you want. Just modify the formatter used by the tickers to report the value as divided by 10. > http://matplotlib.org/examples/pylab_examples/custom_ticker1.html > > Cheers! > Ben Root > > > On Mon, Mar 9, 2015 at 1:38 PM, Christian Jorgensen<chr...@gm...> wrote: > How can I scale my x-axis [0,3000] for the data to now correspond/show up > as [0, 300]? > > > In xmgrace, this is done with a linear transformation, but I cannot seem > to find the command to do this with matplotlib. > > Best > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for all > things parallel software development, from weekly thought leadership blogs to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > > -- > _______ > > Christian Jørgensen > > > > -- > _______ > > Christian Jørgensen > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for all > things parallel software development, from weekly thought leadership blogs to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/_______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Benjamin R. <ben...@ou...> - 2015-03-09 18:03:58
|
I am not sure I understand. I took your question as "how do I make my x tick labels show values as [0, 300] when my values really are [0, 3000]?". Are the indexes you speak of ranging from 0 to 3000? If so, I don't see how our examples aren't sufficient. As for formatting x "because it is not defined", what is not defined? The formatting or x? On Mon, Mar 9, 2015 at 1:57 PM, Christian Jorgensen <chr...@gm...> wrote: > > My array does not have an explicit x-coordinate >> representation. The x-coordinate is simply the index. >> >> print(array) >> [ 0 0 20 ..., 8 8 8] >> >> >> Thus what I would like is to adjoin the element >> index as another row, how is this possible? >> >> >> I cannot format x because it is not explicitly defined. >> >> >> >> On Mon, Mar 9, 2015 at 5:52 PM, Benjamin Root <ben...@ou...> wrote: >> >>> Ok, this really should be simple (and I am sure it is), but I cannot, >>> for the life of me, find the appropriate documentation for it. We need >>> better documentation about how to utilize the offset-text feature of >>> tickers. It can be either a multiple offset or an additive offset. >>> >>> In any case, I know there is a better way to do this, but here is a >>> quick-n-dirty example that can get you where you want. Just modify the >>> formatter used by the tickers to report the value as divided by 10. >>> http://matplotlib.org/examples/pylab_examples/custom_ticker1.html >>> >>> Cheers! >>> Ben Root >>> >>> >>> On Mon, Mar 9, 2015 at 1:38 PM, Christian Jorgensen <chr...@gm... >>> > wrote: >>> >>>> How can I scale my x-axis [0,3000] for the data to now correspond/show >>>> up >>>> as [0, 300]? >>>> >>>> >>>> In xmgrace, this is done with a linear transformation, but I cannot >>>> seem >>>> to find the command to do this with matplotlib. >>>> >>>> Best >>>> >>>> >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Dive into the World of Parallel Programming The Go Parallel Website, >>>> sponsored >>>> by Intel and developed in partnership with Slashdot Media, is your hub >>>> for all >>>> things parallel software development, from weekly thought leadership >>>> blogs to >>>> news, videos, case studies, tutorials and more. Take a look and join the >>>> conversation now. http://goparallel.sourceforge.net/ >>>> _______________________________________________ >>>> Matplotlib-users mailing list >>>> Mat...@li... >>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>>> >>>> >>> >> >> >> -- >> _______ >> >> Christian Jørgensen >> > > > > -- > _______ > > Christian Jørgensen > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, > sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for > all > things parallel software development, from weekly thought leadership blogs > to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
From: Christian J. <chr...@gm...> - 2015-03-09 17:58:02
|
> My array does not have an explicit x-coordinate > representation. The x-coordinate is simply the index. > > print(array) > [ 0 0 20 ..., 8 8 8] > > > Thus what I would like is to adjoin the element > index as another row, how is this possible? > > > I cannot format x because it is not explicitly defined. > > > > On Mon, Mar 9, 2015 at 5:52 PM, Benjamin Root <ben...@ou...> wrote: > >> Ok, this really should be simple (and I am sure it is), but I cannot, for >> the life of me, find the appropriate documentation for it. We need better >> documentation about how to utilize the offset-text feature of tickers. It >> can be either a multiple offset or an additive offset. >> >> In any case, I know there is a better way to do this, but here is a >> quick-n-dirty example that can get you where you want. Just modify the >> formatter used by the tickers to report the value as divided by 10. >> http://matplotlib.org/examples/pylab_examples/custom_ticker1.html >> >> Cheers! >> Ben Root >> >> >> On Mon, Mar 9, 2015 at 1:38 PM, Christian Jorgensen <chr...@gm...> >> wrote: >> >>> How can I scale my x-axis [0,3000] for the data to now correspond/show >>> up >>> as [0, 300]? >>> >>> >>> In xmgrace, this is done with a linear transformation, but I cannot seem >>> to find the command to do this with matplotlib. >>> >>> Best >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Dive into the World of Parallel Programming The Go Parallel Website, >>> sponsored >>> by Intel and developed in partnership with Slashdot Media, is your hub >>> for all >>> things parallel software development, from weekly thought leadership >>> blogs to >>> news, videos, case studies, tutorials and more. Take a look and join the >>> conversation now. http://goparallel.sourceforge.net/ >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >>> >> > > > -- > _______ > > Christian Jørgensen > -- _______ Christian Jørgensen |
From: Benjamin R. <ben...@ou...> - 2015-03-09 17:52:48
|
Ok, this really should be simple (and I am sure it is), but I cannot, for the life of me, find the appropriate documentation for it. We need better documentation about how to utilize the offset-text feature of tickers. It can be either a multiple offset or an additive offset. In any case, I know there is a better way to do this, but here is a quick-n-dirty example that can get you where you want. Just modify the formatter used by the tickers to report the value as divided by 10. http://matplotlib.org/examples/pylab_examples/custom_ticker1.html Cheers! Ben Root On Mon, Mar 9, 2015 at 1:38 PM, Christian Jorgensen <chr...@gm...> wrote: > How can I scale my x-axis [0,3000] for the data to now correspond/show up > as [0, 300]? > > > In xmgrace, this is done with a linear transformation, but I cannot seem > to find the command to do this with matplotlib. > > Best > > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, > sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for > all > things parallel software development, from weekly thought leadership blogs > to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
From: Sterling S. <sm...@fu...> - 2015-03-09 17:52:04
|
Christian, It sounds like you want to rescale your x axis values before plotting or use the x axis formatter. For the latter see http://matplotlib.org/examples/pylab_examples/major_minor_demo1.html http://matplotlib.org/examples/pylab_examples/custom_ticker1.html -Sterling On Mar 9, 2015, at 10:38AM, Christian Jorgensen <chr...@gm...> wrote: > How can I scale my x-axis [0,3000] for the data to now correspond/show up > as [0, 300]? > > > In xmgrace, this is done with a linear transformation, but I cannot seem > to find the command to do this with matplotlib. > > Best > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for all > things parallel software development, from weekly thought leadership blogs to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/_______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Christian J. <chr...@gm...> - 2015-03-09 17:38:48
|
How can I scale my x-axis [0,3000] for the data to now correspond/show up as [0, 300]? In xmgrace, this is done with a linear transformation, but I cannot seem to find the command to do this with matplotlib. Best |