[Matplotlib-users] problem with patches in animation

2014-04-23 Thread Mark Bakker
Hello list,

I am trying to animate a patch. The animation should show a circle orbiting
around a point. I took the code from
http://nickcharlton.net/posts/drawing-animating-shapes-matplotlib.html

Problem is that when I run the code, the animation doesn't remove the
initial position of the circle (blit is True) while it works correctly on
the website referenced above.

Does anybody else see this behavior? Here's the code:

import numpy as np
from matplotlib import pyplot as plt
from matplotlib import animation

fig = plt.figure()
fig.set_dpi(100)
fig.set_size_inches(7, 6.5)

ax = plt.axes(xlim=(0, 10), ylim=(0, 10))
patch = plt.Circle((5, -5), 0.75, fc='y')

def init():
patch.center = (5, 5)
ax.add_patch(patch)
return patch,

def animate(i):
x, y = patch.center
x = 5 + 3 * np.sin(np.radians(i))
y = 5 + 3 * np.cos(np.radians(i))
patch.center = (x, y)
return patch,

anim = animation.FuncAnimation(fig, animate,
   init_func=init,
   frames=360,
   interval=20,
   blit=True)

plt.show()

Thanks, Mark
--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] problem with patches in animation

2014-04-23 Thread Raymond Smith
Hi Mark,

I can't say this is the 'proper' solution or the correct interpretation,
but it should work.

I think when blitting that the init function serves as a something of a
background for the rest of the animation. So try changing

def init():
*patch.center = (5, 5)*
ax.add_patch(patch)
return patch,

to

def init():
*patch.center = (5, -5)*
ax.add_patch(patch)
return patch,

Cheers,
Ray


On Wed, Apr 23, 2014 at 5:44 AM, Mark Bakker mark...@gmail.com wrote:

 Hello list,

 I am trying to animate a patch. The animation should show a circle
 orbiting around a point. I took the code from
 http://nickcharlton.net/posts/drawing-animating-shapes-matplotlib.html

 Problem is that when I run the code, the animation doesn't remove the
 initial position of the circle (blit is True) while it works correctly on
 the website referenced above.

 Does anybody else see this behavior? Here's the code:

 import numpy as np
 from matplotlib import pyplot as plt
 from matplotlib import animation

 fig = plt.figure()
 fig.set_dpi(100)
 fig.set_size_inches(7, 6.5)

 ax = plt.axes(xlim=(0, 10), ylim=(0, 10))
 patch = plt.Circle((5, -5), 0.75, fc='y')

 def init():
 patch.center = (5, 5)
 ax.add_patch(patch)
 return patch,

 def animate(i):
 x, y = patch.center
 x = 5 + 3 * np.sin(np.radians(i))
 y = 5 + 3 * np.cos(np.radians(i))
 patch.center = (x, y)
 return patch,

 anim = animation.FuncAnimation(fig, animate,
init_func=init,
frames=360,
interval=20,
blit=True)

 plt.show()

 Thanks, Mark


 --
 Start Your Social Network Today - Download eXo Platform
 Build your Enterprise Intranet with eXo Platform Software
 Java Based Open Source Intranet - Social, Extensible, Cloud Ready
 Get Started Now And Turn Your Intranet Into A Collaboration Platform
 http://p.sf.net/sfu/ExoPlatform
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] problem with patches in animation

2014-04-23 Thread Mark Bakker
I thought about that. I even thought about changing the initial color to
white or radius to zero.

But I am thinking this is a bug. When blitting, whatever is created with
the init function is not removed. That is why lines that are animated
initially have no data. For a Patch object this is a bit harder, as it
needs something to begin with.

 It seems that this used to work in a previous version.

Should I file a bug report?

Mark


On Wed, Apr 23, 2014 at 3:34 PM, Raymond Smith smit...@mit.edu wrote:

 Hi Mark,

 I can't say this is the 'proper' solution or the correct interpretation,
 but it should work.

 I think when blitting that the init function serves as a something of a
 background for the rest of the animation. So try changing


 def init():
 *patch.center = (5, 5)*
 ax.add_patch(patch)
 return patch,

 to

 def init():
 *patch.center = (5, -5)*
 ax.add_patch(patch)
 return patch,

 Cheers,
 Ray


 On Wed, Apr 23, 2014 at 5:44 AM, Mark Bakker mark...@gmail.com wrote:

 Hello list,

 I am trying to animate a patch. The animation should show a circle
 orbiting around a point. I took the code from
 http://nickcharlton.net/posts/drawing-animating-shapes-matplotlib.html

 Problem is that when I run the code, the animation doesn't remove the
 initial position of the circle (blit is True) while it works correctly on
 the website referenced above.

 Does anybody else see this behavior? Here's the code:

 import numpy as np
 from matplotlib import pyplot as plt
 from matplotlib import animation

 fig = plt.figure()
 fig.set_dpi(100)
 fig.set_size_inches(7, 6.5)

 ax = plt.axes(xlim=(0, 10), ylim=(0, 10))
 patch = plt.Circle((5, -5), 0.75, fc='y')

 def init():
 patch.center = (5, 5)
 ax.add_patch(patch)
 return patch,

 def animate(i):
 x, y = patch.center
 x = 5 + 3 * np.sin(np.radians(i))
 y = 5 + 3 * np.cos(np.radians(i))
 patch.center = (x, y)
 return patch,

 anim = animation.FuncAnimation(fig, animate,
init_func=init,
frames=360,
interval=20,
blit=True)

 plt.show()

 Thanks, Mark


 --
 Start Your Social Network Today - Download eXo Platform
 Build your Enterprise Intranet with eXo Platform Software
 Java Based Open Source Intranet - Social, Extensible, Cloud Ready
 Get Started Now And Turn Your Intranet Into A Collaboration Platform
 http://p.sf.net/sfu/ExoPlatform
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] problem with patches in animation

2014-04-23 Thread Raymond Smith
Well, the intended behavior of init() isn't completely clear to me after
reading over some of the docs http://matplotlib.org/contents.html and
examples http://matplotlib.org/examples/animation/index.html, so I'm not
sure if it's a bug or not. Either way, it could be a request for
documentation, perhaps.


