resetting a scatter array without creating a new scatter object

Hello, I’m trying to create just one scatter point and change its position. here’s my code:

marker = axes.scatter([xValue,], [yValue],])

#show the plots
canvas.draw()

I want to change the x and y value of the marker without creating a new marker (the old one is still showing). i saw that there was something like:

marker.set_array()

but I wasn’t sure how to use this properly. how can I dynamically reset my scatter position? thanks.

Jeff

···

matplotlib-users-request@lists.sourceforge.net wrote:

Send Matplotlib-users mailing list submissions to
matplotlib-users@lists.sourceforge.net

To subscribe or unsubscribe via the World Wide Web, visit

matplotlib-users List Signup and Options
or, via email, send a message with subject or body ‘help’ to
matplotlib-users-request@lists.sourceforge.net

You can reach the person managing the list at
matplotlib-users-admin@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than “Re: Contents of Matplotlib-users digest…”

Today’s Topics:

  1. Bug in WXAgg on OS X and Matplotlib 0.87 (Samuel M. Smith)
  2. Matplotlib installed font names (Samuel M. Smith)
  3. Getting latex fonts to display in plot window (Samuel M. Smith)
  4. Re: Getting latex fonts to display in plot window (Darren Dale)
  5. problem compiling matplotlib (-mtune=i686) (Sue Tranter)
  6. visualization tool (Ryan Krauss)
  7. Re: visualization tool (Arnd Baecker)

Message: 1
Cc: matplotlib-users@lists.sourceforge.net,
Smith Samuel
From: “Samuel M. Smith”
Date: Sat, 25 Feb 2006 10:22:57 -0700
To: Christopher Barker
Subject: [Matplotlib-users] Bug in WXAgg on OS X and Matplotlib 0.87

Setting the WX_CONFIG environment variable before the build fixed one
problem. It is now finding my matplotlibrc file.

I thought maybe it was a font corruption problem but it I use TkAgg
everything works fine with my 0.87.1cvs build. So
I think maybe I have uncovered a bug in the WXAgg? I would like to
help fix it but I don’t have a clue of where to start.

I also tried WxAgg with the first fonts in the rc file set to the
ones that come installed with matplotlib
font.serif : Bitstream Vera Serif
font.sans-serif : Bitstream Vera Sans

and it still crashes. So something is wrong. Maybe its my
environment. It would be nice if someone could verify
if they get the same
problem

Here is the debug output

