Rank: 59556 based on 0 downloads (last 30 days) and 0 file submitted
photo

Catherine

E-mail

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Comments and Ratings by Catherine View all
Updated File Comments Rating
13 May 2014 freezeColors / unfreezeColors Use multiple colormaps per figure! Version 2, now works for many types of objects, not only images. Author: John Iversen

Freezecolor was just what I needed to plot contours over map data and I have used it for a while. However, in MatLab 2012a and later freezing contourm results no longer works without some modification. There is a listener associated with this plot that remaps all the color levels whenever the colormap is changed thereby undoing the freezecolor changes.I solved this problem by switching the parent of all the countour's children from its hggroup typed parent to that of the parent axis. This disassociates the contour from the hggroup listener. This works for my application so far.

Scatterm does not have this listener and freezcolor works great, however, I came across one small error for an unusual case. If there is only one point in the scatter plot (my plots depend on user clicks and sometime degenerate to this point) then the color is of the wrong dimensionallity. The listener in scatterm that is triggered when the color is frozen has code that checks if the first dimension of cdata is 1 then the second dimension must be 3 or it will be ignored - not colored. The structure freezecolor passes in is 1x1x3. I put a check in freezecolor for object types ~patch (scatterm plots are hggroup type) that if size(realcolor,1)==1 then realcolor=squeeze(realcolor)'.

10 Jun 2010 freezeColors / unfreezeColors Use multiple colormaps per figure! Version 2, now works for many types of objects, not only images. Author: John Iversen

A note on my submission above - I realized setting CLimMode back to auto only worked because I had already frozen the colorbar using cbfreeze . If it is not already frozen, when CLimMod is reset to auto the colorbar loses its limits (undoing the whole purpose of line 159)

10 Jun 2010 freezeColors / unfreezeColors Use multiple colormaps per figure! Version 2, now works for many types of objects, not only images. Author: John Iversen

This function was just what I needed for a contouring GUI I have where the user can contour selectable datasets on a map. However, I found that the contour levels got stuck to that of the first contour even though it had been deleted.

I found that at line 159 where the CLim data for the parent is restored this set the CLimMode to manual vs. auto. The CLim data held the data limits for the contour. Successive contours used these limits even though the data was not in this range.

Adding a line to reset the CLimMode back to auto solves this.

Contact us