On Wed, Apr 23, 2014 at 10:08 AM, Mark Bakker mark...@gmail.com wrote:

 I thought about that. I even thought about changing the initial color to
 white or radius to zero.

 But I am thinking this is a bug. When blitting, whatever is created with
 the init function is not removed. That is why lines that are animated
 initially have no data. For a Patch object this is a bit harder, as it
 needs something to begin with.

  It seems that this used to work in a previous version.

 Should I file a bug report?

 Mark


 On Wed, Apr 23, 2014 at 3:34 PM, Raymond Smith smit...@mit.edu wrote:

 Hi Mark,

 I can't say this is the 'proper' solution or the correct interpretation,
 but it should work.

 I think when blitting that the init function serves as a something of a
 background for the rest of the animation. So try changing


 def init():
 *patch.center = (5, 5)*
 ax.add_patch(patch)
 return patch,

 to

 def init():
 *patch.center = (5, -5)*
 ax.add_patch(patch)
 return patch,

 Cheers,
 Ray


 On Wed, Apr 23, 2014 at 5:44 AM, Mark Bakker mark...@gmail.com wrote:

 Hello list,

 I am trying to animate a patch. The animation should show a circle
 orbiting around a point. I took the code from
 http://nickcharlton.net/posts/drawing-animating-shapes-matplotlib.html

 Problem is that when I run the code, the animation doesn't remove the
 initial position of the circle (blit is True) while it works correctly on
 the website referenced above.

 Does anybody else see this behavior? Here's the code:

 import numpy as np
 from matplotlib import pyplot as plt
 from matplotlib import animation

 fig = plt.figure()
 fig.set_dpi(100)
 fig.set_size_inches(7, 6.5)

 ax = plt.axes(xlim=(0, 10), ylim=(0, 10))
 patch = plt.Circle((5, -5), 0.75, fc='y')

 def init():
 patch.center = (5, 5)
 ax.add_patch(patch)
 return patch,

 def animate(i):
 x, y = patch.center
 x = 5 + 3 * np.sin(np.radians(i))
 y = 5 + 3 * np.cos(np.radians(i))
 patch.center = (x, y)
 return patch,

 anim = animation.FuncAnimation(fig, animate,
init_func=init,
frames=360,
interval=20,
blit=True)

 plt.show()

 Thanks, Mark


 --
 Start Your Social Network Today - Download eXo Platform
 Build your Enterprise Intranet with eXo Platform Software
 Java Based Open Source Intranet - Social, Extensible, Cloud Ready
 Get Started Now And Turn Your Intranet Into A Collaboration Platform
 http://p.sf.net/sfu/ExoPlatform
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] problem with patches in animation

2014-04-23 Thread Benjamin Root
Working off of very faded memory, try not to return any objects in your
init function that you intend to be animated. If I remember correctly, when
blitting is True, the animator treats any object returned by the init()
function as background objects, and any objects returned by the animation
function as blittable. Since your patch is returned in both functions, I
think it is getting confused.

Again, very rusty memory here...

Ben Root



On Wed, Apr 23, 2014 at 9:34 AM, Raymond Smith smit...@mit.edu wrote:

 Hi Mark,

 I can't say this is the 'proper' solution or the correct interpretation,
 but it should work.

 I think when blitting that the init function serves as a something of a
 background for the rest of the animation. So try changing


 def init():
 *patch.center = (5, 5)*
 ax.add_patch(patch)
 return patch,

 to

 def init():
 *patch.center = (5, -5)*
 ax.add_patch(patch)
 return patch,

 Cheers,
 Ray


 On Wed, Apr 23, 2014 at 5:44 AM, Mark Bakker mark...@gmail.com wrote:

 Hello list,

 I am trying to animate a patch. The animation should show a circle
 orbiting around a point. I took the code from
 http://nickcharlton.net/posts/drawing-animating-shapes-matplotlib.html

 Problem is that when I run the code, the animation doesn't remove the
 initial position of the circle (blit is True) while it works correctly on
 the website referenced above.

 Does anybody else see this behavior? Here's the code:

 import numpy as np
 from matplotlib import pyplot as plt
 from matplotlib import animation

 fig = plt.figure()
 fig.set_dpi(100)
 fig.set_size_inches(7, 6.5)

 ax = plt.axes(xlim=(0, 10), ylim=(0, 10))
 patch = plt.Circle((5, -5), 0.75, fc='y')

 def init():
 patch.center = (5, 5)
 ax.add_patch(patch)
 return patch,

 def animate(i):
 x, y = patch.center
 x = 5 + 3 * np.sin(np.radians(i))
 y = 5 + 3 * np.cos(np.radians(i))
 patch.center = (x, y)
 return patch,

 anim = animation.FuncAnimation(fig, animate,
init_func=init,
frames=360,
interval=20,
blit=True)

 plt.show()

 Thanks, Mark


 --
 Start Your Social Network Today - Download eXo Platform
 Build your Enterprise Intranet with eXo Platform Software
 Java Based Open Source Intranet - Social, Extensible, Cloud Ready
 Get Started Now And Turn Your Intranet Into A Collaboration Platform
 http://p.sf.net/sfu/ExoPlatform
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




 --
 Start Your Social Network Today - Download eXo Platform
 Build your Enterprise Intranet with eXo Platform Software
 Java Based Open Source Intranet - Social, Extensible, Cloud Ready
 Get Started Now And Turn Your Intranet Into A Collaboration Platform
 http://p.sf.net/sfu/ExoPlatform
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] problem with patches in animation

2014-04-23 Thread Raymond Smith
This is pretty weird. If instead of Mark's original script, if I move the
add_patch out of init and have the init simply return an empty tuple, it
_mostly_ works as expected. But -- at least on my computer -- on some runs,
it has the moving circle, but also leaves a circle at the top, starting
point, whereas on other runs it simply has the desired moving circle with
no 'background' circle. Usually, it will happen at least once if I start
the animation script 10 times. So still, the init function is a bit of a
mystery to me.

