def plot_vel_acc_rdis(vel, acc, rdis):
    title_font_dict = {
        'family': 'Times New Roman',
        'color': 'black',
        'weight': 'normal',
        'fontsize': 15
    }

    axis_font_dict = {
        'family': 'Times New Roman',
        'color': 'black',
        'weight': 'normal',
        'fontsize': 30
    }
    legend_font = {
        'family': 'Times New Roman',
        'weight': 'normal',
        'size': 10,
    }
    vel_x = np.array(vel)[:, 0] / 10.
    vel_y = np.array(vel)[:, 1]

    acc_x = np.array(acc)[:, 0] / 10.
    acc_y = np.array(acc)[:, 1]

    rdis_x = np.array(rdis)[:, 0] / 10.
    rdis_y = np.array(rdis)[:, 1]

    fig = plt.figure(figsize=(10, 3.5), dpi=200)

    vel_axes = HostAxes(fig, [0.05, 0.1, 0.8, 0.8])
    acc_axes = ParasiteAxes(vel_axes, sharex=vel_axes)
    rdis_axes = ParasiteAxes(vel_axes, sharex=vel_axes)
    vel_axes.parasites.append(acc_axes)
    vel_axes.parasites.append(rdis_axes)

    vel_axes.set_ylabel('Velocity (m/s)')
    vel_axes.set_xlabel('Time (s)')

    vel_axes.axis['right'].set_visible(False)
    acc_axes.axis['right'].set_visible(True)

    acc_axes.set_ylabel('Acceleration (m/s^2)')

    acc_axes.axis['right'].major_ticklabels.set_visible(True)
    acc_axes.axis['right'].label.set_visible(True)

    rdis_axes.set_ylabel('Relative distance (m)')
    offset = (60, 0)
    new_axisline = rdis_axes._grid_helper.new_fixed_axis
    rdis_axes.axis['right2'] = new_axisline(loc='right',
                                            axes=rdis_axes,
                                            offset=offset)

    fig.add_axes(vel_axes)

    p1, = vel_axes.plot(vel_x, vel_y, label="Vel", linewidth=2)
    p2, = acc_axes.plot(acc_x, acc_y, label="Acc", linewidth=2)
    p3, = rdis_axes.plot(rdis_x, rdis_y, label="RD", linewidth=2)

    vel_axes.legend(prop=legend_font)

    vel_axes.set_ylim(0, np.max(vel_y) + 1)
    vel_axes.set_xlim(0, np.max(vel_x))
    rdis_axes.set_ylim(0, np.max(rdis_y) + 1)

    # plt.plot(vel_x, vel_y, color="green", label="Velocity", linewidth=2)
    # plt.ylabel('Velocity (m/s)', fontdict=axis_font_dict)
    #
    # plt.plot(acc_x, acc_y, color="orange", label="Acceleration", linewidth=2, secondary_y=True)
    # plt.ylabel('Acceleration (m/s^2)', fontdict=axis_font_dict)
    #

    plt.title('Kinematic information of host vehicle',
              fontdict=title_font_dict)
    # plt.xlabel('Time (s)', fontdict=axis_font_dict)
    # plt.ylabel('Likelihood', fontdict=axis_font_dict)
    # plt.tick_params(labelsize=20)
    plt.legend(prop=legend_font)

    # plt.ylim(0., 1.)
    # left, right = plt.xlim()
    # plt.xlim(0., right)
    plt.show()
    pass
Esempio n. 2
0
host.axis["right"].set_visible(False)
par1.axis["right"].set_visible(True)
par1.set_ylabel("Temperature")

par1.axis["right"].major_ticklabels.set_visible(True)
par1.axis["right"].label.set_visible(True)

par2.set_ylabel("Velocity")
offset = (60, 0)
new_axisline = par2._grid_helper.new_fixed_axis
par2.axis["right2"] = new_axisline(loc="right", axes=par2, offset=offset)

fig.add_axes(host)

host.set_xlim(0, 2)
host.set_ylim(0, 2)

host.set_xlabel("Distance")
host.set_ylabel("Density")
par1.set_ylabel("Temperature")

p1, = host.plot([0, 1, 2], [0, 1, 2], label="Density")
p2, = par1.plot([0, 1, 2], [0, 3, 2], label="Temperature")
p3, = par2.plot([0, 1, 2], [50, 30, 15], label="Velocity")

