0

Hi everyone. I am running jupyter notebook through Chrome and Windows 10. the versions are : Windows 10 Chrome Version 84.0.4147.105 (Official Build) (64-bit) I am using the magic %matplotlib notebook. To be able to zoom in and out in the plot. The code works in other machines with same windows and version. However, when I run it in my personal laptop, the plot is not possible to see it:

Plot not possible to see

I was trying to follow the following info found: help

I have run out of ideas, I restarted the laptop, reinstalled jupyter, and nothing seems to work. Did anyone have a similar issue? Here is the code:

    %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()

Thank you very much for your help.

Abumaru
  • 33
  • 6

1 Answers1

1

You should try to change from %matplotlib notebook to %matplotlib inline. If that doesn't work then try to restart the kernel.

It seems that in some cases it helps to repeat the setting of the notebook backend, i.e. try calling it twice like

%matplotlib notebook
%matplotlib notebook

An analysis for why that is can be found in this comment

AzyCrw4282
  • 7,222
  • 5
  • 19
  • 35
  • 1
    Thank you for your ideas. I tried both, and the issue is still there. However, I decided to use Edge and Firefox just to see if the problem repeats. I got same plot issue with Edge, but on Firefox the code just worked out. it seems I will be forced to change of browser, while using jupyter. – Abumaru Jul 30 '20 at 21:31