Code covered by the BSD License  

Highlights from
hfill and vfill

Be the first to rate this file! 26 Downloads (last 30 days) File Size: 58.3 KB File ID: #43090
image thumbnail

hfill and vfill

by

 

15 Aug 2013 (Updated )

Simply create horizontal or vertical shaded sections of a plot.

| Watch this File

File Information
Description

h = vfill(xbounds,ColorSpec,varargin) creates fill objects bounded by the values xbounds. ColorSpec defines the color of the fill objects. Optional varargin can be used to set edgecolor, transparency, etc.

Syntax

hfill(scalarValue)
hfill([ystart yend])
hfill([ystart1,yend1,ystart2,yend2,...,ystartn,yendn])
hfill(...,ColorSpec)
hfill(...,ColorSpec,'PatchProperty','PatchValue')
hfill(...,'bottom')
h = hfill(...)

Description

hfill(scalarValue) places a horizontal line along y = scalarValue.

hfill([ystart yend]) fills a horizontal shaded region bounded by ystart and yend.

hfill([ystart1,yend1,ystart2,yend2,...,ystartn,yendn]) fills multiple horizontal regions.

hfill(...,ColorSpec) defines the face color of the patch(es) created by hfill. ColorSpec can be one of the Matlab color names (e.g. 'red'), abbreviations (e.g. 'r', or rgb triplet (e.g. [1 0 0]). ColorSpec may also be 'gray'.

hfill(...,ColorSpec,'PatchProperty','PatchValue') defines patch properties such as 'EdgeColor' and 'FaceAlpha'.

hfill(...,'bottom') places the newly created patch(es) at the bottom of the uistack.

h = hfill(...) returns handle(s) of newly created patch objects.

Acknowledgements

Hline And Vline and Improved 'Vline' inspired this file.

Required Products MATLAB
MATLAB release MATLAB 8.0 (R2012b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
15 Aug 2013 Chad Greene

Tip: If you like the example image, but you'd prefer the gray box to be behind your data instead of on top of it, reorder the stack like this:

h = vfill([80 90],'gray');
uistack(h,'bottom')

Updates
19 Aug 2013

Added hfill and the stacking command.

01 Aug 2014

Simplified syntax for plain vertical or horizontal lines, added an example file.

Contact us