Posts Python包推荐
Post
Cancel

Python包推荐

Foreword

这里记录一些使用的模块。

图形类

SciencePlots

一个Matplotlib的补充包,增添scatter、notebook等其他软件常用的绘图工具,还支持一键调用符合IEEE等不同期刊要求的图表格式。

import numpy as np
import matplotlib.pyplot as plt


def model(x, p):
    return x**(2 * p + 1) / (1 + x**(2 * p))


x = np.linspace(0.75, 1.25, 201)

with plt.style.context(['science']):
    fig, ax = plt.subplots()
    for p in [10, 15, 20, 30, 50, 100]:
        ax.plot(x, model(x, p), label=p)
    ax.legend(title='Order')
    ax.set(xlabel='Voltage (mV)')
    ax.set(ylabel='Current ($\mu$A)')
    ax.autoscale(tight=True)
    fig.savefig('figure.pdf', dpi=300)
OLDER POSTS NEWER POSTS

Comments powered by Disqus.

Contents

Search Results