matplotlibrc has no effect on the plot? (windows7)

I want to change the look of the default plots in Python, so I created the
file matplotlibrc in the current working directory (Windows 7). The file
gets loaded:

/import matplotlib as mp
print('Config. file loaded from:', mp.matplotlib_fname())/

prints:

/Config. file loaded from:
C:\Users\mato\Documents\Python_Scripts\matplotlibrc/

however, the plot is unaffected.

The simple code:

/import matplotlib.pyplot as plt
x = [1,2,3,4,5]
plt.plot(x)/

with the matplotlibrc file that looks like this:

/lines.linestyle : --
axes.grid : True/

yields the plot with the solid line and no grid in the plot. What am I
missing?

Note:
If I insert

/plt.rcParams['axes.grid']=True
plt.rcParams['lines.linestyle']='--' /

in the code, it works as expected

···

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/matplotlibrc-has-no-effect-on-the-plot-windows7-tp45573.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Are you using IPython QtConsole / Notebook? I think they have their
own settings on their backend.

Shawn

···

On Tue, May 19, 2015 at 11:01 AM, mato <mato_pavlovic@...9...> wrote:

I want to change the look of the default plots in Python, so I created the
file matplotlibrc in the current working directory (Windows 7). The file
gets loaded:

/import matplotlib as mp
print('Config. file loaded from:', mp.matplotlib_fname())/

prints:

/Config. file loaded from:
C:\Users\mato\Documents\Python_Scripts\matplotlibrc/

however, the plot is unaffected.

The simple code:

/import matplotlib.pyplot as plt
x = [1,2,3,4,5]
plt.plot(x)/

with the matplotlibrc file that looks like this:

/lines.linestyle : --
axes.grid : True/

yields the plot with the solid line and no grid in the plot. What am I
missing?

Note:
If I insert

/plt.rcParams['axes.grid']=True
plt.rcParams['lines.linestyle']='--' /

in the code, it works as expected

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/matplotlibrc-has-no-effect-on-the-plot-windows7-tp45573.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Yuxiang "Shawn" Wang
Gerling Research Lab
University of Virginia
yw5aj@...809...
+1 (434) 284-0836
https://sites.google.com/a/virginia.edu/yw5aj/

