MATLAB: How to flip a patch graph/diagram

flippatch

Hey,
I want to flip a triangle I plotted with patch. See the picture for clarification.
I don't want anything else (e.g. axes) to be changed. Is there an easy way to do this?

Best Answer

XL = get(gca, 'XLim');
patch_X = get(patch_handle, 'XData');
new_X = XL(2) - patch_X + XL(1);
set(patch_handle, 'XData', new_X);
You did not say which axis to flip it around, so I choose the middle of the displayed data rather than middle of the patch data or half of the patch data or around its right-most point.
Related Question