par1.set_ylim(0, 4)
par2.set_ylim(1, 65)

host.legend()
Esempio n. 3
0
host = HostAxes(fig, [0.1, 0.1, 0.8, 0.8])
par1 = ParasiteAxes(host, sharex=host)
host.parasites.append(par1)
host.set_ylabel("Density")
host.set_xlabel("Distance")

host.axis["right"].set_visible(True)
par1.axis["right"].set_visible(True)
par1.set_ylabel("Temperature")

par1.axis["right"].major_ticklabels.set_visible(True)
par1.axis["right"].label.set_visible(True)

fig.add_axes(host)

host.set_xlim(1975, 2010)
host.set_ylim(0, 100)

host.set_xlabel("GDP and Success rate")
host.set_ylabel("GDP per five years (*2*10^10")
par1.set_ylabel("Success Rate (%)")

p1, = host.plot(names, gdp_values, label="GDP")
p2, = par1.plot(names, edu_values, label="Success Rate")

par1.set_ylim(0, 100)

host.legend()

host.axis["left"].label.set_color(p1.get_color())
par1.axis["right"].label.set_color(p2.get_color())
Esempio n. 4
0
ax_wear.set_ylabel('Wear')

load_axisline = ax_load.get_grid_helper().new_fixed_axis
cp_axisline = ax_cp.get_grid_helper().new_fixed_axis
wear_axisline = ax_wear.get_grid_helper().new_fixed_axis

ax_load.axis['right2'] = load_axisline(loc='right',
                                       axes=ax_load,
                                       offset=(40, 0))
ax_cp.axis['right3'] = cp_axisline(loc='right', axes=ax_cp, offset=(80, 0))
ax_wear.axis['right4'] = wear_axisline(loc='right',
                                       axes=ax_wear,
                                       offset=(120, 0))

fig.add_axes(ax_cof)
''' #set limit of x, y
ax_cof.set_xlim(0,2)
ax_cof.set_ylim(0,3)
'''

curve_cof, = ax_cof.plot([0, 1, 2], [0, 1, 2], label="CoF", color='black')
curve_temp, = ax_temp.plot([0, 1, 2], [0, 3, 2], label="Temp", color='red')
curve_load, = ax_load.plot([0, 1, 2], [1, 2, 3], label="Load", color='green')
curve_cp, = ax_cp.plot([0, 1, 2], [0, 40, 25], label="CP", color='pink')
curve_wear, = ax_wear.plot([0, 1, 2], [25, 18, 9], label="Wear", color='blue')

ax_temp.set_ylim(0, 4)
ax_load.set_ylim(0, 4)
ax_cp.set_ylim(0, 50)
ax_wear.set_ylim(0, 30)
Esempio n. 5
0
    host.axis["right"].set_visible(False)
    par1.axis["right"].set_visible(True)
    par1.set_ylabel("Temperature")

    par1.axis["right"].major_ticklabels.set_visible(True)
    par1.axis["right"].label.set_visible(True)

    par2.set_ylabel("Velocity")
    offset = (60, 0)
    new_axisline = par2._grid_helper.new_fixed_axis
    par2.axis["right2"] = new_axisline(loc="right", axes=par2, offset=offset)

    fig.add_axes(host)

    host.set_xlim(0, 2)
    host.set_ylim(0, 2)

    host.set_xlabel("Distance")
    host.set_ylabel("Density")
    par1.set_ylabel("Temperature")

    p1, = host.plot([0, 1, 2], [0, 1, 2], label="Density")
    p2, = par1.plot([0, 1, 2], [0, 3, 2], label="Temperature")
    p3, = par2.plot([0, 1, 2], [50, 30, 15], label="Velocity")

    par1.set_ylim(0, 4)
    par2.set_ylim(1, 65)

    host.legend()
        #elif i == 2 :
        #elif i < len(values) - 1 :
        #p1, = par1.plot(values[i], zcs[i], label= os.path.splitext(os.path.basename(filenames[i + 1]))[0])
        #    p1, = par1.plot(values[i], zcs[i], label= "RDI")
    elif i == 3:
        host.plot(values[i],
                  zcs[i],
                  label="L-Architect PAD",
                  linewidth=0.8,
                  color=palettes["L-Architect"])