import numpy as np
from matplotlib import pyplot as plt
from matplotlib import animation

fig = plt.figure()
fig.set_dpi(100)
fig.set_size_inches(7, 6.5)

ax = plt.axes(xlim=(0, 10), ylim=(0, 10))
patch = plt.Circle((5, -5), 0.75, fc='y')
ax.add_patch(patch)

def init():
return tuple()

def animate(i):
x, y = patch.center
patch.set_facecolor('y')
patch.set_edgecolor('k')
x = 5 + 3 * np.sin(np.radians(i))
y = 5 + 3 * np.cos(np.radians(i))
patch.center = (x, y)
return patch,

anim = animation.FuncAnimation(fig, animate,
   init_func=init,
   frames=360,
   interval=20,
   blit=True)

plt.show()




On Wed, Apr 23, 2014 at 10:29 AM, Benjamin Root ben.r...@ou.edu wrote:

 Working off of very faded memory, try not to return any objects in your
 init function that you intend to be animated. If I remember correctly, when
 blitting is True, the animator treats any object returned by the init()
 function as background objects, and any objects returned by the animation
 function as blittable. Since your patch is returned in both functions, I
 think it is getting confused.

 Again, very rusty memory here...

 Ben Root



 On Wed, Apr 23, 2014 at 9:34 AM, Raymond Smith smit...@mit.edu wrote:

 Hi Mark,

 I can't say this is the 'proper' solution or the correct interpretation,
 but it should work.

 I think when blitting that the init function serves as a something of a
 background for the rest of the animation. So try changing


 def init():
 *patch.center = (5, 5)*
 ax.add_patch(patch)
 return patch,

 to

 def init():
 *patch.center = (5, -5)*
 ax.add_patch(patch)
 return patch,

 Cheers,
 Ray


 On Wed, Apr 23, 2014 at 5:44 AM, Mark Bakker mark...@gmail.com wrote:

 Hello list,

 I am trying to animate a patch. The animation should show a circle
 orbiting around a point. I took the code from
 http://nickcharlton.net/posts/drawing-animating-shapes-matplotlib.html

 Problem is that when I run the code, the animation doesn't remove the
 initial position of the circle (blit is True) while it works correctly on
 the website referenced above.

 Does anybody else see this behavior? Here's the code:

 import numpy as np
 from matplotlib import pyplot as plt
 from matplotlib import animation

 fig = plt.figure()
 fig.set_dpi(100)
 fig.set_size_inches(7, 6.5)

 ax = plt.axes(xlim=(0, 10), ylim=(0, 10))
 patch = plt.Circle((5, -5), 0.75, fc='y')

 def init():
 patch.center = (5, 5)
 ax.add_patch(patch)
 return patch,

 def animate(i):
 x, y = patch.center
 x = 5 + 3 * np.sin(np.radians(i))
 y = 5 + 3 * np.cos(np.radians(i))
 patch.center = (x, y)
 return patch,

 anim = animation.FuncAnimation(fig, animate,
init_func=init,
frames=360,
interval=20,
blit=True)

 plt.show()

 Thanks, Mark


 --
 Start Your Social Network Today - Download eXo Platform
 Build your Enterprise Intranet with eXo Platform Software
 Java Based Open Source Intranet - Social, Extensible, Cloud Ready
 Get Started Now And Turn Your Intranet Into A Collaboration Platform
 http://p.sf.net/sfu/ExoPlatform
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




 --
 Start Your Social Network Today - Download eXo Platform
 Build your Enterprise Intranet with eXo Platform Software
 Java Based Open Source Intranet - Social, Extensible, Cloud Ready
 Get Started Now And Turn Your Intranet Into A Collaboration Platform
 http://p.sf.net/sfu/ExoPlatform
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A 

Re: [Matplotlib-users] problem with patches in animation

2014-04-23 Thread Benjamin Root
I think it is because the figure may or may not have some things drawn by
the time the blitting starts. This is due to draw_idle(). So, it is trying
to capture whatever is in the figure's canvas, but drawing may or may not
have happened yet.

Try this:

def animate(i):
if not animate.patch:
animate.patch = plt.Circle((5, -5), 0.75, fc='y')
animate.ax.add_patch(animate.patch)
x, y = animate.patch.center
x = 5 + 3 * np.sin(np.radians(i))
y = 5 + 3 * np.cos(np.radians(i))
animate.patch.center = (x, y)
return animate.patch,
animate.ax = ax
animate.patch = None

If you have something more complicated, then just go full bore and use
classes to store the state.

Cheers!
Ben Root



