I have a function that will display a 3D sphere with matplotlib in tkinter. However, every time I call a function, performance when the sphere rotates rotates. Also, the chart is updated only after I try to rotate the sphere.
self.A is a variable that controls the size of the sphere.
My function:
def draw_fig(self): self.ax = Axes3D(self.fig) u = numpy.linspace(0, 2 * numpy.pi, 100) v = numpy.linspace(0, numpy.pi, 100) x = self.A * numpy.outer(numpy.cos(u), numpy.sin(v)) y = self.A * numpy.outer(numpy.sin(u), numpy.sin(v)) z = self.A * numpy.outer(numpy.ones(numpy.size(u)), numpy.cos(v)) t = self.ax.plot_surface(x, y, z, rstride=4, cstride=4,color='lightblue',linewidth=0)
source share