#par1.set_ylim(0, 16)
#par2.set_ylim(1, 65)

host.set_ylim(0, 16)
host.set_xlim(0, MAX_X)
host.legend()

#p1
#maxPoints =
if max(values[2]) < 3:
    par1.set_xlim(0, 8)

#remove decima if it is integer
#pointsXlabels = par1.get_xticks().tolist()
#pointsTicklabels = []
#for lab in pointsXlabels:
#    newtick = float(lab)
#    newtickstring = str(float(newtick))
#    if newtick.is_integer() :
#        newtickstring = str(int(newtick))
Esempio n. 7
0
    par1.set_ylabel('功率(P)(kW)', color="red")
>>>>>>> f5b55f5735c94ec9573668b5d56b78a8eef2e8f7

    par1.axis['right'].major_ticklabels.set_visible(True)
    par1.axis['right'].label.set_visible(True)

<<<<<<< HEAD
    par2.set_ylabel('扬程')
=======
    par2.set_ylabel('效率(E)(%)', color="blue")
>>>>>>> f5b55f5735c94ec9573668b5d56b78a8eef2e8f7
    offset = (60, 0)
    new_axisline = par2._grid_helper.new_fixed_axis
    par2.axis['right2'] = new_axisline(loc='right', axes=par2, offset=offset)
    fig.add_axes(host)
    host.set_xlim(0, fm + 1)
<<<<<<< HEAD
    host.set_ylim(0, hm + 5)

    host.set_xlabel('流量')
    host.set_ylabel('功率')
    host.set_ylabel('效率')
    x = np.linspace(0, fm, 500)
    y = headparameters[0] * x ** 2 + headparameters[1] * x + headparameters[2]
    p1, = host.plot(x, y, label="HQ拟合曲线", color="black")
    host.scatter(flow1, head1, label="HQ离散数据")
    x1 = np.linspace(0, fm, 500)
    y1 = powerparameters[0] * x ** 2 + powerparameters[1] * x + powerparameters[2]
    p2, = par1.plot(x, y1, label="PQ拟合曲线", color="red")
    par1.scatter(flow1, power1, label="PQ离散数据")
    x2 = np.linspace(0, fm, 500)