On Wed, Apr 23, 2014 at 10:51 AM, Raymond Smith smit...@mit.edu wrote:

 This is pretty weird. If instead of Mark's original script, if I move the
 add_patch out of init and have the init simply return an empty tuple, it
 _mostly_ works as expected. But -- at least on my computer -- on some runs,
 it has the moving circle, but also leaves a circle at the top, starting
 point, whereas on other runs it simply has the desired moving circle with
 no 'background' circle. Usually, it will happen at least once if I start
 the animation script 10 times. So still, the init function is a bit of a
 mystery to me.


 import numpy as np
 from matplotlib import pyplot as plt
 from matplotlib import animation

 fig = plt.figure()
 fig.set_dpi(100)
 fig.set_size_inches(7, 6.5)

 ax = plt.axes(xlim=(0, 10), ylim=(0, 10))
 patch = plt.Circle((5, -5), 0.75, fc='y')
 ax.add_patch(patch)

 def init():
 return tuple()


 def animate(i):
 x, y = patch.center
 patch.set_facecolor('y')
 patch.set_edgecolor('k')

 x = 5 + 3 * np.sin(np.radians(i))
 y = 5 + 3 * np.cos(np.radians(i))
 patch.center = (x, y)
 return patch,

 anim = animation.FuncAnimation(fig, animate,
init_func=init,
frames=360,
interval=20,
blit=True)

 plt.show()




 On Wed, Apr 23, 2014 at 10:29 AM, Benjamin Root ben.r...@ou.edu wrote:

 Working off of very faded memory, try not to return any objects in your
 init function that you intend to be animated. If I remember correctly, when
 blitting is True, the animator treats any object returned by the init()
 function as background objects, and any objects returned by the animation
 function as blittable. Since your patch is returned in both functions, I
 think it is getting confused.

 Again, very rusty memory here...

 Ben Root



 On Wed, Apr 23, 2014 at 9:34 AM, Raymond Smith smit...@mit.edu wrote:

 Hi Mark,

 I can't say this is the 'proper' solution or the correct interpretation,
 but it should work.

 I think when blitting that the init function serves as a something of a
 background for the rest of the animation. So try changing


 def init():
 *patch.center = (5, 5)*
 ax.add_patch(patch)
 return patch,

 to

 def init():
 *patch.center = (5, -5)*
 ax.add_patch(patch)
 return patch,

 Cheers,
 Ray


 On Wed, Apr 23, 2014 at 5:44 AM, Mark Bakker mark...@gmail.com wrote:

 Hello list,

 I am trying to animate a patch. The animation should show a circle
 orbiting around a point. I took the code from
 http://nickcharlton.net/posts/drawing-animating-shapes-matplotlib.html

 Problem is that when I run the code, the animation doesn't remove the
 initial position of the circle (blit is True) while it works correctly on
 the website referenced above.

 Does anybody else see this behavior? Here's the code:

 import numpy as np
 from matplotlib import pyplot as plt
 from matplotlib import animation

 fig = plt.figure()
 fig.set_dpi(100)
 fig.set_size_inches(7, 6.5)

 ax = plt.axes(xlim=(0, 10), ylim=(0, 10))
 patch = plt.Circle((5, -5), 0.75, fc='y')

 def init():
 patch.center = (5, 5)
 ax.add_patch(patch)
 return patch,

 def animate(i):
 x, y = patch.center
 x = 5 + 3 * np.sin(np.radians(i))
 y = 5 + 3 * np.cos(np.radians(i))
 patch.center = (x, y)
 return patch,

 anim = animation.FuncAnimation(fig, animate,
init_func=init,
frames=360,
interval=20,
blit=True)

 plt.show()

 Thanks, Mark


 --
 Start Your Social Network Today - Download eXo Platform
 Build your Enterprise Intranet with eXo Platform Software
 Java Based Open Source Intranet - Social, Extensible, Cloud Ready
 Get Started Now And Turn Your Intranet Into A Collaboration Platform
 http://p.sf.net/sfu/ExoPlatform
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




 

Re: [Matplotlib-users] Make clear figure used in the powerpoint slides?

2014-04-23 Thread Chao YUE
yes, Ben, I understand the difference now.

To Mike: I have to select the region of the figure I need in the pdf file
and paste it in the powerpoint ... Isn't this you're doing as well?

But fine, I can go with the current quality. Thanks to you all for this
discussion.

Cheers,

Chao


