Pycharm does not show plot

后端 未结 25 1127
鱼传尺愫
鱼传尺愫 2020-12-04 09:13

Pycharm does not show plot from the following code:

import pandas as pd
import numpy as np
import matplotlib as plt

ts = pd.Series(np.random.randn(1000), in         


        
25条回答
  •  青春惊慌失措
    2020-12-04 09:16

    In my case, I wanted to do the following:

        plt.bar(range(len(predictors)), scores)
        plt.xticks(range(len(predictors)), predictors, rotation='vertical')
        plt.show()
    

    Following a mix of the solutions here, my solution was to add before that the following commands:

        matplotlib.get_backend()
        plt.interactive(False)
        plt.figure()
    

    with the following two imports

       import matplotlib
       import matplotlib.pyplot as plt
    

    It seems that all the commands are necessary in my case, with a MBP with ElCapitan and PyCharm 2016.2.3. Greetings!

提交回复
热议问题