Giter VIP home page Giter VIP logo

Comments (1)

DrxcoDev avatar DrxcoDev commented on June 6, 2024 1

Hello!! The issue you're facing stems from the fact that self.Live_ax.lines is a list of Line2D objects, and these objects do not have a remove() method. Instead, you can use the remove() function of the container, which is the axis itself (self.Live_ax in this case).

Actualiza el gráfico para mostrar la nueva imagen gráfica de la línea actual

def Update_Live_Graph(self, X_Data, Y_Data, X_est, Y_est):
self.Live_Canvas.restore_region(self.Live_background)
self.Live_ax.set_xlim(X_Data[0] - 300, X_Data[0] + 100)

# Plots gráfico teórico
if X_est is not None:
    if self.Live_X:
        self.Current_Lines_est = self.Live_ax.plot(X_est, Y_est, color='red', linestyle='dashed')[0]
        self.Live_Figure.add_artist(self.Current_Lines_est)
        self.Live_Figure.draw_artist(self.Current_Lines_est)
    else:
        X_est = np.append(X_est[0] + 300, X_est)
        Y_est = np.append(Y_est, Y_est[-1])
        self.Current_Lines_est = self.Live_ax.plot(X_est, Y_est, color='red', linestyle='dashed')[0]
        self.Live_Figure.add_artist(self.Current_Lines_est)
        self.Live_Figure.draw_artist(self.Current_Lines_est)

# Draw the True line
self.Current_Lines = self.Live_ax.plot(X_Data, Y_Data, color='blue')[0]

# Draw the marker to highlight the last point
self.Last_Point = self.Live_ax.plot(X_Data[0], Y_Data[0], color='black', marker='.', linewidth=4, markersize=10)[0]

self.Live_Figure.add_artist(self.Current_Lines)
self.Live_Figure.draw_artist(self.Current_Lines)
self.Live_Figure.add_artist(self.Last_Point)
self.Live_Figure.draw_artist(self.Last_Point)

# Refresh the canvas
self.Live_Canvas.blit(self.Live_ax.bbox)

# Remove the lines from the image
try:
    self.Live_ax.lines.remove(self.Current_Lines_est)
    self.Live_ax.lines.remove(self.Current_Lines)
except ValueError:
    pass

self.Current_Lines_est.remove()
self.Current_Lines.remove()
self.Last_Point.remove()

from python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.