AlBook:smithsm$ ipython -pylab
loaded rc file /Users/smithsm/.matplotlib/matplotlibrc
matplotlib version 0.87.1cvs
verbose.level debug
interactive is False
platform is darwin
loaded modules: [‘IPython.Prompts’, ‘_bisect’, ‘distutils’,
‘IPython.iplib’, ‘IPython.signal’, ‘random’, ‘IPython.FakeModule’,
‘datetime’, ‘matplotlib.tempfile’, ‘IPython.bdb’,
‘distutils.sysconfig’, ‘pytz.datetime’, ‘IPython.time’, ‘struct’,
‘re’, ‘tempfile’, ‘pprint’, ‘IPython.copy_reg’, ‘imp’,
‘IPython.OInspect’, ‘collections’, ‘IPython.pydoc’,
‘IPython.cStringIO’, ‘zipimport’, ‘IPython.codecs’, ‘string’,
‘matplotlib.dateutil’, ‘IPython.imp’, ‘repr’,
‘matplotlib.future’, ‘pytz.tzinfo’, ‘IPython.Itpl’,
‘IPython.Debugger’, ‘new’, ‘distutils.re’, ‘IPython.excolors’,
‘IPython.Queue’, ‘IPython.os’, ‘resource’, ‘bisect’, ‘IPython.glob’,
‘signal’, ‘cmd’, ‘pydoc’, ‘threading’, ‘token’,
‘shlex’,
‘pytz.bisect’, ‘IPython.shlex’, ‘matplotlib.pytz’,
‘IPython.exceptions’, ‘IPython.new’, ‘dis’, ‘cStringIO’, ‘locale’,
‘IPython.path’, ‘Queue’, ‘IPython.types’, ‘atexit’,
‘IPython.commands’, ‘encodings’, ‘IPython.threading’, ‘bdb’,
‘IPython.ConfigLoader’, ‘matplotlib.warnings’, ‘matplotlib.sys’,
‘encodings.types’, ‘posix’, ‘encodings.ascii’, ‘math’,
‘IPython.platutils_dummy’, ‘fcntl’, ‘IPython.profile’,
‘IPython.platutils_win32’, ‘dateutil’, ‘optparse’, ‘UserDict’,
‘inspect’, ‘distutils.os’, ‘matplotlib’, ‘IPython.hooks’,
‘exceptions’, ‘codecs’, ‘getopt’, ‘md5’, ‘IPython.ColorANSI’,
‘commands’, ‘socket’, ‘thread’, ‘sre’, ‘IPython.StringIO’,
‘traceback’, ‘IPython.pstats’, ‘pkg_resources’, ‘itertools’,
‘opcode’, ‘pstats’, ‘IPython.tokenize’, ‘distutils.sys’, ‘os’, ‘pdb’,
‘IPython.traceback’, ‘future’, ‘_sre’, ‘IPython.Shell’,
builtin’, ‘IPython’, ‘distutils.string’, ‘matplotlib.datetime’,
‘IPython.codeop’, ‘posixpath’, ‘popen2’, ‘errno’, ‘_socket’,
‘binascii’, ‘IPython.sys’, ‘IPython.re’, ‘sre_constants’,
‘IPython.platutils_posix’, ‘IPython.PyColorize’, ‘matplotlib.md5’,
‘types’, ‘IPython.genutils’, ‘tokenize’, ‘IPython.pdb’, ‘cPickle’,
‘pytz.sys’, ‘IPython.platutils’, ‘IPython.macro’, ‘_codecs’,
‘IPython.token’, ‘_locale’, ‘IPython.keyword’, ‘IPython.IPython’,
‘IPython.string’, ‘pytz’, ‘IPython.builtin’, ‘copy’,
‘matplotlib.os’, ‘IPython.socket’, ‘IPython.resource’, ‘IPython.cmd’,
‘keyword’, ‘StringIO’, ‘IPython.linecache’, ‘IPython.main’,
‘encodings.aliases’, ‘fnmatch’, ‘sre_parse’, ‘IPython.ultraTB’,
‘IPython.tempfile’, ‘IPython.Release’, ‘IPython.OutputTrap’,
‘copy_reg’, ‘sre_compile’, ‘_random’, ‘site’, ‘IPython.getopt’,
‘IPython.ipstruct’, ‘IPython.inspect’, ‘main’, ‘shutil’,
‘IPython.Magic’, ‘IPython.pprint’, ‘strop’, ‘IPython.bisect’,
‘IPython.textwrap’, ‘IPython.shutil’,
‘encodings.codecs’, ‘gettext’,
‘IPython.Logger’, ‘IPython.fnmatch’, ‘encodings.exceptions’,
‘pytz.sets’, ‘profile’, ‘IPython.wildcard’, ‘stat’, ‘_ssl’,
‘warnings’, ‘IPython.deep_reload’, ‘glob’, ‘sets’, ‘textwrap’, ‘sys’,
‘IPython.ipmaker’, ‘codeop’, ‘os.path’, ‘IPython.background_jobs’,
‘IPython.DPyGetOpt’, ‘IPython.cPickle’, ‘IPython.usage’,
‘matplotlib.distutils’, ‘distutils.errors’, ‘marshal’,
‘IPython.future’, ‘linecache’, ‘matplotlib.shutil’, ‘time’,
‘IPython.ipapi’]
numerix numpy 0.9.5.2006
font search path [‘/Library/Frameworks/Python.framework/Versions/2.4/
lib/python2.4/site-packages/matplotlib/mpl-data’]
trying fontname /Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/matplotlib/mpl-data/cmtt10.ttf
trying fontname /Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/matplotlib/mpl-data/VeraMoBd.ttf
trying fontname
/Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/matplotlib/mpl-data/VeraMoBI.ttf
trying fontname /Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/matplotlib/mpl-data/VeraBd.ttf
trying fontname /Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/matplotlib/mpl-data/VeraSeBd.ttf
trying fontname /Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/matplotlib/mpl-data/VeraMono.ttf
trying fontname /Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/matplotlib/mpl-data/cmsy10.ttf
trying fontname /Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/matplotlib/mpl-data/cmex10.ttf
trying fontname /Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/matplotlib/mpl-data/cmmi10.ttf
trying fontname /Library/Frameworks/Python.framework/Versions/2.4/lib/

