Linking patch objects' XData with linkprop

3 views (last 30 days)
peggy
peggy on 6 Jun 2013
In version 2010a (windows), the XData of patch objects do not seem to link properly with linkprop. Here's an example:
% create 2 patches
figure
hp(1)=patch([ 0.1 0.5 0.5 0.1], [0 0 0.5 0.5], 'r'); % lower patch
hp(2)=patch([ 0.1 0.5 0.5 0.1], [0.6 0.6 1 1], 'r'); % upper patch
set(gca,'XLim',[0 1])
% link their XData
hlinkXdata = linkprop(hp, 'XData');
% Change the upper patches XData - move it to the right
set(hp(2), 'XData', [0.4 0.7 0.7 0.4])
% lower patch should move too, but it does not
Linking the FaceColor of the patches does work:
% link patches facecolor
hlinkColor=linkprop(hp, 'FaceColor');
% change one's color, the other changes too
set(hp(2),'facecolor','b')
It's not an XData issue because linking XData of line objects does work:
% create 2 lines
hL(1)=line([0.05 0.05], [0 0.5]);
hL(2)=line([0.05 0.05], [0.6 1.0]);
% link their XData
hlinkLine=linkprop(hL, 'XData')
% change one, the other changes too
set(hL(2), 'XData', [0.95 0.95])
Is there something that needs to be done differently to link the XData property of patches?

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!