def nbinstall(overwrite=False, user=True):
 if (check_nbextension('matplotlib') or check_nbextension('matplotlib', True)):
  return
 tempdir = mkdtemp()
 path = os.path.join(os.path.dirname(__file__), 'web_backend')
 shutil.copy2(os.path.join(path, 'nbagg_mpl.js'), tempdir)
 with open(os.path.join(path, 'mpl.js')) as fid:
  contents = fid.read()
 with open(os.path.join(tempdir, 'mpl.js'), 'w') as fid:
  fid.write('define(["jquery"], function($) {\n')
  fid.write(contents)
  fid.write('\nreturn mpl;\n});')
 install_nbextension(tempdir, overwrite=overwrite, symlink=False, destination='matplotlib', verbose=0, **({'user': user} if (version_info >= (3, 0, 0, '')) else {}))

def nbinstall ( overwrite = False , user = True ) : if ( check_nbextension ( 'matplotlib' ) or check_nbextension ( 'matplotlib' , True ) ) : return tempdir = mkdtemp ( ) path = os . path . join ( os . path . dirname ( __file__ ) , 'web_backend' ) shutil . copy2 ( os . path . join ( path , 'nbagg_mpl.js' ) , tempdir ) with open ( os . path . join ( path , 'mpl.js' ) ) as fid : contents = fid . read ( ) with open ( os . path . join ( tempdir , 'mpl.js' ) , 'w' ) as fid : fid . write ( 'define(["jquery"], function($) {\n' ) fid . write ( contents ) fid . write ( '\nreturn mpl;\n});' ) install_nbextension ( tempdir , overwrite = overwrite , symlink = False , destination = 'matplotlib' , verbose = 0 , ** ( { 'user' : user } if ( version_info >= ( 3 , 0 , 0 , '' ) ) else { } ) )
copies javascript dependencies to the /nbextensions folder in your ipython directory .