[Matplotlib-devel] Changing rcParams locally, on the fly

Phyks spam+matplotlib at phyks.me
Mon Feb 29 17:57:56 EST 2016


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).
>>>
>>> Thanks
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://matplotlib.1069221.n5.nabble.com/Changing-rcParams-locally-on-the-fly-tp46813.html
>>> Sent from the matplotlib - devel mailing list archive at Nabble.com.
>>> _______________________________________________
>>> Matplotlib-devel mailing list
>>> Matplotlib-devel at python.org
>>> https://mail.python.org/mailman/listinfo/matplotlib-devel
>>>
>>
>>
> 


More information about the Matplotlib-devel mailing list