Esempio n. 8
0
def draw_point_fcst(t2m=None,
                    u10m=None,
                    v10m=None,
                    rn=None,
                    model=None,
                    output_dir=None,
                    points=None,
                    extra_info=None):

    plt.rcParams['font.sans-serif'] = ['SimHei']  # 步骤一(替换sans-serif字体)
    plt.rcParams['axes.unicode_minus'] = False  # 步骤二(解决坐标轴负数的负号显示问题)
    if (sys.platform[0:3] == 'lin'):
        locale.setlocale(locale.LC_CTYPE, 'zh_CN.utf8')
    if (sys.platform[0:3] == 'win'):
        locale.setlocale(locale.LC_CTYPE, 'chinese')

    initTime = pd.to_datetime(str(
        t2m['forecast_reference_time'].values)).replace(
            tzinfo=None).to_pydatetime()

    # draw figure
    fig = plt.figure(figsize=(16, 4.5))
    ax_t2m = HostAxes(fig, [0.1, 0.28, .8, .62])
    ax_rn = ParasiteAxes(ax_t2m, sharex=ax_t2m)
    #其他信息

    #append axes
    ax_t2m.parasites.append(ax_rn)

    #invisible right axis of ax
    ax_t2m.axis['right'].set_visible(False)
    ax_t2m.axis['right'].set_visible(False)
    ax_rn.axis['right'].set_visible(True)
    ax_rn.axis['right'].major_ticklabels.set_visible(True)
    ax_rn.axis['right'].label.set_visible(True)
    #set label for axis
    ax_t2m.set_ylabel('温度($^\circ$C)', fontsize=100)
    ax_rn.set_ylabel('降水(mm)', fontsize=100)
    fig.add_axes(ax_t2m)

    # draw main figure
    #2米温度——————————————————————————————————————
    if (model == '中央台指导'):
        model = '智能网格'
    utl.add_public_title_sta(title=model + '预报 ' + extra_info['point_name'] +
                             ' [' + str(points['lon'][0]) + ',' +
                             str(points['lat'][0]) + ']',
                             initTime=initTime,
                             fontsize=21)
    for ifhour in t2m['forecast_period'].values:
        if (ifhour == t2m['forecast_period'].values[0]):
            t2m_t = (initTime + timedelta(hours=ifhour))
        else:
            t2m_t = np.append(t2m_t, (initTime + timedelta(hours=ifhour)))

    curve_t2m = ax_t2m.plot(t2m_t,
                            np.squeeze(t2m['data'].values),
                            c='#FF6600',
                            linewidth=3,
                            label='2m温度')
    ax_t2m.set_xlim(t2m_t[0], t2m_t[-1])
    ax_t2m.set_ylim(
        math.floor(t2m['data'].values.min() / 5) * 5 - 2,
        math.ceil(t2m['data'].values.max() / 5) * 5)
    #降水——————————————————————————————————————
    for ifhour in rn['forecast_period'].values:
        if (ifhour == rn['forecast_period'].values[0]):
            rn_t = (initTime + timedelta(hours=ifhour))
        else:
            rn_t = np.append(rn_t, (initTime + timedelta(hours=ifhour)))
    mask = (rn['data'] < 999)
    rn = rn['data'].where(mask)
    ax_rn.bar(rn_t,
              np.squeeze(rn.values),
              width=0.1,
              color='#00008B',
              label=str(
                  int(rn['forecast_period'].values[1] -
                      rn['forecast_period'].values[0])) + '小时降水',
              alpha=0.5)
    #curve_rn=ax_rn.plot(rn_t, np.squeeze(rn['data'].values), c='#40C4FF',linewidth=3)

    ax_rn.set_ylim(0, np.nanmax(np.append(10, np.squeeze(rn.values))))
    ###

    xaxis_intaval = mpl.dates.HourLocator(byhour=(8, 20))  #单位是小时
    ax_t2m.xaxis.set_major_locator(xaxis_intaval)
    # add legend
    ax_t2m.legend(fontsize=15, loc='upper right')
    ax_t2m.tick_params(length=10)
    ax_t2m.tick_params(axis='y', labelsize=100)
    ax_t2m.set_xticklabels([' '])
    miloc = mpl.dates.HourLocator(byhour=(8, 11, 14, 17, 20, 23, 2, 5))  #单位是小时
    ax_t2m.xaxis.set_minor_locator(miloc)
    yminorLocator = MultipleLocator(1)  #将此y轴次刻度标签设置为1的倍数
    ax_t2m.yaxis.set_minor_locator(yminorLocator)
    ymajorLocator = MultipleLocator(5)  #将此y轴次刻度标签设置为1的倍数
    ax_t2m.yaxis.set_major_locator(ymajorLocator)

    ax_t2m.grid(axis='x', which='minor', ls='--')
    ax_t2m.axis['left'].label.set_fontsize(15)
    ax_t2m.axis['left'].major_ticklabels.set_fontsize(15)
    ax_rn.axis['right'].label.set_fontsize(15)
    ax_rn.axis['right'].major_ticklabels.set_fontsize(15)
    #10米风——————————————————————————————————————
    ax_uv = plt.axes([0.1, 0.16, .8, .12])
    for ifhour in u10m['forecast_period'].values:
        if (ifhour == u10m['forecast_period'].values[0]):
            uv_t = (initTime + timedelta(hours=ifhour))
        else:
            uv_t = np.append(uv_t, (initTime + timedelta(hours=ifhour)))

    wsp = (u10m**2 + v10m**2)**0.5
    #curve_uv=ax_uv.plot(uv_t, np.squeeze(wsp['data'].values), c='#696969',linewidth=3,label='10m风')

    ax_uv.barbs(uv_t,
                np.zeros(len(uv_t)),
                np.squeeze(u10m['data'].values),
                np.squeeze(v10m['data'].values),
                fill_empty=True,
                color='gray',
                barb_increments={
                    'half': 2,
                    'full': 4,
                    'flag': 20
                },
                length=5.8,
                linewidth=1.5,
                zorder=100)
    ax_uv.set_ylim(-1, 1)
    ax_uv.set_xlim(uv_t[0], uv_t[-1])
    #ax_uv.axis('off')
    ax_uv.set_yticklabels([' '])
    #logo
    utl.add_logo_extra_in_axes(pos=[0.87, 0.00, .1, .1],
                               which='nmc',
                               size='Xlarge')

    #开启自适应
    xaxis_intaval = mpl.dates.HourLocator(byhour=(8, 20))  #单位是小时
    ax_uv.xaxis.set_major_locator(xaxis_intaval)
    ax_uv.tick_params(length=5, axis='x')
    ax_uv.tick_params(length=0, axis='y')
    miloc = mpl.dates.HourLocator(byhour=(8, 11, 14, 17, 20, 23, 2, 5))  #单位是小时
    ax_uv.xaxis.set_minor_locator(miloc)
    ax_uv.grid(axis='x', which='both', ls='--')
    ax_uv.set_ylabel('10m风', fontsize=15)

    xstklbls = mpl.dates.DateFormatter('%m月%d日%H时')
    for label in ax_uv.get_xticklabels():
        label.set_rotation(30)
        label.set_horizontalalignment('center')
    ax_uv.tick_params(axis='x', labelsize=15)

    #出图——————————————————————————————————————————————————————————

    if (output_dir != None):
        isExists = os.path.exists(output_dir)
        if not isExists:
            os.makedirs(output_dir)

        output_dir2 = output_dir + model + '_起报时间_' + initTime.strftime(
            "%Y年%m月%d日%H时") + '/'
        if (os.path.exists(output_dir2) == False):
            os.makedirs(output_dir2)

        plt.savefig(output_dir2 + model + '_' + extra_info['point_name'] +
                    '_' + extra_info['output_head_name'] +
                    initTime.strftime("%Y%m%d%H") + '00' +
                    extra_info['output_tail_name'] + '.jpg',
                    dpi=200,
                    bbox_inches='tight')
    else:
        plt.show()
