简体   繁体   中英

Use matplolib in Jupyter Notebook and Cannot Display Figure in the Proper Way

started to learn using matplotlib to create graphs. But I tried various plots and they are all displaying in a wired way. I can only see the top left corner of a figure. I tried Chrome and Microsoft Edge. Both of them had the same issue. Here is an example of what I got: I only see the top left cornor of the figure.

Here is some code that should definately work in Jupyter. If this code plots properly, then there is probably nothing wrong with your software. Give this code a try and see what happens.

    from matplotlib import pyplot as plt  
    
    x = [5, 2, 9, 4, 7]   
    y = [10, 5, 8, 4, 2]  
    
    plt.hist(y)  
      
    plt.show()  
    

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM