Code covered by the BSD License  

Highlights from
Patchline

5.0

5.0 | 4 ratings Rate this file 92 Downloads (last 30 days) File Size: 2.75 KB File ID: #36953
image thumbnail

Patchline

by

 

20 Jun 2012 (Updated )

Visualize lines as patch objects. Specify any valid patch property, including transparency.

| Watch this File

File Information
Description

Using very simple syntax, patchline allows you to visualize lines as patches. This allows you to set any valid properties of the patch object, including 'EdgeAlpha' (to modify the transparency of the lines).

Note that the effectiveness of setting the transparency (edgealpha) may differ on different operating systems. Try different Figure Renderers (particularly openGL) to get the desired behavior.

Also, unix users may experience problems if the renderer is not set to "opengl software". This parameter cannot be set at runtime, but can be set in startup.m.

Acknowledgements

This file inspired Custom Grid.

Required Products MATLAB
MATLAB release MATLAB 7.14 (R2012a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (4)
12 Dec 2013 Kirsten  
10 Oct 2013 K E

When you need a semi-transparent line, this will do it.

19 Oct 2012 Roger Parkyn

This is pretty useful.

To enable it to handle a matrix of y-values (column-wise) I made the following change which you may like to incorporate:

ADDED AFTER LINE 97 ("% Facecolor = 'k' is (essentially) ignored"...)
%Make x-vector the same size as y-matrix (assuming data is in columns)
if size(ys,2)>1 && size(xs,2)==1
xs = repmat(xs,1,size(ys,2));
end
%Add NaNs onto bottom row (so it doesn't plot an area?)
xs = [xs; NaN(1, size(xs,2))];
ys = [ys; NaN(1, size(ys,2))];
% Plot the "patches" (actually lines)
if isempty(zs)
p = patch(xs, ys, 'w');
else
p = patch(xs, ys, zs, 'w');
end

THE ABOVE REPLACED:
% if isempty(zs)
% p = patch([xs(:);NaN],[ys(:);NaN],'k');
% else
% p = patch([xs(:);NaN],[ys(:);NaN],[zs(:);NaN],'k');
% end

20 Jun 2012 Christopher  
Updates
20 Jun 2012

Updated description, examples.

26 Jun 2012

Improved the rice.png example, modified the description slightly.

Contact us