Comments on: Customizing contour plots https://undocumentedmatlab.com/blog_old/customizing-contour-plots Charting Matlab's unsupported hidden underbelly Thu, 02 May 2024 08:00:01 +0000 hourly 1 https://wordpress.org/?v=4.4.1 By: Austin Spencerhttps://undocumentedmatlab.com/blog_old/customizing-contour-plots#comment-474219 Thu, 11 Apr 2019 14:26:11 +0000 https://undocumentedmatlab.com/?p=6075#comment-474219 An update/correction after some additional exploration: EdgePrims is still used for contour lines that do not form closed loops, as is the case when a contour line intersects the edge of the dataset. Therefore, in order to set the properties of all contours consistently, you must loop over all EdgePrims and EdgeLoopPrims.

]]>
By: Austin Spencerhttps://undocumentedmatlab.com/blog_old/customizing-contour-plots#comment-473847 Tue, 09 Apr 2019 18:31:35 +0000 https://undocumentedmatlab.com/?p=6075#comment-473847 As of at least MATLAB R2018b, the names of some undocumented contour properties have changed. The edges are now listed under EdgeLoopPrims and are of type LineLoop. EdgePrims is still present, but is empty. LineLoop has ColorData and ColorType properties, so the same customization is still possible.

]]>
By: Yair Altmanhttps://undocumentedmatlab.com/blog_old/customizing-contour-plots#comment-382762 Mon, 11 Jul 2016 16:52:59 +0000 https://undocumentedmatlab.com/?p=6075#comment-382762 @Chunyu – when you save the figure, many of the undocumented customizations are reset by Matlab.

If you are saving into a *.fig file format, then you can add your customizations to the figure’s CreateFcn callback (see here and here).

If you are saving to EPS, PDF or some image format then try using the export_fig or ScreenCapture utilities.

]]>
By: Chunyu Liuhttps://undocumentedmatlab.com/blog_old/customizing-contour-plots#comment-382757 Mon, 11 Jul 2016 15:46:36 +0000 https://undocumentedmatlab.com/?p=6075#comment-382757 Hi,
Thank you so much for your fruitful share about this.
But I have a problem with saving the figure.
For example, I want to change face color for different contour level.
Once I change it, It show up immediately. However, When I save the figure, the changing goes away.
It just save the original defaulted color.

]]>
By: Alban Flachothttps://undocumentedmatlab.com/blog_old/customizing-contour-plots#comment-379620 Wed, 08 Jun 2016 14:53:26 +0000 https://undocumentedmatlab.com/?p=6075#comment-379620 Hello !

Thank you very much for sharing all this. I may have still a related problem I hope you could help me solve…

I have a mountain-like 3D surface plot and a value as a treshold. When I cut the 3D plot a the treshold level using contourf, it plots separeted surfaces.
For illustration, here is a simple example:

z = peaks(20);
z = z/max(z(:));
[c,h] = contourf(z,[0.4 1]);

gives a figure with 3 delimited areas. I would like to display these areas in different colors, say yellow, green and blue. This seemed possible in the previous versions of matlab using, h.Children, but I can’t see how I could obtain the same result now that internal patches are not defined anymore. Do you perhaps know the answer ?

I am sorry if this is trivial with all the pieces of information you shared already, I am a bit new to matlab and still could not figure this thing out.

Thanks in advance !

]]>
By: Yair Altmanhttps://undocumentedmatlab.com/blog_old/customizing-contour-plots#comment-364346 Sat, 19 Dec 2015 21:02:32 +0000 https://undocumentedmatlab.com/?p=6075#comment-364346 @Diaa – as the post explains, you have direct access to all the separate contour labels and lines – you can hide/delete those lines and labels which your program’s logic decides should not be displayed.

]]>
By: Diaa Abidouhttps://undocumentedmatlab.com/blog_old/customizing-contour-plots#comment-364343 Sat, 19 Dec 2015 20:53:52 +0000 https://undocumentedmatlab.com/?p=6075#comment-364343 Hello,

Thanks for sharing this useful piece of information.

However, if I have a filled-contour plot and I would like to hide certain level of some value. For example, to hide levels of temperature equal to or greater than some upper limit for better demonstration. How can I do that ?

Many thanks

]]>
By: Yair Altmanhttps://undocumentedmatlab.com/blog_old/customizing-contour-plots#comment-362505 Wed, 25 Nov 2015 12:52:18 +0000 https://undocumentedmatlab.com/?p=6075#comment-362505 Thanks – I completely forgot about this alternative. There are many ways to skin a cat…

]]>
By: Willhttps://undocumentedmatlab.com/blog_old/customizing-contour-plots#comment-362504 Wed, 25 Nov 2015 12:44:07 +0000 https://undocumentedmatlab.com/?p=6075#comment-362504 The primitives don’t have a ButtonDownFcn property but they do have a Hit event. It was you who brought this to my attention in the first place! Adding an event listener directly to those primitives (and of course switching their HitTest property to ‘on’) seems like a much more straightforward solution than the other two…

]]>
By: Eric Sampsonhttps://undocumentedmatlab.com/blog_old/customizing-contour-plots#comment-361986 Thu, 19 Nov 2015 16:49:01 +0000 https://undocumentedmatlab.com/?p=6075#comment-361986 Very nice post Yair, thanks.

]]>