matplotlib scienceplots包无法运行

p1tboqfb  于 2021-08-25  发布在  Java
关注(0)|答案(0)|浏览(3272)

我通过安装scienceplots packsge pip install SciencePlots ,我有以下代码:

import numpy as np
import matplotlib.pyplot as plt
plt.style.use('science') 

def model(x, p): 
   return x**(2 * p + 1) / (1 + x**(2 * p))
x = np.linspace(0.75, 1.25, 201)

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('fig1.jpg', dpi=300)

但它会导致一个错误,错误是:

OSError: 'science' not found in the style library and input is not a valid URL or path; see `style.available` for list of available styles

python版本:3.8.8
scienceplots版本:1.0.1
matplotlib版本:3.3.4
numpy版本:1.19.2
我使用anaconda和jupyter笔记本进行python编码
有人能帮忙修理吗?谢谢!

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题