zoukankan      html  css  js  c++  java
  • 冲淤厚度作图

    import pandas as  pd
    import numpy as np
    import glob
    import datetime
    from matplotlib import pyplot as plt
    import copy
    import re
    import time
    from pylab import *
    import matplotlib.dates as mdate
    import matplotlib.patches as patches
    import matplotlib.ticker as ticker
    df = pd.read_csv(r'.冲淤量.csv')
    print(df)
    pop ={'weight': 'normal', 'size': 15}
    fig = plt.figure(figsize=(16,8))
    plt.rcParams['font.sans-serif'] = 'simsun'

    ax1 = fig.add_subplot(111)

    ax2 = ax1.twinx()
    ax1.bar(df.year,df.volume_1,color = 'gray')
    tick_spacing = 50
    # tick_spacing = 5
    # ax1.set_ylim(-120,200)
    ax2.plot(df.year,df.av_vl,color = 'black')
    # ax2.set_ylim(-1.3,2.3)
    ax2.scatter(df.year,df.av_vl,color = 'black')
    ax1.set_ylabel('年冲淤量',fontdict=pop)
    ax2.set_ylabel('年冲淤厚度 (m)',fontdict=pop)
    ax1.set_xlabel('年份',fontdict=pop)
    ax1.tick_params(labelsize=30,axis='y')
    ax1.tick_params(labelsize=18,axis='x',rotation=45)
    ax2.tick_params(labelsize=20,axis='y')
    labels = ax1.get_xticklabels() + ax1.get_yticklabels()
    [label.set_fontname('Times New Roman') for label in labels]
    ax1.yaxis.set_major_locator(ticker.MultipleLocator(tick_spacing))
    plt.gcf().autofmt_xdate()
    plt.savefig(r'.3_1.jpg',dpi = 800)
    plt.show()
  • 相关阅读:
    python排序
    JavaMail转发邮件
    Java发送邮件Demo
    字符编码
    常用的python内建函数
    mysql-python安装
    ubuntu安装flash
    grep简介
    【java中的static关键字】
    【java中的final关键字】
  • 原文地址:https://www.cnblogs.com/chenyun-delft3d/p/13787251.html
Copyright © 2011-2022 走看看