ipython中未定义plot?

-2 投票
1 回答
2423 浏览
提问于 2025-04-18 08:03

在ipython中使用它

def plotcorrected(self, conditions= 'all', strains= 'all'):
    # Plots the corrected fluorescence per cell for all strains in all conditions.
    '''
    S, t= self.d, self.t
    if conditions == 'all':
        cons= S.keys()
    else:
        cons= gu.makelist(conditions)
    for c in cons:
        if strains == 'all':
            strains=  S[c].keys()
        else:
            strains= gu.makelist(strains)
        for s in strains:
            if s != 'null' and s != 'WT':
                plt.figure()
                plt.plot(t, S[c][s]['mg'], '.-')
                plt.plot(t, S[c][s]['mg']+S[c][s]['sg'], 'k:', alpha=0.4)
                plt.plot(t, S[c][s]['mg']-S[c][s]['sg'], 'k:', alpha=0.4)
                plt.xlabel('time (hours)')
                plt.ylabel('corrected fluorescence')
                plt.title('corrected ' + s + ' in ' + c)
                plt.show()

但是当我尝试画图,比如用 plot(t, S['1%gal']['GAL10']['data'][:, 0], '.') 这行代码时,它返回了 plot没有定义

1 个回答

3

你在粘贴的代码中 漏掉了 一些内容。

import matplotlib.pyplot as plt

这段代码是你没有包含的部分。

撰写回答