python2.4/site-packages/matplotlib/mpl-data/VeraIt.ttf
trying fontname /Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/matplotlib/mpl-data/cmr10.ttf
trying fontname /Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/matplotlib/mpl-data/Vera.ttf
$HOME=/Users/smithsm
CONFIGDIR=/Users/smithsm/.matplotlib
loaded ttfcache file /Users/smithsm/.matplotlib/ttffont.cache
matplotlib data path /Library/Frameworks/Python.framework/Versions/
2.4/lib/python2.4/site-packages/matplotlib/mpl-data
backend WXAgg version 2.6.2.1
Python 2.4.2 (#3, Jan 8 2006, 20:33:07)
Type “copyright”, “credits” or “license” for more information.

IPython 0.7.1.fix1 – An enhanced Interactive Python.
? → Introduction to IPython’s features.
%magic → Information about IPython’s ‘magic’ % functions.
help → Python’s own help system.
object? → Details about ‘object’. ?object also
works, ?? prints more.

Welcome to pylab, a matplotlib-based Python environment.
For more information, type ‘help(pylab)’.

In [1]: plot([-2.345,-12.349])


exceptions.MemoryError Traceback (most
recent call last)

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/backends/backend_wx.py in _onPaint(self, evt)
1046 self.realize()
1047 # Render to the bitmap
→ 1048 self.draw(repaint=False)
1049 # Update the display using a PaintDC
1050 self.gui_repaint(drawDC=wx.PaintDC(self))

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/backends/backend_wxagg.py in draw(self, repaint)
60 FigureCanvasAgg.draw(self)
61
—> 62 self.bitmap =
_convert_agg_to_wx_bitmap
(self.get_renderer(), None)
63 if repaint:
64 self.gui_repaint()

MemoryError: _wxagg.convert_agg_to_wx_bitmap(): could not create the
wx.Bitmap


exceptions.MemoryError Traceback (most
recent call last)

/Install/Python/MacPython/Python2.4.2/MatPlotLib/examples/

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/pylab.py in plot(*args, **kwargs)
2122 def plot(*args, **kwargs):
2123 # allow callers to override the hold state by passing
hold=True|False
→ 2124 b = ishold()
2125 h = popd(kwargs, ‘hold’, None)
2126 if h is not None:

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/pylab.py in
ishold()
962 Return the hold status of the current axes
963 “”"
→ 964 return gca().ishold()
965
966 def isinteractive():

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/pylab.py in gca(**kwargs)
913 “”"
914
→ 915 ax = gcf().gca(**kwargs)
916 return ax
917

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/pylab.py in gcf()
923 return figManager.canvas.figure
924 else:
→ 925 return figure()
926
927 def gci():

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/pylab.py in figure(num, figsize, dpi, facecolor,
edgecolor, frameon)
893 figManager.canvas.figure.number = num
894
→ 895 draw_if_interactive()
896 return
figManager.canvas.figure
897

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/IPython/genutils.py in wrapper(*args, **kw)
802 def wrapper(*args,**kw):
803 wrapper.called = False
→ 804 out = func(*args,**kw)
805 wrapper.called = True
806 return out

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/backends/backend_wx.py in draw_if_interactive()
1170 figManager = Gcf.get_active()
1171 if figManager is not None:
→ 1172 figManager.canvas.draw()
1173
1174

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/backends/backend_wxagg.py in draw(self, repaint)
60 FigureCanvasAgg.draw(self)
61
—> 62 self.bitmap = _convert_agg_to_wx_bitmap
(self.get_renderer(),
None)
63 if repaint:
64 self.gui_repaint()

MemoryError: _wxagg.convert_agg_to_wx_bitmap(): could not create the
wx.Bitmap

In [2]:


exceptions.MemoryError Traceback (most
recent call last)

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/backends/backend_wx.py in _onPaint(self, evt)
1046 self.realize()
1047 # Render to the bitmap
→ 1048 self.draw(repaint=False)
1049 # Update the display using a PaintDC
1050 self.gui_repaint(drawDC=wx.PaintDC(self))

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/matplotlib/backends/backend_wxagg.py in draw(self, repaint)
60 FigureCanvasAgg.draw(self)
61
—> 62 self.bitmap = _convert_agg_to_wx_bitmap
(self.get_renderer(), None)
63 if repaint:
64 self.gui_repaint()

MemoryError: _wxagg.convert_agg_to_wx_bitmap(): could not create the
wx.Bitmap

Message: 2
Cc: Smith Samuel
From: “Samuel M. Smith”
Date: Sat, 25 Feb 2006 10:28:58 -0700
To: matplotlib-users@lists.sourceforge.net
Subject: [Matplotlib-users] Matplotlib installed font names

There are several fonts installed by matplotlib into the mpl_data
folder. The names or
sort of cryptic. I tried matching them up with the family names in
the matplotlibrc file list for
font.serif
font.sans-serif

but the only one that makes sense is Bitstream Vera
What is the family name for cmt, cms cmex and also the pXXX.afm
fonts?


Samuel M. Smith Ph.D.
2966 Fort Hill Road
Eagle Mountain, Utah 84043
801-768-2768 voice
801-768-2769 fax


“The greatest source of failure and unhappiness in the world is
giving up what we want most for what we want at the moment”


Message: 3
Cc: Rob Hetland ,
Smith Samuel
From: “Samuel M. Smith”
Date: Sat, 25 Feb 2006 10:32:56 -0700
To: matplotlib-users@lists.sourceforge.net
Subject: [Matplotlib-users] Getting latex fonts to display in plot window

Rob,

Is there a way for matplotlib to use the latex fonts in the plot
window not just in the saved version of the
graph?
Even when I have usetex True it picks a font from the font list given
in the matplotlibrc file.
How do I force it to use the type1cm or pslatex fonts?

Sam

Message: 4
From: Darren Dale
Organization: Cornell University
To: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] Getting latex fonts to display in plot window
Date: Sat, 25 Feb 2006 13:53:01 -0500

