File Exchange

image thumbnail

hfill and vfill

version 1.2 (58.3 KB) by

Simply create horizontal or vertical shaded sections of a plot.

2 Downloads

Updated

View License

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.

Comments and Ratings (1)

Chad Greene

Chad Greene (view profile)

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

1.2

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

1.1

Added hfill and the stacking command.

MATLAB Release
MATLAB 8.0 (R2012b)
Acknowledgements

Inspired by: hline and vline, Improved 'vline'

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

hfill_and_vfill/html/