Main Content

boundaryline

Draw boundary line plot

Description

Use Default Boundary and Line Specification

example

boundaryline(x,y) plots a boundary line specified by the x data x and the y data y. The boundary line contains hatch marks that extend from a fixed spacing and length along the boundary line.

boundaryline(x,y,LineSpec) plots a boundary line specified by the line specification linespec.

Specify Name,Value Arguments and Axis

example

boundaryline(___,Name,Value) plots a boundary line specified by one or more Name,Value pairs. Adjust the look of the boundary line with the 'Hatches', 'HatchLength', 'HatchTangency', 'HatchAngle', 'HatchSpacing', and 'FlipBoundary' properties. Specify name-value pair arguments after all other input arguments.

boundaryline(ax, ___) plots a boundary line on the specified axes ax instead of the current axes, such as that from the gca function.

Return Boundary Line Object

example

bline = boundaryline(___) returns a boundary line object using any of the input argument combinations in the previous syntaxes. Specify arguments as previously listed.

Examples

collapse all

Plot the boundary line of a sine wave.

x = linspace(0,2*pi);
y = sin(x);
boundaryline(x,y)
b = 

  BoundaryLine with properties:

              Color: [0 0 0]
          LineStyle: '-'
          LineWidth: 0.5000
             Marker: 'none'
    MarkerFaceColor: 'none'
         MarkerSize: 6
       HatchSpacing: 0.1000
        HatchLength: 0.0300
         HatchAngle: 225
            Hatches: '/'
      HatchTangency: on
       FlipBoundary: off
              XData: [1×100 double]
              YData: [1×100 double]

  Show all properties

Boundary line of sine wave.

Plot a boundary line with third-spaced hatches. Return the boundary line object in b.

b = boundaryline([0,1],[0,1],'Hatches','//')
b = 

  BoundaryLine with properties:

              Color: [0 0 0]
          LineStyle: '-'
          LineWidth: 0.5000
             Marker: 'none'
    MarkerFaceColor: 'none'
         MarkerSize: 6
       HatchSpacing: 0.1000
        HatchLength: 0.0300
         HatchAngle: 225
            Hatches: '//'
      HatchTangency: on
       FlipBoundary: off
              XData: [0 1]
              YData: [0 1]

  Show all properties

Boundary line third spaced.

Plot a circle boundary line and flip the boundary after creation. Return the boundary line object in b.

t = linspace(0, 2*pi);
      x = cos(t);
      y = sin(t);
      b = boundaryline(x,y)
      b.FlipBoundary = true
b = 

  BoundaryLine with properties:

              Color: [0 0 0]
          LineStyle: '-'
          LineWidth: 0.5000
             Marker: 'none'
    MarkerFaceColor: 'none'
         MarkerSize: 6
       HatchSpacing: 0.1000
        HatchLength: 0.0300
         HatchAngle: 225
            Hatches: '/'
      HatchTangency: on
       FlipBoundary: off
              XData: [1×100 double]
              YData: [1×100 double]

  Show all properties = 

  BoundaryLine with properties:

              Color: [0 0 0]
          LineStyle: '-'
          LineWidth: 0.5000
             Marker: 'none'
    MarkerFaceColor: 'none'
         MarkerSize: 6
       HatchSpacing: 0.1000
        HatchLength: 0.0300
         HatchAngle: 225
            Hatches: '/'
      HatchTangency: on
       FlipBoundary: on
              XData: [1×100 double]
              YData: [1×100 double]

  Show all properties

Boundary line of circle with flipped boundary

Plot a red, dotted and dashed, square boundary line on a specified axis. a is the current axis.

a = gca;
boundaryline(a,[0,1,1,0,0],[0,0,1,1,0],'r-.')

Square red boundary line with dashes and dots.

Input Arguments

collapse all

x coordinate data, specified as a numeric vector. The function uses this data to plot the x coordinates of the boundary line.

Data Types: double

y coordinate data, specified as a numeric vector. The function uses this data to plot the y coordinates of the boundary line.

Data Types: double