Esempio n. 9
0
for i in range (0, len(zcs)):
    zcs[i] -= minZ

maxZ = maxZ - minZ + 2
#minZ = minEffZ


host = HostAxes(fig, [0.15, 0.1, 0.65, 0.8])
par1 = ParasiteAxes(host, sharey=host)   
par2 = ParasiteAxes(host, sharey=host)   
host.parasites.append(par1)
host.parasites.append(par2)

host.set_xlabel("PAD ($m^2.m^{-3}$)")
host.set_ylabel("Height (m)")
host.set_xlim(0, MAX_PAD)

par1.set_xlabel("Average number of returns per 10cm cube voxel")
#par1.set_xlabel("RDI")
par2.set_xlabel("Occusion (%)")

host.axis["top"].set_visible(False)
par1.axis["top"].set_visible(True)
par1.axis["top"].major_ticklabels.set_visible(True)
par1.axis["top"].label.set_visible(True)
#par2.axis["top"].label.set_visible(True)
par1.set_xlim(0,maxVal[2]/maxVal[1]*MAX_PAD)

offset = (0, 40)
new_axisline = par2._grid_helper.new_fixed_axis
par2.axis["top2"] = new_axisline(loc="top", axes=par2, offset=offset)
Esempio n. 10
0
#host.parasites.append(par2)
#host.set_ylabel("F1 score")
#host.set_xlabel("# Filter size")
host.axis["right"].set_visible(False)
#plt.xticks([])
host.axis["top"].major_ticks.set_color('white')
par1.axis["right"].set_visible(True)
#par1.set_ylabel("Runtime")
par1.axis["right"].major_ticklabels.set_visible(True)
par1.axis["right"].label.set_visible(True)
#par2.set_ylabel("Velocity")
#offset = (60, 0)
#new_axisline = par2.get_grid_helper().new_fixed_axis
#par2.axis["right2"] = new_axisline(loc="right", axes=par2, offset=offset)
fig.add_axes(host)
host.set_xlim(0, 80)
host.set_ylim(0.6, 0.8)
host.set_xlabel("Number of filter size")
host.set_ylabel("F1 score")
par1.set_ylabel("Runtime")
#p1, = host.plot([1, 5, 10, 15, 20, 25, 30, 35, 40,50,60,70,80,90,100], [0.66, 0.736, 0.764, 0.778, 0.786, 0.814, 0.786, 0.783, 0.787,0.791,0.789,0.785,0.790,0.792,0.786], 'o-',label="F1 score", linewidth=2.2, color="#59604C")
#p2, = par1.plot([1, 5, 10, 15, 20, 25, 30, 35, 40,50,60,70,80,90,100], [3.52, 3.68, 3.71, 3.72, 3.84, 3.85, 3.87, 3.96, 3.86,3.876,3.83,3.83,3.89,3.97,4.04], '*--', label="Runtime", linewidth=2.2, color="#A35638")
p1, = host.plot([1, 5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 70, 80], [
    0.691, 0.693, 0.710, 0.715, 0.721, 0.727, 0.703, 0.704, 0.705, 0.695,
    0.706, 0.687, 0.679
],
                'o-',
                label="F1 score",
                linewidth=2.2,
                color="#59604C")
