Is there a way to change locally the rcParams, for a specific figure after
it has been created?
I know about the rcParams setting (for global settings) and the with
statement construction, but this requires to be done before the figure was
created, and I need to change the settings on an already existing figure (in
particular color cycler).
There is the context manager approach, but it must be utilized prior to
axes creation. For the most part, any usage of the rcParams happen at
creation time of the relevant artist. So, while you could update the color
cycle prior to creating an axes but after the figure creation, changing the
default figure size would be useless at that point since the figure is
already made.
There might be some push in the future to defer rcParam evaluation closer
to draw time (traitlet integration), but I wouldn't bet on it happening any
time soon, and it probably wouldn't do what you need in any case.
Ben Root
···
On Mon, Feb 29, 2016 at 12:03 PM, Phyks <spam+matplotlib at phyks.me> wrote:
Hi,
Is there a way to change locally the rcParams, for a specific figure after
it has been created?
I know about the rcParams setting (for global settings) and the with
statement construction, but this requires to be done before the figure was
created, and I need to change the settings on an already existing figure
(in
particular color cycler).
I should also note, that it is possible to change the color cycle after an
axes is created (although, now it is called the prop_cycle), using
ax.set_prop_cycle(). Keep in mind that any plots that have already been
made are unaffected by changing the property cycle because they have
already had their properties assigned.
···
On Mon, Feb 29, 2016 at 12:31 PM, Benjamin Root <ben.v.root at gmail.com> wrote:
There is the context manager approach, but it must be utilized prior to
axes creation. For the most part, any usage of the rcParams happen at
creation time of the relevant artist. So, while you could update the color
cycle prior to creating an axes but after the figure creation, changing the
default figure size would be useless at that point since the figure is
already made.
There might be some push in the future to defer rcParam evaluation closer
to draw time (traitlet integration), but I wouldn't bet on it happening any
time soon, and it probably wouldn't do what you need in any case.
Ben Root
On Mon, Feb 29, 2016 at 12:03 PM, Phyks <spam+matplotlib at phyks.me> wrote:
Hi,
Is there a way to change locally the rcParams, for a specific figure after
it has been created?
I know about the rcParams setting (for global settings) and the with
statement construction, but this requires to be done before the figure was
created, and I need to change the settings on an already existing figure
(in
particular color cycler).
Ok, I was not expecting matplotlib to work this way. I was actually
thinking it was storing the drawing commands in some buffer, and was
actually doing the render when needed.
For my use case, I think I should better write a buffer on top of
matplotlib and only call it in the end, when I am actually drawing the
graph.
Thanks
Le 29/02/2016 18:33, Benjamin Root a ?crit :
···
I should also note, that it is possible to change the color cycle after an
axes is created (although, now it is called the prop_cycle), using
ax.set_prop_cycle(). Keep in mind that any plots that have already been
made are unaffected by changing the property cycle because they have
already had their properties assigned.
On Mon, Feb 29, 2016 at 12:31 PM, Benjamin Root <ben.v.root at gmail.com> > wrote:
There is the context manager approach, but it must be utilized prior to
axes creation. For the most part, any usage of the rcParams happen at
creation time of the relevant artist. So, while you could update the color
cycle prior to creating an axes but after the figure creation, changing the
default figure size would be useless at that point since the figure is
already made.
There might be some push in the future to defer rcParam evaluation closer
to draw time (traitlet integration), but I wouldn't bet on it happening any
time soon, and it probably wouldn't do what you need in any case.
Ben Root
On Mon, Feb 29, 2016 at 12:03 PM, Phyks <spam+matplotlib at phyks.me> wrote:
Hi,
Is there a way to change locally the rcParams, for a specific figure after
it has been created?
I know about the rcParams setting (for global settings) and the with
statement construction, but this requires to be done before the figure was
created, and I need to change the settings on an already existing figure
(in
particular color cycler).
Ok, I was not expecting matplotlib to work this way. I was actually
thinking it was storing the drawing commands in some buffer, and was
actually doing the render when needed.
For my use case, I think I should better write a buffer on top of
matplotlib and only call it in the end, when I am actually drawing the
graph.
Thanks
Le 29/02/2016 18:33, Benjamin Root a ?crit :
···
I should also note, that it is possible to change the color cycle after an
axes is created (although, now it is called the prop_cycle), using
ax.set_prop_cycle(). Keep in mind that any plots that have already been
made are unaffected by changing the property cycle because they have
already had their properties assigned.
On Mon, Feb 29, 2016 at 12:31 PM, Benjamin Root <ben.v.root at gmail.com> > wrote:
There is the context manager approach, but it must be utilized prior to
axes creation. For the most part, any usage of the rcParams happen at
creation time of the relevant artist. So, while you could update the color
cycle prior to creating an axes but after the figure creation, changing the
default figure size would be useless at that point since the figure is
already made.
There might be some push in the future to defer rcParam evaluation closer
to draw time (traitlet integration), but I wouldn't bet on it happening any
time soon, and it probably wouldn't do what you need in any case.
Ben Root
On Mon, Feb 29, 2016 at 12:03 PM, Phyks <spam+matplotlib at phyks.me> wrote:
Hi,
Is there a way to change locally the rcParams, for a specific figure after
it has been created?
I know about the rcParams setting (for global settings) and the with
statement construction, but this requires to be done before the figure was
created, and I need to change the settings on an already existing figure
(in
particular color cycler).
It's not quite what you want (no color cycling), but the style system we implemented knows how to apply itself to existing figures, axes, artists, etc. It makes it pretty easy to modify drawing attributes after the figure is drawn and see the affects. For example you can do this to modify a figure after it's on the screen:
________________________________________
From: Matplotlib-devel [matplotlib-devel-bounces+theodore.drain=jpl.nasa.gov at python.org] on behalf of Lucas Verney [lucas@phyks.me]
Sent: Monday, February 29, 2016 9:50 AM
To: Benjamin Root; Phyks
Cc: matplotlib development list
Subject: Re: [Matplotlib-devel] Changing rcParams locally, on the fly
Ok, I was not expecting matplotlib to work this way. I was actually
thinking it was storing the drawing commands in some buffer, and was
actually doing the render when needed.
For my use case, I think I should better write a buffer on top of
matplotlib and only call it in the end, when I am actually drawing the
graph.
Thanks
Le 29/02/2016 18:33, Benjamin Root a ?crit :
I should also note, that it is possible to change the color cycle after an
axes is created (although, now it is called the prop_cycle), using
ax.set_prop_cycle(). Keep in mind that any plots that have already been
made are unaffected by changing the property cycle because they have
already had their properties assigned.
On Mon, Feb 29, 2016 at 12:31 PM, Benjamin Root <ben.v.root at gmail.com> > wrote:
There is the context manager approach, but it must be utilized prior to
axes creation. For the most part, any usage of the rcParams happen at
creation time of the relevant artist. So, while you could update the color
cycle prior to creating an axes but after the figure creation, changing the
default figure size would be useless at that point since the figure is
already made.
There might be some push in the future to defer rcParam evaluation closer
to draw time (traitlet integration), but I wouldn't bet on it happening any
time soon, and it probably wouldn't do what you need in any case.
Ben Root
On Mon, Feb 29, 2016 at 12:03 PM, Phyks <spam+matplotlib at phyks.me> wrote:
Hi,
Is there a way to change locally the rcParams, for a specific figure after
it has been created?
I know about the rcParams setting (for global settings) and the with
statement construction, but this requires to be done before the figure was
created, and I need to change the settings on an already existing figure
(in
particular color cycler).