Quantcast
Viewing all articles
Browse latest Browse all 14011

Using plt.show() in python with fiure cleared

I runned my code on VSCode.

import matplotlib.pyplot as plt  # create and show first figure  plt.plot([1, 2, 3], [4, 5, 6])  plt.show()  # modifies the graph and displays it again        plt.title('Updated Plot') plt.show() # clears the current drawing     plt.clf()  # creates and displays a second graphic  plt.plot([4, 5, 6], [1, 2, 3])  plt.show()

The outputs are figures I upload.

By the way, the other weird thing is that the scale on the coordinate axis in the third figure is reversed.

Who can tell me a way to avoid it?

[figure1](https://i.stack.imgur.com/16OxA.png)

figure2

figure3

The outputs are on the details.


Viewing all articles
Browse latest Browse all 14011

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>