python matlabplot animation_Python Matplotlib,Stem plot无法使用FuncAnimation

我正在尝试从传入的数据包绘制实时数据。我有四个子图,在其中一个子图上,我想将数据绘制为干图,但我收到以下错误:

self.stemlines.set_数据(z,y)

AttributeError:“list”对象没有属性“set\u data”

在plt.绘图工作很好,但我不能让它工作plt.蒸汽. 在import matplotlib

matplotlib.use('Qt5Agg')

import matplotlib.pyplot as plt

from matplotlib.widgets import TextBox

import matplotlib

class PlotEngine:

def __init__(self, axisChanged):

# plt.style.use('seaborn-whitegrid')

# style.use('fivethirtyeight')

initialMinValue = '14.4'

initialMaxValue = '14.9'

plt.style.use('ggplot')

matplotlib.rc('axes', titlesize=8) # fontsize of the axes title

matplotlib.rc('axes', labelsize=8)

matplotlib.rc('xtick', labelsize=8) # fontsize of the tick labels

matplotlib.rc('ytick', labelsize=8) # fontsize of the tick labels axes.titlesize

matplotlib.rc('figure', titlesize=8)

self.fig, self.ax = plt.subplots(2, 2)

plt.ion()

# plt.subplot(2, 2, 4, polar=True)

self.fig.patch.set_facecolor('gray')

self.axpolar = plt.subplot(2, 2, 4, projection='polar')

self.axpolar.set_facecolor('black')

# self.ax[1, 1] = fig.add_subplot(2, 2, 4, projection='polar')

self.ax[0, 0].set_facecolor('black')

self.ax[0, 1].set_facecolor('black')

self.ax[1, 0].set_facecolor('black')

self.ax[1, 1].set_facecolor('black')

self.axisChanged = axisChanged

self.slider_freq = plt.axes([0.1, 0.01, 0.3, 0.01])

self.slider_azi = plt.axes([0.5, 0.01, 0.3, 0.01])

self.freqAxBoxMin = plt.axes([0.55, 0.33, 0.04, 0.03])

self.freqAxBoxMax = plt.axes([0.55, 0.28, 0.04, 0.03])

self.freqMinValueBox = TextBox(self.freqAxBoxMin, 'Min Freq:', initial=initialMinValue)

self.freqMaxValueBox = TextBox(self.freqAxBoxMax, 'Max Freq:', initial=initialMaxValue)

self.aziAxBoxMin = plt.axes([0.55, 0.18, 0.04, 0.03])

self.aziAxBoxMax = plt.axes([0.55, 0.10, 0.04, 0.03])

self.aziMinValueBox = TextBox(self.aziAxBoxMin, 'Min Dir:', initial='-180')

self.aziMaxValueBox = TextBox(self.aziAxBoxMax, 'Max Dir:', initial='180')

self.zeroOne, = self.ax[0, 1].plot([], [], 'ro')

self.oneOne, = self.axpolar.plot([], [], 'ro')

self.markerline, self.stemlines, self.baseline, = self.ax[1, 0].stem([1], [1], bottom=-140)

self.ax[0, 1].set_xlim([0, 60])

self.ax[0, 1].set_ylim([-140, -40])

self.axpolar.set_yticks(range(-90, -30, 10)) # Define the yticks

# self.axpolar.set_yticklabels(map(str, range(-90, -30, -10))) # Change the labels

self.ax[1, 0].set_xlim([14, 14.8])

self.ax[1, 0].set_ylim([-140, -40])

# self.background = fig.canvas.copy_from_bbox(self.ax.bbox)

def animateZeroOne(self, i, azimuth, rss, freqGhz):

x = azimuth

y = rss

z = freqGhz

self.zeroOne.set_data(x, y)

self.oneOne.set_data(x, y)

self.stemlines.set_data(z, y)

self.markerline.set_data(z, y)

return self.zeroOne, self.oneOne, self.stemlines, self.markerline

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值