Hi,
I am newbie using Matplotlib. I have to do an interactive application and
before that, I am trying some tests to familiarize myself with the library.
I am plotting some 2d data together with 2 buttons. When one of the buttons
is pressed, only a few points should be remain in the plot, and when the
other button is pressed, all the initial points should be appear again. My
problem is that when I press the first button, the points which sould be
remain, change the colour (because I specify this), but the rest of the
points also remain. How can I repaint again the plot to get what I want?
Thanks in advance
Here is the code (except the class Datos since it is not relevant for the
plotting):
class eventos:
def __init__(self,datos, fig):
self._datos = datos
self._figure = fig
def pareto(self,event):
tupla = self._datos.buscarDominados()
sp=self._figure.add_subplot(111)
sp.plot(tupla[0], tupla[1], 'o', color = 'yellow')
def todos(self,event):
sp=self._figure.add_subplot(111)
sp.plot(self._datos.darX(), self._datos.darY(), 'o', color = 'blue')
import datos
import matplotlib.pyplot as plt
from matplotlib.widgets import Button
import eventos
X = datos.datos()
X.randomNums(100)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(X.darX(), X.darY(), 'o')
boton = eventos.eventos(X, fig)
axbut = plt.axes([0.77, 0.02, 0.1, 0.05])
axbut2 = plt.axes([0.88, 0.02, 0.1, 0.05])
bpareto = Button(axbut, 'Pareto')
bnormal = Button(axbut2, 'Todos')
bpareto.on_clicked(boton.pareto)
bnormal.on_clicked(boton.todos)
plt.show()
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users