Ich habe ein Polardiagramm erstellt und möchte einen Doppler nachbilden. Dies beinhaltet einen 360-Grad-Sweep um den Kreis (Polar Plot). Sobald der Sweep auf 360 Grad kommt, muss er auf Null zurückkehren und den Sweep fortsetzen.Matplotlib Line Rotation oder Animation
Wie animiere oder rotiere ich diese Linie, um diesen Kreis ständig zu durchlaufen? Ich möchte nur eine Linie, die ständig um diese Handlung herumstreicht.
Ich habe mehrere verschiedene Beispiele betrachtet, jedoch keine, die diese Rotation erzeugen.
import numpy as np
import math
import matplotlib.pyplot as plt
import pylab
import time
r = 90 * (math.pi/180)
t = 50000
az = 90
el = 5
fig = pylab.figure(figsize = [5.0, 5.0])
ax = fig.gca(projection = 'polar')
fig.canvas.set_window_title('Doppler')
ax.plot(r, t, color ='b', marker = 'o', markersize = '3')
ax.set_theta_zero_location('N')
ax.set_theta_direction(-1)
currTime = time.time()
prevTime = currTime - 1
deltaTime = currTime - prevTime
outer_border_width = 1
screen_width = 500
screen_height = 500
midpoint = [int(screen_width/2), int(screen_height/2)]
radius = (midpoint[0])
sweep_length = radius - outer_border_width
angle = 50
sweep_interval = 10
sweep_speed = sweep_interval
x = sweep_length * math.sin(angle) + int(screen_width/2)
y = sweep_length * math.cos(angle) + int(screen_height/2)
az = az + ((360.0/sweep_interval) * deltaTime)
line1 = (midpoint, [50000, 50000])
#line2 = (midpoint, [20000, 20000])
ax.plot(line1, color = 'b', linewidth = 1)
#Increase the angle by 0.05 radians
angle = angle - sweep_speed
#Reset the angle to 0
if angle > 2 * math.pi:
angle = angle - 2 * math.pi
#ax.plot(line2, color = 'r', linewidth = 1)
#ax.lines.pop(0)
plt.show()
Unten ist ein Bild von dem, was es sieht derzeit wie als Referenz:
Vielen Dank!