[Matplotlib-users] Matplotlib Figure margin transparancy

Scott Lasley selasley at icloud.com
Sat Aug 13 23:06:35 EDT 2016


It appears that jupyter does not use the .ipython_config.py file in the .jupyter directory.  It does use the files in the profile_default directory in your ipython folder, usually ~/.ipython on a Mac.  Here's how I was able to get jupyter qtconsole to launch with %pylab inline

Create the default ipython profile files.  I think this will overwrite any old default profile files so make a backup if you want to keep the old files
$ ipython3 profile create
Find the location of your default profile 
$ export myipython=$(ipython3 locate profile)
Edit the ipython_config.py file in your default profile directory
$ pico "$myipython"/ipython_config.py
Uncomment the c.InteractiveShellApp.pylab line and change the value to 'inline'

If want to load certain modules every time you launch qtconsole you can create a file named something like 00_my_startup.ipy in "$myipython"/startup/ containing your imports.  See the "$myipython"/startup/README file for more info
 
Here's the docs on configuring recent versions of ipython
http://ipython.readthedocs.io/en/stable/config/intro.html#the-ipython-directory

Best regards,
Scott

> On Aug 13, 2016, at 20:34, Sudheer Joseph <sudheer.joseph at yahoo.com> wrote:
> 
> Thank you for the reply,
> Yes this way it works, But I was looking towards a way to set this option in startup file so that one need not type %pylab inline always after starting the kernal
> 
> 
> with best regards,
> Suhdheer
> On Sunday, 14 August 2016 4:48 AM, Scott Lasley <selasley at icloud.com> wrote:
> 
> 
> If I launch jupyter with the --pylab flag it exits with this message
> $ jupyter qtconsole --pylab
> ...
> [JupyterQtConsoleApp] CRITICAL | Bad config encountered during initialization:
> [JupyterQtConsoleApp] CRITICAL | Unrecognized flag: '--pylab'
> 
> Can you launch qtconsole then use the jupyter magics to set up pylab and inline plotting?
> 
> $ jupyter qtconsole
> (then in the QtConsole window enter)
> In [1]: %pylab
> Using matplotlib backend: MacOSX
> Populating the interactive namespace from numpy and matplotlib
> 
> In [2]: %matplotlib inline
> 
> In [3]: plot([1, 2, 3])
> 
> plots in the QtConsole window.
> 
> This is in OS X 10.11 with python 3.5.2, matplotlib 2.0.0b3, ipython 5.1.0 and jupyter 4.1.1.  Note that I had some problems with the qtconsole when using the %pylab magic.  It's possible the problems arose because I'm using the beta version of matplotlib 2.
> 
> hth,
> Scott
> 
> > On Aug 13, 2016, at 13:54, Sudheer Joseph via Matplotlib-users <matplotlib-users at python.org> wrote:
> > 
> > Hi all,
> >                After following suggestion to upgrade to jupyter, I have installed jupyter. but not able to start either jupyter or ipython with --pylab inline mode .
> > If I start 
> > sjo at SJOLTP../.jupyter~$ ipython qtconsole --pylab inline
> > [TerminalIPythonApp] WARNING | Subcommand `ipython qtconsole` is deprecated and will be removed in future versions.
> > 
> > I wont sart qtconsole.
> > If I start jupyter after going to .jupyter directory it starts with pylab inline taking it form profile file ipython_config.py
> > If I go to any other directory it wont take the configuration file.
> > I have below line in the above ipython_config.py
> > c.TerminalIPythonApp.profile = u'/home/sjo/.jupyter/ipython_config.py'
> > 
> > However none works for me to make pylab inline option.
> > Can any one throw some light in to this issue?
> > 
> > sjo at SJOLTP../.jupyter~$ ls
> > ipython_config.py  jupyter.desktop    jupyter_qtconsole_config.py  pynb  startup
> > ipython.desktop    jupyter_nb.desktop  migrated                    qtpy
> > sjo at SJOLTP../.jupyter~$ pwd
> > /home/sjo/.jupyter
> > sjo at SJOLTP../.jupyter~$ ls
> > ipython_config.py  jupyter.desktop    jupyter_qtconsole_config.py  pynb  startup
> > ipython.desktop    jupyter_nb.desktop  migrated                    qtpy
> > sjo at SJOLTP../.jupyter~$ jupyter --version
> > 4.1.1
> > sjo at SJOLTP../.jupyter~$ ipython --version
> > 5.0.0
> > sjo at SJOLTP../.jupyter~$ 
> > 
> >  
> > *************************************************************** Sudheer Joseph Indian National Centre for Ocean Information Services Ministry of Earth Sciences, Govt. of India POST BOX NO: 21, IDA Jeedeemetla P.O. Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55 Tel:+91-40-23886047(O),Fax:+91-40-23895011(O), Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) E-mail:sjo.India at gmail.com;sudheer.joseph at yahoo.com Web- http://oppamthadathil.tripod.com ***************************************************************
> > 
> > 
> > On Friday, 12 August 2016 12:02 PM, Sudheer Joseph <sudheer.joseph at yahoo.com> wrote:
> > 
> > 
> > Thank you I got it fixed after following the link of bug report.
> > I have added 
> > rcParams['figure.facecolor'] = 'w'
> > in 00_startup.py file in my ipython startup directory which fixed the issue
> >  
> > *************************************************************** Sudheer Joseph Indian National Centre for Ocean Information Services Ministry of Earth Sciences, Govt. of India POST BOX NO: 21, IDA Jeedeemetla P.O. Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55 Tel:+91-40-23886047(O),Fax:+91-40-23895011(O), Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) E-mail:sjo.India at gmail.com;sudheer.joseph at yahoo.com Web- http://oppamthadathil.tripod.com ***************************************************************
> > 
> > 
> > 
> > 
> > On Thursday, 11 August 2016 10:26 PM, Sudheer Joseph via Matplotlib-users <matplotlib-users at python.org> wrote:
> > 
> > 
> > 
> > Thank you,
> > I am having oldverdion 1.2 but if i upgrade many system related things are getting affected. So bit worried how to handle this..
> > 
> > Sudheer 
> > Sent from Yahoo Mail for iPhone
> > 
> > On Thursday, August 11, 2016, 10:17 PM, Jens Nielsen <jenshnielsen at gmail.com> wrote:
> > The relevant parameters are 
> > 
> > figure.facecolor
> > and
> > savefigure.facecolor
> > 
> > but as I indicated before I think your issue is due to an out of date version of Jupyter/IPython and is fixed in the latest version. Please can you check which versions you are running
> > I think the issue that you are seeing is https://github.com/ipython/ipython/issues/7964 which was fixed in IPython 3.2
> > 
> > 
> > best
> > Jens
> > 
> > 
> > On Thu, 11 Aug 2016 at 17:33 Sudheer Joseph <sudheer.joseph at yahoo.com> wrote:
> > Thank you Benjamin & Jens,
> >                                                  I have registered in python.org now. Regarding the issue I had already checked the matplotlibrc parameters. I tried increasing margin option but resulting in only plot getting shrunk. There is no apparent effect for facecolor parameter. May I know which parameter sets the margin as non-transparent?
> > With best regards,
> > Sudheer
> > 
> > 
> > 
> > 
> > On Wednesday, 10 August 2016 8:19 PM, Benjamin Root <ben.v.root at gmail.com> wrote:
> > The other reason why this message never got posted is because this message was sent to the now defunct mailing list hosted by sourceforge. The mailing list moved about a year ago (I think) to python.org. You will have to subscribe in order to post unmoderated.
> > 
> > https://mail.python.org/mailman/listinfo/matplotlib-users
> > 
> > Ben Root
> > On Wed, Aug 10, 2016 at 4:25 AM, Jens Nielsen <jenshnielsen at gmail.com> wrote:
> > At least for me gmail put your mail in the spam folder.
> > 
> > Anyway the inline backend is actually from in IPython/Jupyter and not in matplotlib. I think they have changed the default a couple of times and had the transparent as a default earlier but changed it. Looking at the current master it looks like they are respecting the matplotlib default colors from the matplotlib rc params. Can you please check which version on IPython and Jupyter you are running.  
> > 
> > You can change the matplotlib rc parameters as described in the docs http://matplotlib.org/ users/customizing.html# customizing-matplotlib but the default ones should be white.
> > 
> > best
> > Jens
> > 
> > On Wed, 10 Aug 2016 at 05:06 Sudheer Joseph <sudheer.joseph at yahoo.com> wrote:
> > Hi,
> > I have send below query to matplotlib user group recently but did not get posted so far. Can you please tell me is there is any thin wrong with the message?
> > With best regards,
> > Sudheer
> > 
> > >
> > > Dear Expert,
> > >                Recently after up-gradation of matplotlib and ubuntu 16.04 I am
> > > getting transparent figure axis when using the "linux color scheme"
> > > option in ipython qtconsole. May I know if there is a way to fix this issue?. I
> > > wanted to keep black screen as it reduces eye strain.
> > >
> > > ipython qtconsole --matplotlib inline
> > >
> > > If I save the image i am able to get axis properly but to see on screen as the
> > > axis is not plotted with white background the black axis line and labels are not
> > > visible. Earlier I used to get figures as attached in second figure.
> > > Earlier Satus which I am looking for below link
> > > https://drive.google.com/open? id= 0B3heUQNme7G5ZmVlUHpRakZxUlk
> > > Present status without boarder below link
> > >
> > >
> > > https://drive.google.com/open? id= 0B3heUQNme7G5VkhZWHhiUnpfWDg
> > >
> > > Kindly suggest a solution
> > > with best regards,
> > > Sudheer
> > >
> > 
> > ------------------------------ ------------------------------ ------------------
> > What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
> > patterns at an interface-level. Reveals which users, apps, and protocols are
> > consuming the most bandwidth. Provides multi-vendor support for NetFlow,
> > J-Flow, sFlow and other flows. Make informed decisions using capacity
> > planning reports. http://sdm.link/zohodev2dev
> > ______________________________ _________________
> > Matplotlib-users mailing list
> > 
> > Matplotlib-users at lists. sourceforge.net
> > https://lists.sourceforge.net/ lists/listinfo/matplotlib- users
> > 
> > 
> > ------------------------------ ------------------------------ ------------------
> > What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
> > patterns at an interface-level. Reveals which users, apps, and protocols are
> > consuming the most bandwidth. Provides multi-vendor support for NetFlow,
> > J-Flow, sFlow and other flows. Make informed decisions using capacity
> > planning reports. http://sdm.link/zohodev2dev
> > ______________________________ _________________
> > Matplotlib-users mailing list
> > Matplotlib-users at lists. sourceforge.net
> > https://lists.sourceforge.net/ lists/listinfo/matplotlib- users
> > 
> > 
> > _______________________________________________
> > Matplotlib-users mailing list
> > Matplotlib-users at python.org
> > https://mail.python.org/mailman/listinfo/matplotlib-users
> > 
> > 
> > 
> > 
> > _______________________________________________
> > Matplotlib-users mailing list
> > Matplotlib-users at python.org
> > https://mail.python.org/mailman/listinfo/matplotlib-users
> 
> 



More information about the Matplotlib-users mailing list