On Tue, Apr 22, 2014 at 3:31 PM, Benjamin Root ben.r...@ou.edu wrote:

 Yes, there is a difference if you use the button versus explicitly stating
 the dpi in a savefig call. When you use the button, matplotlib has to use
 the default dpi since there is no other way to specify it.

 Cheers!
 Ben Root


 On Mon, Apr 21, 2014 at 5:03 PM, Chao YUE chaoyue...@gmail.com wrote:

 Yes, in fact I set dpi as 1000, which is already very high. In fact I
 have another question, will there be any difference if I use the save
 button on the interactive plotting toolbar and use the command line
 figure.savefig('xx.png',dpi=1000)?

 Chao


 On Mon, Apr 21, 2014 at 10:59 PM, Jody Klymak jkly...@uvic.ca wrote:

 Did you set the dpi of the png?

 Cheers,  Jody


 On Apr 21, 2014, at  13:50 PM, ChaoYue chaoyue...@gmail.com wrote:

 OK, I tried but I don't really see the difference between jpg and png by
 my eyes in the attached case, maybe for other more complicated plots there
 will be real difference. Anyway, thanks to all for your nice discussions.
 And, BTW, I tried 2 hours trying to find a way to convert svg to emf, but
 now I konw :p

 Cheers,

 Chao


 On Mon, Apr 21, 2014 at 9:49 PM, Benjamin Root-2 [via matplotlib] [hidden
 email] wrote:

 JPGs will *always* have bit blur as it is a lossy image format. PNGs
 would be a better bet.

 Ben Root


  On Mon, Apr 21, 2014 at 3:33 PM, ChaoYue [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=43265i=0
  wrote:

 Hi all,

 Thank you all for your kind response. I am sorry, but none of these
 solutions significantly improved the visual quality on microsoft 
 powerpiont
 2007. Thought I didn't try eps. So probably l have to go with the current
 quality.
 here is a best case I have now:
 https://www.dropbox.com/s/0uhjogalz92hssm/different_figure_example.pptx
 You can still see the a bit blur everywhere (currently with jpg
 being inserted directly). I didn't have better quality than this one by
 trying the method as suggested by you. Let me know if I am raising too 
 much
 high demand for this.

 Cheers,

 Chao


 On Mon, Apr 21, 2014 at 4:41 PM, Jonathan Slavin [via matplotlib] [hidden
 email] http://user/SendEmail.jtp?type=nodenode=43264i=0 wrote:

 ​Another alternative, if a vector graphics format doesn't work, is to
 make your png figure large.  Then when you shrink it down to fit in your
 slide, it should still have good resolution.

 Jon​

 On Mon, Apr 21, 2014 at 10:13 AM, [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=43262i=0
  wrote:

 No Powerpoint version I know supports SVG (or any vector graphics
 format useful in this case) and Matplotlib does not
 export WMF graphics anymore. So the easiest way is to use PNGs, if
 you can live with raster graphics.

 Alternatively, if you need vector graphics, you can export the
 Matplotlib plot as SVG and convert it to WMF or EMF using
 Inkscape. This can be done in the command line like this:

 c:\Program Files\Inkscape-0.48\inkscape.exe --without-gui
 --export-emf=output.emf input.svg


   Juergen



 --
 
 Jonathan D. Slavin Harvard-Smithsonian CfA
 [hidden email] http://user/SendEmail.jtp?type=nodenode=43262i=1
60 Garden Street, MS 83
 phone: a href=tel:%28617%29%20496-7981 value=a
 href=tel:%2B16174967981 value=+16174967981 target=_blank
 +16174967981 target=_blank(617) 496-7981   Cambridge, MA
 02138-1516
 fax: a href=tel:%28617%29%20496-7577 value=a
 href=tel:%2B16174967577 value=+16174967577 target=_blank
 +16174967577 target=_blank(617) 496-7577USA
 


 --

 Start Your Social Network Today - Download eXo Platform
 Build your Enterprise Intranet with eXo Platform Software
 Java Based Open Source Intranet - Social, Extensible, Cloud Ready
 Get Started Now And Turn Your Intranet Into A Collaboration Platform
 http://p.sf.net/sfu/ExoPlatform
 ___
 Matplotlib-users mailing list
 [hidden email] http://user/SendEmail.jtp?type=nodenode=43262i=2
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


 --
  If you reply to this email, your message will be added to the
 discussion below:

 http://matplotlib.1069221.n5.nabble.com/Make-clear-figure-used-in-the-powerpoint-slides-tp43252p43262.html
  To start a new topic under matplotlib - users, email [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=43264i=1
 To unsubscribe from matplotlib, click here.
 

Re: [Matplotlib-users] Make clear figure used in the powerpoint slides?

2014-04-23 Thread Jody Klymak

On Apr 23, 2014, at  8:35 AM, Chao YUE chaoyue...@gmail.com wrote:

 yes, Ben, I understand the difference now.
 
 To Mike: I have to select the region of the figure I need in the pdf file and 
 paste it in the powerpoint ... Isn't this you're doing as well? 

Why do you need to select a region?  This takes a screen grab that will be 
terrible quality, doesn't it?  Just drag the file into powerpoint (or use 
insert/picture).  If you need to crop the PDF do that in Acrobat, or whatever 
PDF software you use.  

Cheers,   Jody



 
 But fine, I can go with the current quality. Thanks to you all for this 
 discussion.
 
 Cheers,
 
 Chao
 
 
 On Tue, Apr 22, 2014 at 3:31 PM, Benjamin Root ben.r...@ou.edu wrote:
 Yes, there is a difference if you use the button versus explicitly stating 
 the dpi in a savefig call. When you use the button, matplotlib has to use the 
 default dpi since there is no other way to specify it.
 
 Cheers!
 Ben Root
 
 
 On Mon, Apr 21, 2014 at 5:03 PM, Chao YUE chaoyue...@gmail.com wrote:
 Yes, in fact I set dpi as 1000, which is already very high. In fact I have 
 another question, will there be any difference if I use the save button on 
 the interactive plotting toolbar and use the command line 
 figure.savefig('xx.png',dpi=1000)? 
 
 Chao
 
 
 On Mon, Apr 21, 2014 at 10:59 PM, Jody Klymak jkly...@uvic.ca wrote:
 Did you set the dpi of the png?
 
 Cheers,  Jody
 
 
 On Apr 21, 2014, at  13:50 PM, ChaoYue chaoyue...@gmail.com wrote:
 
 OK, I tried but I don't really see the difference between jpg and png by my 
 eyes in the attached case, maybe for other more complicated plots there will 
 be real difference. Anyway, thanks to all for your nice discussions. And, 
 BTW, I tried 2 hours trying to find a way to convert svg to emf, but now I 
 konw :p
 
 Cheers,
 
 Chao
 
 
 On Mon, Apr 21, 2014 at 9:49 PM, Benjamin Root-2 [via matplotlib] [hidden 
 email] wrote:
 JPGs will *always* have bit blur as it is a lossy image format. PNGs would 
 be a better bet.
 
 Ben Root
 
 
 On Mon, Apr 21, 2014 at 3:33 PM, ChaoYue [hidden email] wrote:
 Hi all,
 
 Thank you all for your kind response. I am sorry, but none of these 
 solutions significantly improved the visual quality on microsoft powerpiont 
 2007. Thought I didn't try eps. So probably l have to go with the current 
 quality. 
 here is a best case I have now: 
 https://www.dropbox.com/s/0uhjogalz92hssm/different_figure_example.pptx
 You can still see the a bit blur everywhere (currently with jpg being 
 inserted directly). I didn't have better quality than this one by trying the 
 method as suggested by you. Let me know if I am raising too much high demand 
 for this.
 
 Cheers,
 
 Chao
 
 
 On Mon, Apr 21, 2014 at 4:41 PM, Jonathan Slavin [via matplotlib] [hidden 
 email] wrote:
 ​Another alternative, if a vector graphics format doesn't work, is to make 
 your png figure large.  Then when you shrink it down to fit in your slide, 
 it should still have good resolution.
 
 Jon​
 
 On Mon, Apr 21, 2014 at 10:13 AM, [hidden email] wrote:
 No Powerpoint version I know supports SVG (or any vector graphics format 
 useful in this case) and Matplotlib does not
 export WMF graphics anymore. So the easiest way is to use PNGs, if you can 
 live with raster graphics.
 
 Alternatively, if you need vector graphics, you can export the Matplotlib 
 plot as SVG and convert it to WMF or EMF using
 Inkscape. This can be done in the command line like this:
 
 c:\Program Files\Inkscape-0.48\inkscape.exe --without-gui 
 --export-emf=output.emf input.svg
 
 
   Juergen
 
 
 -- 
 
 Jonathan D. Slavin Harvard-Smithsonian CfA
 [hidden email]   60 Garden Street, MS 83
 phone: a href=tel:%28617%29%20496-7981 value=a 
 href=tel:%2B16174967981 value=+16174967981 target=_blank+16174967981 
 target=_blank(617) 496-7981   Cambridge, MA 02138-1516
 fax: a href=tel:%28617%29%20496-7577 value=a href=tel:%2B16174967577 
 value=+16174967577 target=_blank+16174967577 target=_blank(617) 
 496-7577USA
 
 
 
 --
  
 Start Your Social Network Today - Download eXo Platform 
 Build your Enterprise Intranet with eXo Platform Software 
 Java Based Open Source Intranet - Social, Extensible, Cloud Ready 
 Get Started Now And Turn Your Intranet Into A Collaboration Platform 
 http://p.sf.net/sfu/ExoPlatform
 ___ 
 Matplotlib-users mailing list 
 [hidden email] 
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
 If you reply to this email, your message will be added to the discussion 
 below:
 http://matplotlib.1069221.n5.nabble.com/Make-clear-figure-used-in-the-powerpoint-slides-tp43252p43262.html
 To start a new topic under matplotlib - users, email [hidden email] 
 To unsubscribe from matplotlib, click 

Re: [Matplotlib-users] Make clear figure used in the powerpoint slides?

2014-04-23 Thread Sterling Smith

On Apr 23, 2014, at 11:41AM, Jody Klymak wrote:

 
 On Apr 23, 2014, at  8:35 AM, Chao YUE chaoyue...@gmail.com wrote:
 
 yes, Ben, I understand the difference now.
 
 To Mike: I have to select the region of the figure I need in the pdf file 
 and paste it in the powerpoint ... Isn't this you're doing as well? 
 
 Why do you need to select a region?  This takes a screen grab that will be 
 terrible quality, doesn't it?  Just drag the file into powerpoint (or use 
 insert/picture).  If you need to crop the PDF do that in Acrobat, or whatever 
 PDF software you use.  
 
 Cheers,   Jody

On a windows computer, I found these instructions for inserting a pdf file into 
powerpoint: [1]   These instructions indicate that you can not simply insert a 
pdf picture, as is done on a Mac, which might explain why he was selecting a 
region of the figure in a pdf viewer.  

Chao,

I'm not sure if the dpi setting or png format for savefig helped you.  In the 
future if you have to cut out a part of a pdf file, and if you are using Adobe 
reader, then there is a setting in the preferences for customizing the 
resolution of the clip you are selecting.

-Sterling

[1] 
http://office.microsoft.com/en-us/powerpoint-help/insert-pdf-file-content-into-a-powerpoint-presentation-HA102809687.aspx
--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] problem with patches in animation

