I was running it on the Jupiter Notebook, but when I ran it on the Collaboration, the graph disappeared.
Please let me know if you know where to fix it.Thank you for your cooperation.
import matplotlib
defjp_us():
year=[1950, 1980, 2000, 2015, 2016]
japan = [82, 116, 126, 127, 126]
usa=[158,230,283,322,324]
matplotlib.pyplot.plot(year, japan, color='#FF0000', label='japan')
matplotlib.pyplot.plot(year, usa, color='#00FF00', label='usa')
matplotlib.pyplot.legend()
matplotlib.pyplot.show()
If this is all about the program, then the function is defined but not called, and therefore the contents of the function are not running.Please call the function.
After the def block, indentation is removed and a call to the jp_us function is added.
Calling the jp_us#jp_us function
matplotlib.pyplot.plot(year, japan, color='#FF0000', label='japan')
matplotlib.pyplot.plot(year, usa, color='#00FF00', label='usa')
matplotlib.pyplot.legend()
matplotlib.pyplot.show()
© 2024 OneMinuteCode. All rights reserved.