0
は下記行われるように2つのセルを介して実行している場合、単一のセルを介して実行するとjupyterノートブックで動作しますが、失敗した次のスクリプトをしているIのステップノートブックの整理作業は?は
セル1:
class Plotting(object):
def __init__(self, run, hist):
self.running = run
self.histogram = hist
def start_plot(self):
if self.running:
self.run_fig, self.run_ax = plt.subplots(1,2)
if self.histogram:
self.hist_fig, self.hist_ax = plt.subplots(1,2)
def create_plots(self, iwindow, run_series, hist_series):
if self.running:
self.run_ax[iwindow].plot(run_series)
if self.histogram:
self.hist_ax[iwindow].hist(hist_series, histtype='step')
plot = Plotting(run =1, hist =1)
plot.start_plot()
がセル2:
for iwindow in np.arange(2):
r = np.random.rand(20)
h = np.random.rand(50)
plot.create_plots(iwindow, r, h)
スクリプトとしてまたはJupyter内から実行するかどうかを任意の違いがあってはなりません。もちろん、この質問がすべての重要な詳細を隠しているので、わからないことがあります。 [mcve]を参照してください。 – ImportanceOfBeingErnest
は今は大丈夫です。 – dayum