2014-04-23 Thread Mark Bakker
Benjamin,

I don't mind doing classes to store the state, but isn't a Patch already a
class?
Do you know of an example online that I can work off?

Thanks for your suggestions,

Mark


On Wed, Apr 23, 2014 at 5:12 PM, Benjamin Root ben.r...@ou.edu wrote:

 I think it is because the figure may or may not have some things drawn by
 the time the blitting starts. This is due to draw_idle(). So, it is trying
 to capture whatever is in the figure's canvas, but drawing may or may not
 have happened yet.

 Try this:

 def animate(i):
 if not animate.patch:
 animate.patch = plt.Circle((5, -5), 0.75, fc='y')
 animate.ax.add_patch(animate.patch)
 x, y = animate.patch.center

 x = 5 + 3 * np.sin(np.radians(i))
 y = 5 + 3 * np.cos(np.radians(i))
 animate.patch.center = (x, y)
 return animate.patch,
 animate.ax = ax
 animate.patch = None

 If you have something more complicated, then just go full bore and use
 classes to store the state.

 Cheers!
 Ben Root



 On Wed, Apr 23, 2014 at 10:51 AM, Raymond Smith smit...@mit.edu wrote:

 This is pretty weird. If instead of Mark's original script, if I move the
 add_patch out of init and have the init simply return an empty tuple, it
 _mostly_ works as expected. But -- at least on my computer -- on some runs,
 it has the moving circle, but also leaves a circle at the top, starting
 point, whereas on other runs it simply has the desired moving circle with
 no 'background' circle. Usually, it will happen at least once if I start
 the animation script 10 times. So still, the init function is a bit of a
 mystery to me.


 import numpy as np
 from matplotlib import pyplot as plt
 from matplotlib import animation

 fig = plt.figure()
 fig.set_dpi(100)
 fig.set_size_inches(7, 6.5)

 ax = plt.axes(xlim=(0, 10), ylim=(0, 10))
 patch = plt.Circle((5, -5), 0.75, fc='y')
 ax.add_patch(patch)

 def init():
 return tuple()


 def animate(i):
 x, y = patch.center
 patch.set_facecolor('y')
 patch.set_edgecolor('k')

 x = 5 + 3 * np.sin(np.radians(i))
 y = 5 + 3 * np.cos(np.radians(i))
 patch.center = (x, y)
 return patch,

 anim = animation.FuncAnimation(fig, animate,
init_func=init,
frames=360,
interval=20,
blit=True)

 plt.show()




 On Wed, Apr 23, 2014 at 10:29 AM, Benjamin Root ben.r...@ou.edu wrote:

 Working off of very faded memory, try not to return any objects in your
 init function that you intend to be animated. If I remember correctly, when
 blitting is True, the animator treats any object returned by the init()
 function as background objects, and any objects returned by the animation
 function as blittable. Since your patch is returned in both functions, I
 think it is getting confused.

 Again, very rusty memory here...

 Ben Root



 On Wed, Apr 23, 2014 at 9:34 AM, Raymond Smith smit...@mit.edu wrote:

 Hi Mark,

 I can't say this is the 'proper' solution or the correct
 interpretation, but it should work.

 I think when blitting that the init function serves as a something of a
 background for the rest of the animation. So try changing


 def init():
 *patch.center = (5, 5)*
 ax.add_patch(patch)
 return patch,

 to

 def init():
 *patch.center = (5, -5)*
 ax.add_patch(patch)
 return patch,

 Cheers,
 Ray


 On Wed, Apr 23, 2014 at 5:44 AM, Mark Bakker mark...@gmail.com wrote:

 Hello list,

 I am trying to animate a patch. The animation should show a circle
 orbiting around a point. I took the code from
 http://nickcharlton.net/posts/drawing-animating-shapes-matplotlib.html

 Problem is that when I run the code, the animation doesn't remove the
 initial position of the circle (blit is True) while it works correctly on
 the website referenced above.

 Does anybody else see this behavior? Here's the code:

 import numpy as np
 from matplotlib import pyplot as plt
 from matplotlib import animation

 fig = plt.figure()
 fig.set_dpi(100)
 fig.set_size_inches(7, 6.5)

 ax = plt.axes(xlim=(0, 10), ylim=(0, 10))
 patch = plt.Circle((5, -5), 0.75, fc='y')

 def init():
 patch.center = (5, 5)
 ax.add_patch(patch)
 return patch,

 def animate(i):
 x, y = patch.center
 x = 5 + 3 * np.sin(np.radians(i))
 y = 5 + 3 * np.cos(np.radians(i))
 patch.center = (x, y)
 return patch,

 anim = animation.FuncAnimation(fig, animate,
init_func=init,
frames=360,
interval=20,
blit=True)

 plt.show()

 Thanks, Mark


 --
 Start Your Social Network Today - Download eXo Platform
 Build your Enterprise Intranet with eXo Platform Software
 Java Based Open Source Intranet - Social, Extensible, Cloud Ready
 Get Started Now And Turn Your Intranet Into A 

