[matplotlib-devel] Font rc-setting not updating

2012-02-13 Thread Tony Yu
The title is a bit misleading: The problem is that the last font-related
rc-setting seems to override all previous settings. To clarify, if I save a
figure with certain font settings and *after that* change the rc-setting,
the older figure appears to have the newer setting. Note that this only
appears to happen with fonts---the linewidth setting, for example, shows up
as expected. (See script belows)


-Tony


import matplotlib.pyplot as plt

def test_simple_plot():
fig, ax = plt.subplots()

ax.plot([0, 1])
ax.set_xlabel('x-label')
ax.set_ylabel('y-label')
ax.set_title('title')

return fig

plt.rcParams['lines.linewidth'] = 10
plt.rcParams['font.family'] = 'serif'
plt.rcParams['font.size'] = 20
fig1 = test_simple_plot()

plt.rcParams['lines.linewidth'] = 1
plt.rcParams['font.family'] = 'sans-serif'
plt.rcParams['font.size'] = 10
fig2 = test_simple_plot()

plt.show()
--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Font rc-setting not updating

2012-02-13 Thread Benjamin Root
On Monday, February 13, 2012, Tony Yu  wrote:
> The title is a bit misleading: The problem is that the last font-related
rc-setting seems to override all previous settings. To clarify, if I save a
figure with certain font settings and *after that* change the rc-setting,
the older figure appears to have the newer setting. Note that this only
appears to happen with fonts---the linewidth setting, for example, shows up
as expected. (See script belows)
>
> -Tony
>
> import matplotlib.pyplot as plt
> def test_simple_plot():
> fig, ax = plt.subplots()
> ax.plot([0, 1])
> ax.set_xlabel('x-label')
> ax.set_ylabel('y-label')
> ax.set_title('title')
> return fig
> plt.rcParams['lines.linewidth'] = 10
> plt.rcParams['font.family'] = 'serif'
> plt.rcParams['font.size'] = 20
> fig1 = test_simple_plot()
> plt.rcParams['lines.linewidth'] = 1
> plt.rcParams['font.family'] = 'sans-serif'
> plt.rcParams['font.size'] = 10
> fig2 = test_simple_plot()
> plt.show()

Looks like we have an inconsistency here with how we process our None's.
For most artists, properties defined as None in the constructor are then
given defaults from the rcparams.  I would guess that text objects are
doing if on draw(), instead. At first glacé, I would guess that would be a
bug, but I would welcome other comments on this.

Ben Root
--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel