butt...@gmail.com, on 2011-04-04 05:15,  wrote:
> Hi,
> 
> Does matplotlib keep track of the last object added to the plot axes
> or its nature (line, text, collection, patch, etc.) ?
> If not, would it be feasible to implement something like this in
> matplotlib ?
> 
> This could be useful for interactive plotting, as it would allow a
> simple undo feature based on commands such as del ax.lines[-1].

Hi there,

I think this functionality already exists exactly as you
describe. ax.plot appends new lines to ax.lines, ax.scatter
appends new collection to ax.collections (via the
ax.add_collection method).

try this, and you'll see the cyan line is removed:

plt.plot([1,2,3],'r')
plt.plot([1,2,1],'c')
ax = plt.gca()
del(ax.lines[-1])
plt.draw()

-- 
Paul Ivanov
314 address only used for lists,  off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 

Attachment: signature.asc
Description: Digital signature

------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to