Re: [Matplotlib-users] problem with patches in animation

2014-04-23 Thread Mark Bakker
Raymond,

The documentation says:

If blit=True, *func* and *init_func* should return an iterable of drawables
to clear.

But clearly, whatever is set by init_func is not cleared during animation
when blit=True, while it is cleared when blit=False.

Unless anybody knows what I am doing wrong I will file a bug report.

Thanks again, Mark


On Wed, Apr 23, 2014 at 4:25 PM, Raymond Smith smit...@mit.edu wrote:

 Well, the intended behavior of init() isn't completely clear to me after
 reading over some of the docs http://matplotlib.org/contents.html and
 examples http://matplotlib.org/examples/animation/index.html, so I'm
 not sure if it's a bug or not. Either way, it could be a request for
 documentation, perhaps.


 On Wed, Apr 23, 2014 at 10:08 AM, Mark Bakker mark...@gmail.com wrote:

 I thought about that. I even thought about changing the initial color to
 white or radius to zero.

 But I am thinking this is a bug. When blitting, whatever is created with
 the init function is not removed. That is why lines that are animated
 initially have no data. For a Patch object this is a bit harder, as it
 needs something to begin with.

  It seems that this used to work in a previous version.

 Should I file a bug report?

 Mark


 On Wed, Apr 23, 2014 at 3:34 PM, Raymond Smith smit...@mit.edu wrote:

 Hi Mark,

 I can't say this is the 'proper' solution or the correct interpretation,
 but it should work.

 I think when blitting that the init function serves as a something of a
 background for the rest of the animation. So try changing


 def init():
 *patch.center = (5, 5)*
 ax.add_patch(patch)
 return patch,

 to

 def init():
 *patch.center = (5, -5)*
 ax.add_patch(patch)
 return patch,

 Cheers,
 Ray


 On Wed, Apr 23, 2014 at 5:44 AM, Mark Bakker mark...@gmail.com wrote:

 Hello list,

 I am trying to animate a patch. The animation should show a circle
 orbiting around a point. I took the code from
 http://nickcharlton.net/posts/drawing-animating-shapes-matplotlib.html

 Problem is that when I run the code, the animation doesn't remove the
 initial position of the circle (blit is True) while it works correctly on
 the website referenced above.

 Does anybody else see this behavior? Here's the code:

 import numpy as np
 from matplotlib import pyplot as plt
 from matplotlib import animation

 fig = plt.figure()
 fig.set_dpi(100)
 fig.set_size_inches(7, 6.5)

 ax = plt.axes(xlim=(0, 10), ylim=(0, 10))
 patch = plt.Circle((5, -5), 0.75, fc='y')

 def init():
 patch.center = (5, 5)
 ax.add_patch(patch)
 return patch,

 def animate(i):
 x, y = patch.center
 x = 5 + 3 * np.sin(np.radians(i))
 y = 5 + 3 * np.cos(np.radians(i))
 patch.center = (x, y)
 return patch,

 anim = animation.FuncAnimation(fig, animate,
init_func=init,
frames=360,
interval=20,
blit=True)

 plt.show()

 Thanks, Mark


 --
 Start Your Social Network Today - Download eXo Platform
 Build your Enterprise Intranet with eXo Platform Software
 Java Based Open Source Intranet - Social, Extensible, Cloud Ready
 Get Started Now And Turn Your Intranet Into A Collaboration Platform
 http://p.sf.net/sfu/ExoPlatform
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users





--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] problem with patches in animation

2014-04-23 Thread Benjamin Root
https://github.com/WeatherGod/BRadar

in scripts/, there is radarmovie.py which I create a few subclasses of
FuncAnimation, which was to solve a modularity issue I was having (I needed
self-contained animation classes that I could use pieces of elsewhere, but
still be able to join them all together into a single animation, as is the
case with radarmovie.py). Note, I do think I have an off-by-one error
somewhere, but I never have been able to figure it out, and these
particular animations do not use blitting because I didn't need it.

Now, you don't have to go all the way to subclassing FuncAnimation. The
suggestion about using classes is to avoid the (typically) bad style of
adding attributes to functions for the purpose of storing a state (which is
what a class is all about). You can't use a Patch object because the Patch
object wouldn't exist until the animation starts.

I hope that helps!
Ben Root