On Saturday 25 February 2006 12:32, Samuel M. Smith wrote:

Rob,

Is there a way for matplotlib to use the latex fonts in the plot
window not just in the saved version of the graph?
Even when I have usetex True it picks a font from the font list given
in the matplotlibrc file.

This is a new feature, it uses the font list to select the appropriate latex
font, and the same font is used in the saved version.

How do I force it to use the type1cm or
pslatex fonts?

For type1cm, use:

font.serif : serif (or “computer modern roman”)
font.sans-serif : sans-serif (or “computer modern sans-serif”)
font.monospace : monospace (or “computer modern typewriter”)

for pslatex, use:

font.serif : times
font.sans-serif : helvetica
font.monospace : courier

I’m planning on updating the usetex wiki page, I just havent had time to do it
yet.

Darren

Message: 5
Date: Sat, 25 Feb 2006 19:29:49 +0000 (GMT)
From: Sue Tranter
To: matplotlib-users@lists.sourceforge.net
Subject: [Matplotlib-users] problem compiling matplotlib (-mtune=i686)

I’m having problems compiling matplotlib. I’m running suse 9.3 (linux) and
have python:
Python 2.4.1 (#1, Sep 13 2005, 00:39:20)

I downloaded matplotlib-0.87.tar.gz, and have not changed the setup.py or
setupext.py at all. I think I have all the graphics things
installed.

The error message goes:

[snip]
building ‘matplotlib._agg’ extension
creating build/temp.linux-i686-2.4
creating build/temp.linux-i686-2.4/src
creating build/temp.linux-i686-2.4/agg23
creating build/temp.linux-i686-2.4/agg23/src
gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -march=i586 -mtune=i686
-fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -g -I/usr/X11R6/include -fPIC
-Iagg23/include -Isrc -Iswig -I/usr/include/python2.4 -c src/agg.cxx -o
build/temp.linux-i686-2.4/src/agg.o
cc1plus: error: invalid option `tune=i686’
error: command ‘gcc’ failed with exit status 1

gcc --version
gcc (GCC) 3.3.5 20050117 (prerelease) (SUSE Linux)
Copyright (C) 2003 Free Software Foundation, Inc.

I cant find anywhere in the matplotlib-0.87 directory structure that sets
this “tune=i686”. I have searched all the files in the directory structure
for “tune” and “i686”, so I’m guessing it’s set
somewhere else, but I dont
know where.
Can anyone help?

thanks
Sue

Message: 6
Date: Sat, 25 Feb 2006 15:28:49 -0500
From: “Ryan Krauss”
To: matplotlib-users
Subject: [Matplotlib-users] visualization tool

This is sort of not a matplotlib specific question, but it seems like
people on this list might be able to point me in some good directions.
I need to give a lecture on feedback control systems. I would like
to talk about stabalizing unstable systems and use an inverted
pendulum for an example. I know that Matlab had a demo like this that
included a fairly neat 2D visualization of a cart moving back and
forth with an inverted pendulum on it. I would need to run a
simulation in the background that outputs the cart position and the
pendulum angle and then I would want to create an animation of the
cart and pendulum
moving around.

Can anyone recommend a python package for doing this kind of animation?

Thanks,

Ryan

Message: 7
Date: Sun, 26 Feb 2006 00:33:18 +0100 (CET)
From: Arnd Baecker
To: Ryan Krauss
cc: matplotlib-users
Subject: Re: [Matplotlib-users] visualization tool

Hi Ryan,

On Sat, 25 Feb 2006, Ryan Krauss wrote:

This is sort of not a matplotlib specific question, but it seems like
people on this list might be able to point me in some good directions.
I need to give a lecture on feedback control systems. I would like
to talk about stabalizing unstable systems and use an inverted
pendulum for an example. I know that Matlab had a demo like this that
included a fairly neat 2D visualization of a cart moving back and
forth with an inverted pendulum on it. I would need to run a
simulation in the background that outputs the cart position and the
pendulum angle and then I would want to create an animation of the
cart and pendulum moving around.

Can anyone recommend a python package for doing this kind of animation?

First, you might try to use techniques described at
http://new.scipy.org/Wiki/Cookbook/Matplotlib/Animations
If you have a reasonably fast machine it might already work out
fine enough.
Other options are pygame (never used it myself)
and Vpython (www.vpython.org) which can do some very nice things
with remarkably little code.

Best, Arnd


Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

End of Matplotlib-users
Digest


Brings words and photos together (easily) with

PhotoMail - it’s free and works with Yahoo! Mail.