Valid axes, specified as a scalar handle. By default, this function plots to the current axes, obtainable with the gca function.

Data Types: double

Line style, marker, and color, specified as a character vector or string containing symbols. The symbols can appear in any order. You do not need to specify all three characteristics (line style, marker, and color). For example, if you omit the line style and specify the marker, then the plot shows only the marker and no line.

Example: '--or' is a red dashed line with circle markers

Line StyleDescriptionResulting Line
'-'Solid line

Sample of solid line

'--'Dashed line

Sample of dashed line

':'Dotted line

Sample of dotted line

'-.'Dash-dotted line

Sample of dash-dotted line, with alternating dashes and dots

MarkerDescriptionResulting Marker
'o'Circle

Sample of circle marker

'+'Plus sign

Sample of plus sign marker

'*'Asterisk

Sample of asterisk marker

'.'Point

Sample of point marker

'x'Cross

Sample of cross marker

'_'Horizontal line

Sample of horizontal line marker

'|'Vertical line

Sample of vertical line marker

's'Square

Sample of square marker

'd'Diamond

Sample of diamond line marker

'^'Upward-pointing triangle

Sample of upward-pointing triangle marker

'v'Downward-pointing triangle

Sample of downward-pointing triangle marker

'>'Right-pointing triangle

Sample of right-pointing triangle marker

'<'Left-pointing triangle

Sample of left-pointing triangle marker

'p'Pentagram

Sample of pentagram marker

'h'Hexagram

Sample of hexagram marker

Color NameShort NameRGB TripletAppearance
'red''r'[1 0 0]

Sample of the color red

'green''g'[0 1 0]

Sample of the color green

'blue''b'[0 0 1]

Sample of the color blue

'cyan' 'c'[0 1 1]

Sample of the color cyan

'magenta''m'[1 0 1]

Sample of the color magenta

'yellow''y'[1 1 0]

Sample of the color yellow

'black''k'[0 0 0]

Sample of the color black

'white''w'[1 1 1]

Sample of the color white

Name-Value Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'Hatches','//'

Note

These properties are only a subset. For a full list, see Line Properties.

Hatch style, specified as '/', '\', or '|'. The length of the string determines the hatch spacing. The more hatches specified, the closer the spacing. For example:

  • For half-spaced forward slants, use 'Hatches','//'.

  • For a single-spaced perpendicular slant, use 'Hatches','|'.

  • For third-spaced backward slants, use 'Hatches','\\\'.

Data Types: char | string

Flip boundary hatch angle by 180 degrees, specified as 'off' or 'on'.

  • 'off' — Do not flip the hatch angle.

  • 'on' — Flip the hatch angle by 180 degrees.

Data Types: char | string

Hatch angle tangency, specified as 'on' or 'off'.

  • 'on' — Hatch angle is relative to the tangent of the line segment. The function determines the tangency by evaluating the line integral traversing from the start to the end of the x and y data.

  • 'off' — Hatch angle is relative to 0.

Data Types: char | string

Length of hatch segments, specified as a numeric scalar.

Data Types: double

Angle of hatch segments, specified as a numeric scalar. The function automatically calculates the hatch angle if you specify a style for 'Hatches'.

Data Types: char | string

Spacing between hatch segments, specified as a numeric scalar.

Data Types: char | string

Line style, specified as one of the options listed in this table.

Line StyleDescriptionResulting Line
'-'Solid line

Sample of solid line

'--'Dashed line

Sample of dashed line

':'Dotted line

Sample of dotted line

'-.'Dash-dotted line

Sample of dash-dotted line, with alternating dashes and dots

'none'No lineNo line

Line width, specified as a positive value in points, where 1 point = 1/72 of an inch. If the line has markers, then the line width also affects the marker edges.

The line width cannot be thinner than the width of a pixel. If you set the line width to a value that is less than the width of a pixel on your system, the line displays as one pixel wide.

Output Arguments

collapse all

Boundary line object, returned as an Aero.graphics.primitive.BoundaryLine object.

Introduced in R2021b