Discussion:
[Matplotlib-users] matplotlibrc has no effect on the plot? (windows7)
mato
2015-05-19 15:01:28 UTC
Permalink
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.
Yuxiang Wang
2015-05-19 17:04:19 UTC
Permalink
Are you using IPython QtConsole / Notebook? I think they have their
own settings on their backend.

Shawn
Post by mato
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
/import matplotlib as mp
print('Config. file loaded from:', mp.matplotlib_fname())/
C:\Users\mato\Documents\Python_Scripts\matplotlibrc/
however, the plot is unaffected.
/import matplotlib.pyplot as plt
x = [1,2,3,4,5]
plt.plot(x)/
/lines.linestyle : --
axes.grid : True/
yields the plot with the solid line and no grid in the plot. What am I
missing?
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
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
--
Yuxiang "Shawn" Wang
Gerling Research Lab
University of Virginia
***@virginia.edu
+1 (434) 284-0836
https://sites.google.com/a/virginia.edu/yw5aj/
mato
2015-05-19 21:49:52 UTC
Permalink
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...
Post by Yuxiang Wang
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.
Yuxiang Wang
2015-05-19 21:55:23 UTC
Permalink
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
Post by mato
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...
Post by Yuxiang Wang
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
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
--
Yuxiang "Shawn" Wang
Gerling Research Lab
University of Virginia
***@virginia.edu
+1 (434) 284-0836
https://sites.google.com/a/virginia.edu/yw5aj/
mato
2015-05-19 22:16:17 UTC
Permalink
...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
Post by Yuxiang Wang
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
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.
Thomas Caswell
2015-05-24 18:20:30 UTC
Permalink
Shawn,

This might better be sent to the IPython mailing lists.

Tom
Post by Yuxiang Wang
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
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
Post by mato
This might be the case (I'm running Anaconda/Spyder/Ipython) however so
far I
Post by mato
haven't been able to locate the appropriate settings file...
Post by Yuxiang Wang
Are you using IPython QtConsole / Notebook? I think they have their
own settings on their backend.
Shawn
--
http://matplotlib.1069221.n5.nabble.com/matplotlibrc-has-no-effect-on-the-plot-windows7-tp45573p45575.html
Post by mato
Sent from the matplotlib - users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Post by mato
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
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
--
Yuxiang "Shawn" Wang
Gerling Research Lab
University of Virginia
+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
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Loading...