You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用%matplotlib notebook在Win10 Chrome的Jupyter Notebook中无法显示图表

求助:Windows 10 Chrome环境下Jupyter Notebook使用%matplotlib notebook无法显示交互图表

大家好,我在Windows 10系统的*Chrome浏览器(版本84.0.4147.105 官方版64位)*中运行Jupyter Notebook,为了实现图表的缩放交互功能,我使用了魔法命令%matplotlib notebook。

奇怪的是,相同系统环境的其他设备上这段代码可以正常运行,但我的个人笔记本却完全无法显示图表。我已经尝试过以下方法,但问题依然没有解决:

  • 重启电脑
  • 重装Jupyter

请问有没有人遇到过类似的问题?以下是我使用的相关代码:

%matplotlib notebook
import matplotlib.pyplot as plt
from ipywidgets import interact, interactive, fixed, interact_manual
import ipywidgets as widgets
import numpy as np
import pandas as pd

def g(qi,d):
    fig = plt.figure()
    x_1 = df['dprod_year']
    y_1 = qi*np.exp(-x_1*d)
    plt.scatter(x_1,y_1,marker='+')
    plt.scatter(df['dprod_year'],df['qoil_1000b'],marker='o',color='grey')
    plt.ylim(0,4000)
    plt.xlim(0,60)
    plt.grid(True,axis='both')

# 注释掉的旧交互代码
# interact(g,qi=(0.0000,5000,10),d=(0.0000,0.02000,0.0010))

interact(g,qi=widgets.FloatSlider(value=3900,min=0,max=4000,step=10,description='qi:',readout_format='.1f'), 
         d=widgets.FloatSlider(value=0.0061,min=0.0001,max=0.01,step=0.001,description='d:',readout_format='.5f'))
plt.show()

非常感谢您的帮助!

内容的提问来源于stack exchange,提问作者Abumaru

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.08 16:22:38