带Jupyter笔记本的Matplotlib不会绘制绘图,但会更正轴值

2024-07-08 02:42:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图从工作代码中绘制绘图,但绘图似乎无法正常工作。它实际上使用正确的值绘制x轴和y轴,但实际的打印/图形不会出现

import matplotlib.pyplot as plt
%matplotlib inline
plt.style.use('ggplot')


plt.figure(figsize=(12,5))
plt.title("Rewards")
plt.bar(torch.arange(len(rewards_total)), rewards_total, alpha=0.6, color='green')
plt.show()

plt.figure(figsize=(12,5))
plt.title("Steps / Episode length")
plt.bar(torch.arange(len(steps_total)), steps_total, alpha=0.6, color='red')
plt.show()

plt.figure(figsize=(12,5))
plt.title("Egreedy value")
plt.bar(torch.arange(len(egreedy_total)), egreedy_total, alpha=0.6, color='blue')
plt.show()

enter image description here


Tags: alpha绘图lentitlematplotlibshow绘制bar

热门问题