当前位置: 首页>>代码示例>>Python>>正文


Python pyplot.rcdefaults方法代码示例

本文整理汇总了Python中matplotlib.pyplot.rcdefaults方法的典型用法代码示例。如果您正苦于以下问题:Python pyplot.rcdefaults方法的具体用法?Python pyplot.rcdefaults怎么用?Python pyplot.rcdefaults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.pyplot的用法示例。


在下文中一共展示了pyplot.rcdefaults方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: draw_plot

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import rcdefaults [as 别名]
def draw_plot(labels, value, save_path: pathlib.Path, log_scale=False):
        # Fixing random state for reproducibility
        np.random.seed(19680801)

        plt.rcdefaults()
        fig, ax = plt.subplots()

        # Example data
        # people = ('Tom', 'Dick', 'Harry', 'Slim', 'Jim')
        y_pos = np.arange(len(labels))
        # performance = 3 + 10 * np.random.rand(len(people))
        # error = np.random.rand(len(people))

        ax.barh(y_pos, value, align='center')
        ax.set_yticks(y_pos)
        ax.set_yticklabels(labels)
        if log_scale:
            ax.set_xscale('log')
        ax.invert_yaxis()  # labels read top-to-bottom
        ax.set_xlabel('Nb items')
        ax.set_title('How many items per cluster')

        plt.savefig(save_path)
        plt.show() 
开发者ID:CIRCL,项目名称:douglas-quaid,代码行数:26,代码来源:dataturks_graph.py

示例2: plot

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import rcdefaults [as 别名]
def plot(self, log_dir='', csv_file='', **kwargs):
        if log_dir is not '':
            if not os.path.isdir(log_dir):
                print('energyplus_model.plot: {} is not a directory'.format(log_dir))
                return
            print('energyplus_plot.plot log={}'.format(log_dir))
            self.log_dir = log_dir
            self.show_progress()
        else:
            if not os.path.isfile(csv_file):
                print('energyplus_model.plot: {} is not a file'.format(csv_file))
                return
            print('energyplus_model.plot csv={}'.format(csv_file))
            self.read_episode(csv_file)
            plt.rcdefaults()
            plt.rcParams['font.size'] = 6
            plt.rcParams['lines.linewidth'] = 1.0
            plt.rcParams['legend.loc'] = 'lower right'
            self.fig = plt.figure(1, figsize=(16, 10))
            self.plot_episode(csv_file)
            plt.show()

    # Show convergence 
开发者ID:IBM,项目名称:rl-testbed-for-energyplus,代码行数:25,代码来源:energyplus_model.py

示例3: _reset_matplotlib

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import rcdefaults [as 别名]
def _reset_matplotlib(gallery_conf, fname):
    """Reset matplotlib."""
    _, plt = _import_matplotlib()
    plt.rcdefaults() 
开发者ID:sphinx-gallery,项目名称:sphinx-gallery,代码行数:6,代码来源:scrapers.py

示例4: reset_style

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import rcdefaults [as 别名]
def reset_style():
    plt.rcdefaults() 
开发者ID:simetenn,项目名称:uncertainpy,代码行数:4,代码来源:prettyplot.py

示例5: create_plot

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import rcdefaults [as 别名]
def create_plot():
    plt.rcdefaults()
    fig, ax = plt.subplots()
    fig.set_size_inches(18, 10)
    return fig, ax 
开发者ID:elastic,项目名称:rally,代码行数:7,代码来源:analyze.py

示例6: analysis_hashtag

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import rcdefaults [as 别名]
def analysis_hashtag():
    with sqlite3.connect(db_path) as db:
        conn = db
        c = conn.cursor()
        c.execute("SELECT hashtag from Tweet")
        hashtag_list = []
        for row in c.fetchall():
            if (row != ('',)):
                if " " in ''.join(row):
                    for m in ''.join(row).split(' '):
                        hashtag_list.append(m)
                else:
                    signle_item = ''.join(row)
                    hashtag_list.append(signle_item)

        counter = Counter(hashtag_list).most_common(10)
        pl.rcdefaults()

        keys = []
        performance = []

        for i in counter:
            performance.append(i[1])
            keys.append(i[0])

        pl.rcdefaults()
        y_pos = np.arange(len(keys))
        error = np.random.rand(len(keys))

        pl.barh(y_pos, performance, xerr=error, align='center', alpha=0.4, )
        pl.yticks(y_pos, keys)
        pl.xlabel('quantity')
        pl.title('hashtags')
        print(colored("[INFO] Showing graph of hashtag analysis", "green"))
        pl.show() 
开发者ID:batuhaniskr,项目名称:twitter-intelligence,代码行数:37,代码来源:analysis.py

