matlab - Overlaying a semi-transparent rectangle on an plot created with imagesc? -
i have used imagesc
in matlab plot acoustic field. want overlay semi-transparent filled in rectangle @ location on image. ideally i'd able following:
imagesc(g,g,field); hold on plotrectangle([100,100,200,200], 'b', 0.5) hold off
where b color of rectangle 0.5 transparency. can done?
you can use rectangle
create rectangle object , use color specified rgba include transparency
rectangle('position', [100 100 200 200], 'facecolor', [0 0 1 0.5])
alternately, can use patch
object
p = patch('vertices', [100, 100; 100, 200; 200, 200; 200 100], ... 'faces', [1, 2, 3, 4], ... 'facecolor', 'b', ... 'facealpha', 0.5)
Comments
Post a Comment