This might be the case (I'm running Anaconda/Spyder/Ipython) however so far I
haven't been able to locate the appropriate settings file...

Yuxiang Wang wrote

···

Are you using IPython QtConsole / Notebook? I think they have their
own settings on their backend.

Shawn

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/matplotlibrc-has-no-effect-on-the-plot-windows7-tp45573p45575.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Here is what I did:

Put a 00_matplotlib_rc.py in ipython's profile_default/startup folder
(you might need to run ipython profile create, or ipython profile
locate to create/find them), and in the file specify my matplotlib rc
parameters. For example:

import matplotlib as mpl

# Figure formatting
mpl.rcParams['savefig.dpi'] = 300
mpl.rcParams['figure.figsize'] = (3.27, 3.27)

# Font setting
mpl.rcParams['mathtext.default'] = 'regular'
mpl.rcParams['font.family'] = ['sans-serif']
mpl.rcParams['font.sans-serif'] = ['Arial']
mpl.rcParams['font.size'] = 8
mpl.rcParams['pdf.fonttype'] = 42
mpl.rcParams['ps.fonttype'] = 42

# Line properties
mpl.rcParams['lines.linewidth'] = 1.
mpl.rcParams['lines.markersize'] = 4

# Legends
mpl.rcParams['legend.frameon'] = False
mpl.rcParams['legend.fontsize'] = 8
mpl.rcParams['legend.handlelength'] = 3

# Subplot frame line
mpl.rcParams['axes.linewidth'] = .5

I would be happy to know if there's a better/different way to do it.

Shawn

···

On Tue, May 19, 2015 at 5:49 PM, mato <mato_pavlovic@...9...> wrote:

This might be the case (I'm running Anaconda/Spyder/Ipython) however so far I
haven't been able to locate the appropriate settings file...

Yuxiang Wang wrote

Are you using IPython QtConsole / Notebook? I think they have their
own settings on their backend.

Shawn

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/matplotlibrc-has-no-effect-on-the-plot-windows7-tp45573p45575.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Yuxiang "Shawn" Wang
Gerling Research Lab
University of Virginia
yw5aj@...809...
+1 (434) 284-0836
https://sites.google.com/a/virginia.edu/yw5aj/

...or I can put the file(s) that dynamically change the rc settings in the
current directory and just execute them (import) whenever I want to use
different settings for the plots.
This is less elegant than the configuration file, but at least solves my
problem for now.
Thank you Yuxian.

Cheers
Mato

Yuxiang Wang wrote

···

Here is what I did:

Put a 00_matplotlib_rc.py in ipython's profile_default/startup folder
(you might need to run ipython profile create, or ipython profile
locate to create/find them), and in the file specify my matplotlib rc
parameters. For example:

import matplotlib as mpl

# Figure formatting
mpl.rcParams['savefig.dpi'] = 300
mpl.rcParams['figure.figsize'] = (3.27, 3.27)

...

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/matplotlibrc-has-no-effect-on-the-plot-windows7-tp45573p45577.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Shawn,

This might better be sent to the IPython mailing lists.

Tom

···

On Tue, May 19, 2015 at 5:56 PM Yuxiang Wang <yw5aj@…809…> wrote:

Here is what I did:

Put a 00_matplotlib_rc.py in ipython’s profile_default/startup folder

(you might need to run ipython profile create, or ipython profile

locate to create/find them), and in the file specify my matplotlib rc

parameters. For example:

import matplotlib as mpl

Figure formatting

mpl.rcParams[‘savefig.dpi’] = 300

mpl.rcParams[‘figure.figsize’] = (3.27, 3.27)

Font setting

mpl.rcParams[‘mathtext.default’] = ‘regular’

mpl.rcParams[‘font.family’] = [‘sans-serif’]

mpl.rcParams[‘font.sans-serif’] = [‘Arial’]

mpl.rcParams[‘font.size’] = 8

mpl.rcParams[‘pdf.fonttype’] = 42

mpl.rcParams[‘ps.fonttype’] = 42

Line properties

mpl.rcParams[‘lines.linewidth’] = 1.

mpl.rcParams[‘lines.markersize’] = 4

Legends

mpl.rcParams[‘legend.frameon’] = False

mpl.rcParams[‘legend.fontsize’] = 8

mpl.rcParams[‘legend.handlelength’] = 3

Subplot frame line

mpl.rcParams[‘axes.linewidth’] = .5

I would be happy to know if there’s a better/different way to do it.

Shawn

On Tue, May 19, 2015 at 5:49 PM, mato <mato_pavlovic@…9…> wrote:

This might be the case (I’m running Anaconda/Spyder/Ipython) however so far I

haven’t been able to locate the appropriate settings file…

Yuxiang Wang wrote

Are you using IPython QtConsole / Notebook? I think they have their

own settings on their backend.

Shawn

View this message in context: http://matplotlib.1069221.n5.nabble.com/matplotlibrc-has-no-effect-on-the-plot-windows7-tp45573p45575.html

Sent from the matplotlib - users mailing list archive at Nabble.com.


One dashboard for servers and applications across Physical-Virtual-Cloud

Widest out-of-the-box monitoring support with 50+ applications

Performance metrics, stats and reports that give you Actionable Insights

Deep dive visibility with transaction tracing using APM Insight.

http://ad.doubleclick.net/ddm/clk/290420510;117567292;y


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Yuxiang “Shawn” Wang

Gerling Research Lab

University of Virginia

yw5aj@…809…

+1 (434) 284-0836

https://sites.google.com/a/virginia.edu/yw5aj/


One dashboard for servers and applications across Physical-Virtual-Cloud

Widest out-of-the-box monitoring support with 50+ applications

Performance metrics, stats and reports that give you Actionable Insights

Deep dive visibility with transaction tracing using APM Insight.

http://ad.doubleclick.net/ddm/clk/290420510;117567292;y


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users