示例7: correlation_graph

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import rcdefaults [as 别名]
def correlation_graph(df,xlabel_str,title_str):
    plt.clf()
    corr =df.corr() 
    # print("_"*50,"correlation:")
    # print(corr)
    
    #01-correlation heatmap
    sns.set()
    f, ax = plt.subplots(figsize=(10*4.5, 10*4.5))
    sns.heatmap(corr, annot=True, fmt=".2f", linewidths=.5, ax=ax)
    
    #02-bar plot
    indicatorName=corr.columns.to_numpy()
    # plt.clf()
    plt.rcdefaults()
    plt.rcParams.update({'font.size':14})
    fig, ax = plt.subplots(figsize=(10*2, 10*2))  
    y_pos = np.arange(len(indicatorName))
    error = np.random.rand(len(indicatorName))
    
    ax.barh(y_pos, corr.PHMI.to_numpy(), align='center') #xerr=error, 
    ax.set_yticks(y_pos)
    ax.set_yticklabels(indicatorName)
    ax.invert_yaxis()  # labels read top-to-bottom
    ax.set_xlabel(xlabel_str)
    ax.set_title(title_str)
    for index, value in enumerate(corr.PHMI.to_numpy()):
        plt.text(value, index, str(round(value,2)))
    plt.show()
    
    return corr

#plot multiple curve 
开发者ID:richieBao,项目名称:python-urbanPlanning,代码行数:35,代码来源:driverlessCityProject_spatialPointsPattern_association_corr.py

示例8: plot

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import rcdefaults [as 别名]
def plot(dataset, split, path, out_path):
  if dataset in [
      'bace_c', 'bbbp', 'clintox', 'hiv', 'muv', 'pcba', 'pcba_146',
      'pcba_2475', 'sider', 'tox21', 'toxcast'
  ]:
    mode = 'classification'
  else:
    mode = 'regression'
  data = {}
  with open(path, 'r') as f:
    reader = csv.reader(f)
    for line in reader:
      if line[0] == dataset and line[1] == split:
        data[line[3]] = line[8]
  labels = []
  values = []
  colors = []
  for model in ORDER:
    if model in data.keys():
      labels.append(model)
      colors.append(COLOR[model])
      values.append(float(data[model]))
  y_pos = np.arange(len(labels))
  plt.rcdefaults()
  fig, ax = plt.subplots()

  ax.barh(y_pos, values, align='center', color='green')
  ax.set_yticks(y_pos)
  ax.set_yticklabels(labels)
  ax.invert_yaxis()
  if mode == 'regression':
    ax.set_xlabel('R square')
    ax.set_xlim(left=0., right=1.)
  else:
    ax.set_xlabel('ROC-AUC')
    ax.set_xlim(left=0.4, right=1.)
  t = time.localtime(time.time())
  ax.set_title("Performance on %s (%s split), %i-%i-%i" %
               (dataset, split, t.tm_year, t.tm_mon, t.tm_mday))
  plt.tight_layout()
  for i in range(len(colors)):
    ax.get_children()[i].set_color(colors[i])
    ax.text(
        values[i] - 0.1, y_pos[i] + 0.1, str("%.3f" % values[i]), color='white')
  fig.savefig(os.path.join(out_path, dataset + '_' + split + '.png'))
  #plt.show() 
开发者ID:deepchem,项目名称:deepchem,代码行数:48,代码来源:generate_graph.py

示例9: show_progress

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import rcdefaults [as 别名]
def show_progress(self):
        self.monitor_file = self.log_dir + '/monitor.csv'

        # Read progress file
        if not self.read_monitor_file():
            print('Progress data is missing')
            sys.exit(1)

        # Initialize graph
        plt.rcdefaults()
        plt.rcParams['font.size'] = 6
        plt.rcParams['lines.linewidth'] = 1.0
        plt.rcParams['legend.loc'] = 'lower right'

        self.fig = plt.figure(1, figsize=(16, 10))

        # Show widgets
        axcolor = 'lightgoldenrodyellow'
        self.axprogress = self.fig.add_axes([0.15, 0.10, 0.70, 0.15], facecolor=axcolor)
        self.axslider = self.fig.add_axes([0.15, 0.04, 0.70, 0.02], facecolor=axcolor)
        axfirst = self.fig.add_axes([0.15, 0.01, 0.03, 0.02])
        axlast = self.fig.add_axes([0.82, 0.01, 0.03, 0.02])
        axprev = self.fig.add_axes([0.46, 0.01, 0.03, 0.02])
        axnext = self.fig.add_axes([0.51, 0.01, 0.03, 0.02])

        # Slider is drawn in plot_progress()

        # First/Last button
        self.button_first = Button(axfirst, 'First', color=axcolor, hovercolor='0.975')
        self.button_first.on_clicked(self.first_episode_num)
        self.button_last = Button(axlast, 'Last', color=axcolor, hovercolor='0.975')
        self.button_last.on_clicked(self.last_episode_num)

        # Next/Prev button
        self.button_prev = Button(axprev, 'Prev', color=axcolor, hovercolor='0.975')
        self.button_prev.on_clicked(self.prev_episode_num)
        self.button_next = Button(axnext, 'Next', color=axcolor, hovercolor='0.975')
        self.button_next.on_clicked(self.next_episode_num)

        # Timer
        self.timer = self.fig.canvas.new_timer(interval=1000)
        self.timer.add_callback(self.check_update)
        self.timer.start()

        # Progress data
        self.axprogress.set_xmargin(0)
        self.axprogress.set_xlabel('Episodes')
        self.axprogress.set_ylabel('Reward')
        self.axprogress.grid(True)
        self.plot_progress()

        # Plot latest episode
        self.update_episode(self.num_episodes - 1)

        plt.show() 
开发者ID:IBM,项目名称:rl-testbed-for-energyplus,代码行数:57,代码来源:energyplus_model.py


注:本文中的matplotlib.pyplot.rcdefaults方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。