Python matplotlib.pyplot 模块,get_backend() 实例源码

我们从Python开源项目中,提取了以下3个代码示例,用于说明如何使用matplotlib.pyplot.get_backend()

项目:didi_competition    作者:Heipiao    | 项目源码 | 文件源码
def plot_single_day_traffic(df):
    y_tj_l1 = df["tj_level1_count"]
    y_tj_l2 = df["tj_level2_count"]
    y_tj_l3 = df["tj_level3_count"]
    y_tj_l4 = df["tj_level4_count"]

    x_time = df["time"]
    x_district = df["district"]

    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')
    ax.scatter(x_time, x_district, y_tj_l1, )
    #ax.plot_surface(x_time, x_district, y_tj_l1)
    print(plt.get_backend())
    plt.show()
    plt.savefig("plot_traffic.png")
项目:latexipy    作者:masasin    | 项目源码 | 文件源码
def test_revert():
    with patch('matplotlib.rcParams.update') as mock_update, \
            patch('matplotlib.pyplot.switch_backend') as mock_switch:
        lp.latexify()
        lp.revert()
        mock_update.assert_called_with(dict(plt.rcParams))
        mock_switch.assert_called_with(plt.get_backend())
项目:hand_eye_calibration    作者:ethz-asl    | 项目源码 | 文件源码
def plot_alignment_errors(errors_position, rmse_pose, errors_orientation,
                          rmse_orientation, blocking=True):
  assert np.array_equal(errors_position.shape, errors_orientation.shape)

  num_error_values = errors_position.shape[0]

  title_position = 1.05
  fig = plt.figure()
  a1 = fig.add_subplot(2, 1, 1)
  fig.suptitle("Alignment Evaluation", fontsize='24')
  a1.set_title(
      "Red = Position Error Norm [m] - Black = RMSE", y=title_position)
  plt.plot(errors_position, c='r')
  plt.plot(rmse_pose * np.ones((num_error_values, 1)), c='k')
  a2 = fig.add_subplot(2, 1, 2)
  a2.set_title(
      "Red = Absolute Orientation Error [Degrees] - Black = RMSE", y=title_position)
  plt.plot(errors_orientation, c='r')
  plt.plot(rmse_orientation * np.ones((num_error_values, 1)), c='k')
  if plt.get_backend() == 'TkAgg':
    mng = plt.get_current_fig_manager()
    max_size = mng.window.maxsize()
    max_size = (max_size[0], max_size[1] * 0.45)
    mng.resize(*max_size)
  fig.tight_layout()
  plt.subplots_adjust(left=0.025, right=0.975, top=0.8, bottom=0.05)
  plt.show(block=blocking)