The screen flickers when using matplotlib to draw a continuous picture #9427
-
I took a reinforcement learning practice course in jupyter in VSCode. plt.figure(figsize=(4, 3))
display.clear_output(wait=True)
obs = env.reset()
print("run")
for t in range(TIME_LIMIT):
plt.gca().clear()
action = policy(obs, t) # Call your policy
# print(action)?
obs, reward, done, _ = env.step(action) # Pass the action chosen by the policy to the environment
# print(reward)
# We don't do anything with reward here because MountainCar is a very simple environment,
# and reward is a constant -1. Therefore, your goal is to end the episode as quickly as possible.
# Draw game image on display.
plt.imshow(env.render('rgb_array'))
display.clear_output(wait=True)
display.display(plt.gcf())
if done:
print("Well done!")
break
else:
print("Time limit exceeded. Try again.")
display.clear_output(wait=True) Is there any way to fix this? |
Beta Was this translation helpful? Give feedback.
Answered by
DonJayamanne
Mar 22, 2022
Replies: 1 comment
-
Thanks for bringing this up, I'm going to close this discussion in favor of this bug #9446 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ZionDoki
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for bringing this up, I'm going to close this discussion in favor of this bug #9446