p2, = par1.plot([1, 5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 70, 80], [
Esempio n. 11
0
fig.savefig(path_fig, dpi=300, transparent=True, bbox_inches='tight')

fig1 = plt.figure(1, figsize=(2.5, 1.2))

host = HostAxes(fig1, [0.15, 0.1, 0.65, 0.8])
par1 = ParasiteAxes(host, sharex=host)
host.parasites.append(par1)

host.axis["right"].set_visible(False)
par1.axis["right"].set_visible(True)

par1.axis["right"].major_ticklabels.set_visible(True)
par1.axis["right"].label.set_visible(True)
fig1.add_axes(host)

host.set_xlim(np.pi / 2, np.pi)
host.set_ylim(0.29, 0.61)
host.set_xticks([1.57, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.1415])
host.set_xticklabels(
    ['$\\pi/2$', '1.8', '2.0', '2.2', '2.4', '2.6', '2.8', '3.0', '$\\pi$'])

host.set_xlabel("$\\theta_c$")
host.set_ylabel("$\\theta_b^*$")
par1.set_ylabel("min$_{\\theta_b} \\varepsilon$ $(\\times 10^{-3})$")

p1, = host.plot(C[0, :],
                X[Z.argmin(axis=0), 0],
                label="$\\theta_b^*$",
                color='#1f77b4')
p2, = par1.plot(C[0, :],
                Z.min(axis=0) * 1000,
def plot_line_(name, x, y1, y2, y3):
    #fig = plt.figure(figsize=(7,5))  #figsize默认为4,4(图像尺寸),facecolor="blue"
    fig = plt.figure(1)  #figsize默认为4,4(图像尺寸),facecolor="blue"
    ax = HostAxes(
        fig, [0.15, 0.1, 0.7, 0.8
              ])  #用[left, bottom, weight, height]的方式定义axes,0 <= l,b,w,h <= 1
    ax_ndvi = ParasiteAxes(ax, sharex=ax)
    ax_t = ParasiteAxes(ax, sharex=ax)
    ax_p = ParasiteAxes(ax, sharex=ax)

    ax.parasites.append(ax_ndvi)
    ax.parasites.append(ax_p)
    ax.parasites.append(ax_t)

    ax.set_ylim(0.41, 0.75)
    ax.set_xlim(2004.5, 2015.5)
    ax.axis['right'].set_visible(False)
    ax.axis['top'].set_visible(False)
    #    plt.tick_params(top = 'off', right = 'off')
    #ax_ndvi.axis['left1'] = new_axisline(loc='left', axes=ax_ndvi, offset=offset1)
    #ax.axis['left'].set_axisline_style('->',size=2)  #轴的形状色
    ax.axis['left'].line.set_linewidth(3)  #轴宽
    ax.axis['bottom'].line.set_linewidth(3)  #轴宽

    offset1 = (20, 0)
    offset2 = (60, 0)
    ax_t.set_ylim(10, 30)
    ax_p.set_ylim(500, 2500)
    new_axisline = ax_t._grid_helper.new_fixed_axis  # "_grid_helper"与"get_grid_helper()"等价,可以代替  #new_axisline = par2.get_grid_helper().new_fixed_axis  # 用"get_grid_helper()"代替,结果一样,区别目前不清楚
    new_axisline = ax_p._grid_helper.new_fixed_axis
    ax_t.axis['right2'] = new_axisline(loc='right', axes=ax_t, offset=offset1)
    #ax_t.axis['right2'].set_axisline_style('-|>',size=-1)  #轴的形状色
    ax_t.axis['right2'].line.set_linewidth(3)  #轴宽
    ax_t.axis['right2'].set_label(
        'T')  # ax_t.axis['right2'].set_axislabel_direction('-')
    ax_p.axis['right3'] = new_axisline(loc='right', axes=ax_p, offset=offset2)
    #ax_p.axis['right3'].set_axisline_style('->',size=-1)  #轴的形状色
    ax_p.axis['right3'].line.set_linewidth(3)  #轴宽
    ax_p.axis['right3'].set_label('P')

    ax_t.yaxis.set_major_locator(MultipleLocator(2))
    ax_p.yaxis.set_major_locator(MultipleLocator(500))
    ax.xaxis.set_major_locator(
        xmajorLocator
    )  #设置主刻度标签的位置,没有标签文本格式ax.xaxis.set_major_formatter(FormatStrFormatter('%5.1f'))
    ax.yaxis.set_major_locator(ymajorLocator)
    ax.xaxis.set_minor_locator(xminorLocator)  #设置次刻度标签的位置,没有标签文本格式
    ax.xaxis.set_minor_locator(xminorLocator)

    #打开网格
    ax_ndvi.grid(which='minor', color='black',
                 linestyle='--')  #,lw=0.8, alpha=0.5)  # grid setting)  #绘制网格线
    ax_t.grid(which='minor', color='black',
              linestyle='--')  #,lw=0.8, alpha=0.5)  # grid setting)  #绘制网格线
    ax.tick_params(axis='both',
                   which='major',
                   direction='in',
                   width=2,
                   length=lwidth,
                   pad=tick_pad,
                   labelsize=tick_labelsz,
                   grid_linewidth=3)

    ax.set_ylabel('NDVI', font_properties=getChineseFont(80))
    #ax.set_ylabel('NDVI',fontproperties=getChineseFont(100))

    ax_t.tick_params(axis='both',
                     which='both',
                     direction='in',
                     width=3,
                     length=100,
                     pad=18,
                     labelsize=100,
                     grid_linewidth=1)
    ax_p.tick_params(axis='both',
                     which='both',
                     direction='in',
                     width=3,
                     length=100,
                     pad=18,
                     labelsize=100,
                     grid_linewidth=1)

    fig.add_axes(ax)

    ax.set_xlabel('Year')
    p1, = ax.plot(x,
                  y1,
                  label="NDVI",
                  ls=linestyle,
                  lw=lwidth,
                  color=c1,
                  marker=".",
                  ms=16,
                  mfc=c1)
    p2, = ax_t.plot(x,
                    y3,
                    label="Temperature",
                    ls=linestyle,
                    lw=lwidth,
                    color=c2,
                    marker="o",
                    ms=marksize,
                    mfc=c2)
    p3, = ax_p.plot(x,
                    y2,
                    label="Precipitation",
                    ls=linestyle,
                    lw=lwidth,
                    color=c3,
                    marker="o",
                    ms=marksize,
                    mfc=c3)
    #ax.set_xlabel('YEAR')
    #ax.set_ylabel('NDVI')
    plt.legend(loc=1,
               bbox_to_anchor=(0.9, 1.2),
               prop=getChineseFont(12),
               ncol=1,
               frameon=False,
               mode='expend')

    #plt.savefig(r'C:\Users\YeHui\Desktop\GGGGGGGGGGG.jpg')#, dpi=1000)
    plt.show()
Esempio n. 13
0
    #ax_wear.set_ylabel('Wear')

    load_axisline = ax_load.get_grid_helper().new_fixed_axis
    #cp_axisline = ax_cp.get_grid_helper().new_fixed_axis
    #wear_axisline = ax_wear.get_grid_helper().new_fixed_axis

    ax_load.axis['right2'] = load_axisline(loc='right',
                                           axes=ax_load,
                                           offset=(70, 0))
    #ax_cp.axis['right3'] = cp_axisline(loc='right', axes=ax_cp, offset=(80,0))
    #ax_wear.axis['right4'] = wear_axisline(loc='right', axes=ax_wear, offset=(120,0))

    fig.add_axes(ax_cof)

    #set limit of x, y
    ax_cof.set_xlim(-3, 21)
    ax_cof.set_ylim(0, 200)

    curve_cof = ax_cof.plot(data[0],
                            data[1],
                            's-',
                            label="Compress Strength",
                            color='black')
    # markerfacecolor='none 標記變成中空
    curve_temp = ax_temp.plot(data[0],
                              data[2],
                              'o-.',
                              label='Porosity',
                              color='red')
    curve_load = ax_load.plot(data[0],
                              data[3],