On Wed, Apr 23, 2014 at 3:38 PM, Mark Bakker mark...@gmail.com wrote:

 Benjamin,

 I don't mind doing classes to store the state, but isn't a Patch already a
 class?
 Do you know of an example online that I can work off?

 Thanks for your suggestions,

 Mark


 On Wed, Apr 23, 2014 at 5:12 PM, Benjamin Root ben.r...@ou.edu wrote:

 I think it is because the figure may or may not have some things drawn by
 the time the blitting starts. This is due to draw_idle(). So, it is trying
 to capture whatever is in the figure's canvas, but drawing may or may not
 have happened yet.

 Try this:

 def animate(i):
 if not animate.patch:
 animate.patch = plt.Circle((5, -5), 0.75, fc='y')
 animate.ax.add_patch(animate.patch)
 x, y = animate.patch.center

 x = 5 + 3 * np.sin(np.radians(i))
 y = 5 + 3 * np.cos(np.radians(i))
 animate.patch.center = (x, y)
 return animate.patch,
 animate.ax = ax
 animate.patch = None

 If you have something more complicated, then just go full bore and use
 classes to store the state.

 Cheers!
 Ben Root



 On Wed, Apr 23, 2014 at 10:51 AM, Raymond Smith smit...@mit.edu wrote:

 This is pretty weird. If instead of Mark's original script, if I move
 the add_patch out of init and have the init simply return an empty tuple,
 it _mostly_ works as expected. But -- at least on my computer -- on some
 runs, it has the moving circle, but also leaves a circle at the top,
 starting point, whereas on other runs it simply has the desired moving
 circle with no 'background' circle. Usually, it will happen at least once
 if I start the animation script 10 times. So still, the init function is a
 bit of a mystery to me.


 import numpy as np
 from matplotlib import pyplot as plt
 from matplotlib import animation

 fig = plt.figure()
 fig.set_dpi(100)
 fig.set_size_inches(7, 6.5)

 ax = plt.axes(xlim=(0, 10), ylim=(0, 10))
 patch = plt.Circle((5, -5), 0.75, fc='y')
 ax.add_patch(patch)

 def init():
 return tuple()


 def animate(i):
 x, y = patch.center
 patch.set_facecolor('y')
 patch.set_edgecolor('k')

 x = 5 + 3 * np.sin(np.radians(i))
 y = 5 + 3 * np.cos(np.radians(i))
 patch.center = (x, y)
 return patch,

 anim = animation.FuncAnimation(fig, animate,
init_func=init,
frames=360,
interval=20,
blit=True)

 plt.show()




 On Wed, Apr 23, 2014 at 10:29 AM, Benjamin Root ben.r...@ou.edu wrote:

 Working off of very faded memory, try not to return any objects in your
 init function that you intend to be animated. If I remember correctly, when
 blitting is True, the animator treats any object returned by the init()
 function as background objects, and any objects returned by the animation
 function as blittable. Since your patch is returned in both functions, I
 think it is getting confused.

 Again, very rusty memory here...

 Ben Root



 On Wed, Apr 23, 2014 at 9:34 AM, Raymond Smith smit...@mit.edu wrote:

 Hi Mark,

 I can't say this is the 'proper' solution or the correct
 interpretation, but it should work.

 I think when blitting that the init function serves as a something of
 a background for the rest of the animation. So try changing


 def init():
 *patch.center = (5, 5)*
 ax.add_patch(patch)
 return patch,

 to

 def init():
 *patch.center = (5, -5)*
 ax.add_patch(patch)
 return patch,

 Cheers,
 Ray


 On Wed, Apr 23, 2014 at 5:44 AM, Mark Bakker mark...@gmail.comwrote:

 Hello list,

 I am trying to animate a patch. The animation should show a circle
 orbiting around a point. I took the code from
 http://nickcharlton.net/posts/drawing-animating-shapes-matplotlib.html

 Problem is that when I run the code, the animation doesn't remove the
 initial position of the circle (blit is True) while it works correctly on
 the website referenced above.

 Does anybody else see this behavior? Here's the code:

 import numpy as np
 from matplotlib import pyplot as plt
 from 

[Matplotlib-users] turning off autoscale

2014-04-23 Thread Michael Mossey
I'm sorry, these are questions that could be found in the Axes 
documentation, but I really don't feel like scrolling through 100 pages 
that are irrelevant hoping I can find the relevant functions, which I 
don't even know what they are called. Is there ever going to be a 
concise listing of functions? Also there seem to be a lot of 
undocumented functions related to bounding boxes and copying from the 
background--I had to find Stack Overflow examples to learn about those.

What I want to do is

(1) plot a couple of lines with y autoscaling and x autoscaling on
(2) turn off y autoscaling so the y limits do not change further if the 
x limits are changed
(3) change the x limits

What axes functions are needed?

Note that I'm not using pyplot, rather the API so I'm looking for 
methods of Axes.

Mike


--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] turning off autoscale

2014-04-23 Thread Eric Firing
On 2014/04/23 11:19 AM, Michael Mossey wrote:
 I'm sorry, these are questions that could be found in the Axes
 documentation, but I really don't feel like scrolling through 100 pages
 that are irrelevant hoping I can find the relevant functions, which I
 don't even know what they are called. Is there ever going to be a
 concise listing of functions? Also there seem to be a lot of

PRs for doc improvements are welcome!

 undocumented functions related to bounding boxes and copying from the
 background--I had to find Stack Overflow examples to learn about those.

Doesn't the search box in the html docs help?  Or just plain browser 
searching when you are looking at the Axes API docs?

I also find that ipython is very helpful, with tab completion and the 
question mark for getting the doc string.  E.g., make an axes object and 
then use tab completion to see the methods that start with auto, and 
follow with a question mark to see the docstring.  Or a double question 
mark to see the code.


 What I want to do is

 (1) plot a couple of lines with y autoscaling and x autoscaling on
 (2) turn off y autoscaling so the y limits do not change further if the
 x limits are changed
 (3) change the x limits

 What axes functions are needed?

try:

ax.autoscale(enable=False, axis='y')

or

ax.set_autoscaley_on(False)

Ugly name for the method, but we're stuck with it.

These differ in that the first one turns y scaling off and then performs 
the autoscaling, while the second only turns y scaling off for any 
subsequent execution of the autoscale_view() method.

Eric


 Note that I'm not using pyplot, rather the API so I'm looking for
 methods of Axes.

 Mike


 --
 Start Your Social Network Today - Download eXo Platform
 Build your Enterprise Intranet with eXo Platform Software
 Java Based Open Source Intranet - Social, Extensible, Cloud Ready
 Get Started Now And Turn Your Intranet Into A Collaboration Platform
 http://p.sf.net/sfu/ExoPlatform
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users