[Matplotlib-devel] clim API interface

Hello,

I hope this is the correct list I am writing to… I am developing a data analysis GUI for basic biological research using PyQT and matplotlib to have interactive plots inside the UI (which works wonderfully). Recently I needed to add the possibility to interactively change the colormap limits (vmax, vmin) of an image plotted with imshow(). Before changing them, I want to retrieve the current values to fill the respective Qt line edits. Exploring the axes object creating the image, I found:

vmin, vmax = ax.images[0].get_clim()

which gives me exactly what I want. As this is rather undocumented, I wanted to ask if you consider that a save solution or if it’s something which might change rather quickly in the release cycle? I don’t want to build my application on API parts which might break quickly… Thanks in advance!

Cheers,
Gregor

Gregor,

It's safe. get_clim() is a documented public method of the ScalarMappable mixin, inherited by all classes that handle color mapping.

Eric

···

On 2020/04/20 4:36 AM, Gregor Mönke wrote:

Hello,

I hope this is the correct list I am writing to.. I am developing a data analysis GUI for basic biological research using PyQT and matplotlib to have interactive plots inside the UI (which works wonderfully). Recently I needed to add the possibility to interactively change the colormap limits (vmax, vmin) of an image plotted with imshow(). Before changing them, I want to retrieve the current values to fill the respective Qt line edits. Exploring the axes object creating the image, I found:

vmin, vmax = ax.images[0].get_clim()

which gives me exactly what I want. As this is rather undocumented, I wanted to ask if you consider that a save solution or if it's something which might change rather quickly in the release cycle? I don't want to build my application on API parts which might break quickly.. Thanks in advance!

Cheers,
Gregor

_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@python.org
Matplotlib-devel Info Page

_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@python.org
https://mail.python.org/mailman/listinfo/matplotlib-devel