Main Content

boundaryline

Draw boundary line plot

Since R2021b

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)

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.0125
        HatchLength: 0.0300
         HatchAngle: 225
            Hatches: '//'
      HatchTangency: on
       FlipBoundary: off
              XData: [0 1]
              YData: [0 1]

  Use GET to show all properties

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 = 
  BoundaryLine with properties:

              Color: [0 0 0]
          LineStyle: '-'
          LineWidth: 0.5000
             Marker: 'none'
    MarkerFaceColor: 'none'
         MarkerSize: 6
       HatchSpacing: 0.0255
        HatchLength: 0.0300
         HatchAngle: 225
            Hatches: '/'
      HatchTangency: on
       FlipBoundary: off
              XData: [1 0.9980 0.9920 0.9819 0.9679 0.9501 0.9284 0.9029 0.8738 0.8413 0.8053 0.7660 0.7237 0.6785 0.6306 0.5801 0.5272 0.4723 0.4154 0.3569 0.2969 0.2358 0.1736 0.1108 0.0476 -0.0159 -0.0792 -0.1423 -0.2048 -0.2665 ... ] (1x100 double)
              YData: [0 0.0634 0.1266 0.1893 0.2511 0.3120 0.3717 0.4298 0.4862 0.5406 0.5929 0.6428 0.6901 0.7346 0.7761 0.8146 0.8497 0.8815 0.9096 0.9341 0.9549 0.9718 0.9848 0.9938 0.9989 0.9999 0.9969 0.9898 0.9788 0.9638 0.9450 ... ] (1x100 double)

  Use GET to show all properties

      b.FlipBoundary = true

b = 
  BoundaryLine with properties:

              Color: [0 0 0]
          LineStyle: '-'
          LineWidth: 0.5000
             Marker: 'none'
    MarkerFaceColor: 'none'
         MarkerSize: 6
       HatchSpacing: 0.0255
        HatchLength: 0.0300
         HatchAngle: 225
            Hatches: '/'
      HatchTangency: on
       FlipBoundary: on
              XData: [1 0.9980 0.9920 0.9819 0.9679 0.9501 0.9284 0.9029 0.8738 0.8413 0.8053 0.7660 0.7237 0.6785 0.6306 0.5801 0.5272 0.4723 0.4154 0.3569 0.2969 0.2358 0.1736 0.1108 0.0476 -0.0159 -0.0792 -0.1423 -0.2048 -0.2665 ... ] (1x100 double)
              YData: [0 0.0634 0.1266 0.1893 0.2511 0.3120 0.3717 0.4298 0.4862 0.5406 0.5929 0.6428 0.6901 0.7346 0.7761 0.8146 0.8497 0.8815 0.9096 0.9341 0.9549 0.9718 0.9848 0.9938 0.9989 0.9999 0.9969 0.9898 0.9788 0.9638 0.9450 ... ] (1x100 double)

  Use GET to show all properties

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-.')

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 string scalar or character vector 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

"square"Square

Sample of square marker

"diamond"Diamond

Sample of diamond 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

"pentagram"Pentagram

Sample of pentagram marker

"hexagram"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 pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

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.

Version History

Introduced in R2021b