Main Content

semilogx

Semilog plot (x-axis has log scale)

  • Semilogx plot

Description

Vector and Matrix Data

example

semilogx(X,Y)plotsx- andy-coordinates using a base-10 logarithmic scale on thex-axis and a linear scale on they-axis.

  • To plot a set of coordinates connected by line segments, specifyXandYas vectors of the same length.

  • To plot multiple sets of coordinates on the same set of axes, specify at least one ofXorYas a matrix.

example

semilogx(X,Y,LineSpec)creates the plot using the specified line style, marker, and color.

example

semilogx(X1,Y1、……Xn,Yn)plots multiple pairs ofx- andy-coordinates on the same set of axes. Use this syntax as an alternative to specifying coordinates as matrices.

example

semilogx(X1,Y1,LineSpec1、……Xn,Yn,LineSpecn)assigns specific line styles, markers, and colors to eachx-ypair. You can specifyLineSpecfor somex-ypairs and omit it for others. For example,semilogx(X1,Y1,'o',X2,Y2)specifies markers for the firstx-ypair but not for the second pair.

example

semilogx(Y)plotsYagainst an implicit set ofx坐标。

  • IfYis a vector, thex-coordinates range from 1 tolength(Y).

  • IfYis a matrix, the plot contains one line for each column inY. Thex-coordinates range from 1 to the number of rows inY.

IfYcontains complex numbers,semilogxplots the imaginary part ofYversus the real part ofY. However, if you specify bothXandY, MATLAB®ignores the imaginary part.

semilogx(Y,LineSpec)plotsYusing implicitx-coordinates, and specifies the line style, marker, and color.

Table Data

example

semilogx(tbl,xvar,yvar)plots the variablesxvarandyvarfrom the tabletbl. To plot one data set, specify one variable forxvarand one variable foryvar. To plot multiple data sets, specify multiple variables forxvar,yvar, or both. If both arguments specify multiple variables, they must specify the same number of variables.(since R2022a)

semilogx(tbl,yvar)情节从表中指定的变量霍霍t the row indices of the table. Timetables are not supported for this syntax.(since R2022a)

Additional Options

example

semilogx(ax,___)displays the plot in the target axes. Specify the axes as the first argument in any of the previous syntaxes.

example

semilogx(___,Name,Value)specifiesLineproperties using one or moreName,Valuepair arguments. The properties apply to all the plotted lines. Specify theName,Valuepairs after all the arguments in any of the previous syntaxes. For a list of properties, seeLine Properties.

example

p = semilogx(___)返回一个Lineobject or an array ofLineobjects. Usepto modify properties of the plot after creating it. For a list of properties, seeLine Properties.

Examples

collapse all

Definexas a vector of logarithmically spaced values from0.1to100, and defineyas a copy ofx. Create a linear-log plot ofxandy, and call thegridfunction to show the grid lines.

x = logspace(-1,2); y = x; semilogx(x,y) gridon

Figure contains an axes object. The axes object contains an object of type line.

创建a vector of logarithmically spacedx-coordinates and two vectors ofy坐标。Plot two lines by passing comma-separatedx-ypairs tosemilogx.

x = logspace(-1,2); y1 = x; y2 = -x; semilogx(x,y1,x,y2) gridon

Figure contains an axes object. The axes object contains 2 objects of type line.

Definefas a vector containing the frequencies from 10 Hz to 100,000 Hz. Definegainas a vector of power gain values in decibels. Then plot the gain values against frequency.

f = logspace(1,5,100); v = linspace(-50,50,100); gain = (1-exp(5*(2.5*v.^2)./7500))/14; semilogx(f,gain) gridon

Figure contains an axes object. The axes object contains an object of type line.

Call theyticksfunction to reposition they-axis tick values at whole-number increments along they-axis. Then createx- andy-axis labels by calling thexlabelandylabelfunctions.

yticks([-5 -4 -3 -2 -1 0]) xlabel ('Frequency (Hz)') ylabel(的功率增益(dB)”)

Figure contains an axes object. The axes object contains an object of type line.

创建a set ofx- andy-coordinates and display them in a linear-log plot. Specify the line style as'o'to display circular markers without connecting lines. Specify the marker fill color as the RGB triplet[0 0.447 0.741], which corresponds to a dark shade of blue.

x = logspace(-1,2,15); y = 12 + x; semilogx(x,y,'o','MarkerFaceColor',[0 0.447 0.741]) gridon

Figure contains an axes object. The axes object contains an object of type line.

创建a vector of logarithmically spacedx-coordinates and two vectors ofy坐标。然后画两条直线通过逗号-separatedx-ypairs tosemilogx. Display a legend by calling the传说function.

x = logspace(1,4,100); v = linspace(-50,50,100); y1 = 100*exp(-1*((v+5).^2)./200); y2 = 100*exp(-1*(v.^2)./200); semilogx(x,y1,x,y2,'--') legend('Measured','Estimated') gridon

Figure contains an axes object. The axes object contains 2 objects of type line. These objects represent Measured, Estimated.

When you specify only one coordinate vector,semilogxplots those coordinates against the values1:length(y). For example, defineyas a vector of 5 values between0and 40. Create a linear-log plot of y.

y = [0 10 20 30 40]; semilogx(y) gridon

Figure contains an axes object. The axes object contains an object of type line.

If you specifyyas a matrix, the columns of y are plotted against the values1:size(y,1). For example, defineyas a 5-by-3 matrix and pass it to thesemilogxfunction. The resulting plot contains 3 lines, each of which hasx-coordinates that range from1to5.

y = [ 0 10 20 10 20 30 20 30 40 30 40 50 40 50 60]; semilogx(y) gridon

Figure contains an axes object. The axes object contains 3 objects of type line.

Since R2022a

A convenient way to plot data from a table is to pass the table to thesemilogxfunction and specify the variables to plot.

创建a table containing two variables. Then display the first three rows of the table.

输入= logspace(1、2)';输出= 2*Input; tbl = table(Input,Output); head(tbl,3)
ans=3×2 tableInput Output _______ _______ 0.1 0.2 0.11514 0.23028 0.13257 0.26514

Plot theInputvariable on thex-axis and the输出variable on they-axis. Return theLineobject asp, and turn the axes grid on. Notice that the axis labels match the variable names.

p = semilogx(tbl,"Input","Output"); gridon

Figure contains an axes object. The axes object contains an object of type line.

To modify aspects of the line, set theLineStyle,Color, andMarkerproperties on theLineobject. For example, change the line to a red dotted line with point markers.

p.LineStyle =":"; p.Color ="red"; p.Marker =".";

Figure contains an axes object. The axes object contains an object of type line.

Since R2022a

创建a table containing three variables. Then display the first three rows in the table.

输入= logspace(1、2)';Output1 = 2 *输入;输出2 = -Input; tbl = table(Input,Output1,Output2); head(tbl,3)
ans=3×3 tableInput Output1 Output2 _______ _______ ________ 0.1 0.2 -0.1 0.11514 0.23028 -0.11514 0.13257 0.26514 -0.13257

Plot theInputvariable on thex-axis and the输出1and输出2variables on they-axis. Add a legend. Notice that the legend labels match the variable names.

semilogx(tbl,"Input",["Output1""Output2"]) gridon传说

Figure contains an axes object. The axes object contains 2 objects of type line.

创建a tiled chart layout in the'flow'tile arrangement, so that the axes fill the available space in the layout. Next, call thenexttilefunction to create an axes object and return it asax1. Then display a linear-log plot by passingax1to thesemilogxfunction.

tiledlayout('flow') ax1 = nexttile; x = logspace(-1,2); y1 = 1./x; semilogx(ax1,x,y1)

Figure contains an axes object. The axes object contains an object of type line.

Repeat the process to create a second linear-log plot.

ax2 = nexttile; y2 = x; semilogx(ax2,x,y2)

Figure contains 2 axes objects. Axes object 1 contains an object of type line. Axes object 2 contains an object of type line.

创建a linear-log plot containing two lines, and return the line objects in the variableslg.

x = logspace(-1,2); y1 = x; y2 = -x; slg = semilogx(x,y1,x,y2);

Figure contains an axes object. The axes object contains 2 objects of type line.

Change the width of the first line to3, and change the color of the second line to purple.

slg(1).LineWidth = 3; slg(2).Color = [0.4 0 1];

Figure contains an axes object. The axes object contains 2 objects of type line.

InsertNaNvalues wherever there are discontinuities in your data. Thesemilogxfunction displays gaps at those locations.

创建a pair of x- and y-coordinate vectors. Replace the fortiethy-coordinate with aNaNvalue. Then create a linear-log plot ofxandy.

x = logspace(-1,2); y = x; y(40) = NaN; semilogx(x,y)

Figure contains an axes object. The axes object contains an object of type line.

Input Arguments

collapse all

Log scale coordinates, specified as a scalar, vector, or matrix. The size and shape ofXdepends on the shape of your data and the type of plot you want to create. This table describes the most common situations.

Type of Plot How to Specify Coordinates
Single point

SpecifyXandYas scalars and include a marker. For example:

semilogx(1,2,'o')

一个点集

SpecifyXandYas any combination of row or column vectors of the same length. For example:

semilogx([1 2 3],[4; 5; 6])

Multiple sets of points
(using vectors)

Specify consecutive pairs ofXandYvectors. For example:

semilogx([1 2 3],[4 5 6],[1 2 3],[7 8 9])

Multiple sets of points
(using matrices)

If all the sets share the samex- ory-coordinates, specify the shared coordinates as a vector and the other coordinates as a matrix. The length of the vector must match one of the dimensions of the matrix. For example:

semilogx([1 2 3],[4 5 6; 7 8 9])
If the matrix is square,semilogxplots one line for each column in the matrix.

Alternatively, specifyXandYas matrices of equal size. In this case,semilogxplots each column ofYagainst the corresponding column ofX. For example:

semilogx([1 2 3; 4 5 6],[7 8 9; 10 11 12])

semilogxmight exclude coordinates in some cases:

  • If the log scale coordinates include positive and negative values, only the positive values are displayed.

  • If the log scale coordinates are all negative, all of the values are displayed on a log scale with the appropriate sign.

  • Log scale values of zero are not displayed.

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Linear scale coordinates, specified as a scalar, vector, or matrix. The size and shape ofYdepends on the shape of your data and the type of plot you want to create. This table describes the most common situations.

Type of Plot How to Specify Coordinates
Single point

SpecifyXandYas scalars and include a marker. For example:

semilogx(1,2,'o')

一个点集

SpecifyXandYas any combination of row or column vectors of the same length. For example:

semilogx([1 2 3],[4; 5; 6])

Multiple sets of points
(using vectors)

Specify consecutive pairs ofXandYvectors. For example:

semilogx([1 2 3],[4 5 6],[1 2 3],[7 8 9])

Multiple sets of points
(using matrices)

If all the sets share the samex- ory-coordinates, specify the shared coordinates as a vector and the other coordinates as a matrix. The length of the vector must match one of the dimensions of the matrix. For example:

semilogx([1 2 3],[4 5 6; 7 8 9])
If the matrix is square,semilogxplots one line for each column in the matrix.

Alternatively, specifyXandYas matrices of equal size. In this case,semilogxplots each column ofYagainst the corresponding column ofX. For example:

semilogx([1 2 3; 4 5 6],[7 8 9; 10 11 12])

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64|categorical|datetime|duration

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 Style Description Resulting 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

Marker Description Resulting 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 Name Short Name RGB Triplet Appearance
'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

“白色” 'w' (1 1 1)

Sample of the color white

Source table containing the data to plot, specified as a table or a timetable.

Table variables containing thex-coordinates, specified using one of the indexing schemes from the table.

Indexing Scheme Examples

Variable names:

  • A string, character vector, or cell array.

  • Apatternobject.

  • "A"or'A'— A variable calledA

  • ["A","B"]or{'A','B'}— Two variables calledAandB

  • "Var"+digitsPattern(1)— Variables named"Var"followed by a single digit

Variable index:

  • An index number that refers to the location of a variable in the table.

  • A vector of numbers.

  • A logical vector. Typically, this vector is the same length as the number of variables, but you can omit trailing0orfalsevalues.

  • 3— The third variable from the table

  • [2 3]— The second and third variables from the table

  • [false false true]— The third variable

Variable type:

  • Avartypesubscript that selects variables of a specified type.

  • vartype("categorical")— All the variables containing categorical values

The table variables you specify can contain any numeric values. However,semilogxmight exclude negative and zero values from the plot in the same way as it does when you specifyXas a vector containing negative or zero values.

Ifxvarandyvarboth specify multiple variables, the number of variables must be the same.

Example:semilogx(tbl,["x1","x2"],"y")specifies the table variables namedx1andx2for thex坐标。

Example:semilogx(tbl,2,"y")specifies the second variable for thex坐标。

Example:semilogx(tbl,vartype("numeric"),"y")specifies all numeric variables for thex坐标。

Table variables containing they-coordinates, specified using one of the indexing schemes from the table.

Indexing Scheme Examples

Variable names:

  • A string, character vector, or cell array.

  • Apatternobject.

  • "A"or'A'— A variable calledA

  • ["A","B"]or{'A','B'}— Two variables calledAandB

  • "Var"+digitsPattern(1)— Variables named"Var"followed by a single digit

Variable index:

  • An index number that refers to the location of a variable in the table.

  • A vector of numbers.

  • A logical vector. Typically, this vector is the same length as the number of variables, but you can omit trailing0orfalsevalues.

  • 3— The third variable from the table

  • [2 3]— The second and third variables from the table

  • [false false true]— The third variable

Variable type:

  • Avartypesubscript that selects variables of a specified type.

  • vartype("categorical")— All the variables containing categorical values

The table variables you specify can contain numeric, categorical, datetime, or duration values. Ifxvarandyvarboth specify multiple variables, the number of variables must be the same.

Example:semilogx(tbl,"x",["y1","y2"])specifies the table variables namedy1andy2for they坐标。

Example:semilogx(tbl,"x",2)specifies the second variable for they坐标。

Example:semilogx(tbl,"x",vartype("numeric"))specifies all numeric variables for they坐标。

Target axes, specified as anAxesobject. If you do not specify the axes and if the current axes is Cartesian, thensemilogxuses the current axes.

Name-Value Arguments

Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN, whereNameis the argument name andValueis 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 encloseNamein quotes.

Example:semilogx([1 2],[3 4],'Color','red')specifies a red line for the plot.

Note

The properties listed here are only a subset. For a complete list, seeLine Properties.

Color, specified as an RGB triplet, a hexadecimal color code, a color name, or a short name. The color you specify sets the line color. It also sets the marker edge color when theMarkerEdgeColorproperty is set to'auto'.

For a custom color, specify an RGB triplet or a hexadecimal color code.

  • An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range[0,1]; for example,[0.4 0.6 0.7].

  • A hexadecimal color code is a character vector or a string scalar that starts with a hash symbol (#) followed by three or six hexadecimal digits, which can range from0toF. The values are not case sensitive. Thus, the color codes'#FF8800','#ff8800','#F80', and'#f80'are equivalent.

Alternatively, you can specify some common colors by name. This table lists the named color options, the equivalent RGB triplets, and hexadecimal color codes.

Color Name Short Name RGB Triplet Hexadecimal Color Code Appearance
'red' 'r' [1 0 0] '#FF0000'

Sample of the color red

'green' 'g' [0 1 0] '#00FF00'

Sample of the color green

'blue' 'b' [0 0 1] '#0000FF'

Sample of the color blue

'cyan' 'c' [0 1 1] '#00FFFF'

Sample of the color cyan

'magenta' 'm' [1 0 1] '#FF00FF'

Sample of the color magenta

'yellow' 'y' [1 1 0] '#FFFF00'

Sample of the color yellow

'black' 'k' [0 0 0] '#000000'

Sample of the color black

“白色” 'w' (1 1 1) '#FFFFFF'

Sample of the color white

'none' Not applicable Not applicable Not applicable No color

Here are the RGB triplets and hexadecimal color codes for the default colors MATLAB uses in many types of plots.

RGB Triplet Hexadecimal Color Code Appearance
[0 0.4470 0.7410] '#0072BD'

Sample of RGB triplet [0 0.4470 0.7410], which appears as dark blue

[0.8500 0.3250 0.0980] '#D95319'

Sample of RGB triplet [0.8500 0.3250 0.0980], which appears as dark orange

[0.9290 0.6940 0.1250] '#EDB120'

Sample of RGB triplet [0.9290 0.6940 0.1250], which appears as dark yellow

[0.4940 0.1840 0.5560] '#7E2F8E'

Sample of RGB triplet [0.4940 0.1840 0.5560], which appears as dark purple

[0.4660 0.6740 0.1880] '#77AC30'

Sample of RGB triplet [0.4660 0.6740 0.1880], which appears as medium green

[0.3010 0.7450 0.9330] '#4DBEEE'

Sample of RGB triplet [0.3010 0.7450 0.9330], which appears as light blue

[0.6350 0.0780 0.1840] '#A2142F'

Sample of RGB triplet [0.6350 0.0780 0.1840], which appears as dark red

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.

Marker size, specified as a positive value in points, where 1 point = 1/72 of an inch.

Marker outline color, specified as'auto', an RGB triplet, a hexadecimal color code, a color name, or a short name. The default value of'auto'uses the same color as theColorproperty.

For a custom color, specify an RGB triplet or a hexadecimal color code.

  • An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range[0,1]; for example,[0.4 0.6 0.7].

  • A hexadecimal color code is a character vector or a string scalar that starts with a hash symbol (#) followed by three or six hexadecimal digits, which can range from0toF. The values are not case sensitive. Thus, the color codes'#FF8800','#ff8800','#F80', and'#f80'are equivalent.

Alternatively, you can specify some common colors by name. This table lists the named color options, the equivalent RGB triplets, and hexadecimal color codes.

Color Name Short Name RGB Triplet Hexadecimal Color Code Appearance
'red' 'r' [1 0 0] '#FF0000'

Sample of the color red

'green' 'g' [0 1 0] '#00FF00'

Sample of the color green

'blue' 'b' [0 0 1] '#0000FF'

Sample of the color blue

'cyan' 'c' [0 1 1] '#00FFFF'

Sample of the color cyan

'magenta' 'm' [1 0 1] '#FF00FF'

Sample of the color magenta

'yellow' 'y' [1 1 0] '#FFFF00'

Sample of the color yellow

'black' 'k' [0 0 0] '#000000'

Sample of the color black

“白色” 'w' (1 1 1) '#FFFFFF'

Sample of the color white

'none' Not applicable Not applicable Not applicable No color

Here are the RGB triplets and hexadecimal color codes for the default colors MATLAB uses in many types of plots.

RGB Triplet Hexadecimal Color Code Appearance
[0 0.4470 0.7410] '#0072BD'

Sample of RGB triplet [0 0.4470 0.7410], which appears as dark blue

[0.8500 0.3250 0.0980] '#D95319'

Sample of RGB triplet [0.8500 0.3250 0.0980], which appears as dark orange

[0.9290 0.6940 0.1250] '#EDB120'

Sample of RGB triplet [0.9290 0.6940 0.1250], which appears as dark yellow

[0.4940 0.1840 0.5560] '#7E2F8E'

Sample of RGB triplet [0.4940 0.1840 0.5560], which appears as dark purple

[0.4660 0.6740 0.1880] '#77AC30'

Sample of RGB triplet [0.4660 0.6740 0.1880], which appears as medium green

[0.3010 0.7450 0.9330] '#4DBEEE'

Sample of RGB triplet [0.3010 0.7450 0.9330], which appears as light blue

[0.6350 0.0780 0.1840] '#A2142F'

Sample of RGB triplet [0.6350 0.0780 0.1840], which appears as dark red

Marker fill color, specified as'auto', an RGB triplet, a hexadecimal color code, a color name, or a short name. The'auto'option uses the same color as theColorproperty of the parent axes. If you specify'auto'and the axes plot box is invisible, the marker fill color is the color of the figure.

For a custom color, specify an RGB triplet or a hexadecimal color code.

  • An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range[0,1]; for example,[0.4 0.6 0.7].

  • A hexadecimal color code is a character vector or a string scalar that starts with a hash symbol (#) followed by three or six hexadecimal digits, which can range from0toF. The values are not case sensitive. Thus, the color codes'#FF8800','#ff8800','#F80', and'#f80'are equivalent.

Alternatively, you can specify some common colors by name. This table lists the named color options, the equivalent RGB triplets, and hexadecimal color codes.

Color Name Short Name RGB Triplet Hexadecimal Color Code Appearance
'red' 'r' [1 0 0] '#FF0000'

Sample of the color red

'green' 'g' [0 1 0] '#00FF00'

Sample of the color green

'blue' 'b' [0 0 1] '#0000FF'

Sample of the color blue

'cyan' 'c' [0 1 1] '#00FFFF'

Sample of the color cyan

'magenta' 'm' [1 0 1] '#FF00FF'

Sample of the color magenta

'yellow' 'y' [1 1 0] '#FFFF00'

Sample of the color yellow

'black' 'k' [0 0 0] '#000000'

Sample of the color black

“白色” 'w' (1 1 1) '#FFFFFF'

Sample of the color white

'none' Not applicable Not applicable Not applicable No color

Here are the RGB triplets and hexadecimal color codes for the default colors MATLAB uses in many types of plots.

RGB Triplet Hexadecimal Color Code Appearance
[0 0.4470 0.7410] '#0072BD'

Sample of RGB triplet [0 0.4470 0.7410], which appears as dark blue

[0.8500 0.3250 0.0980] '#D95319'

Sample of RGB triplet [0.8500 0.3250 0.0980], which appears as dark orange

[0.9290 0.6940 0.1250] '#EDB120'

Sample of RGB triplet [0.9290 0.6940 0.1250], which appears as dark yellow

[0.4940 0.1840 0.5560] '#7E2F8E'

Sample of RGB triplet [0.4940 0.1840 0.5560], which appears as dark purple

[0.4660 0.6740 0.1880] '#77AC30'

Sample of RGB triplet [0.4660 0.6740 0.1880], which appears as medium green

[0.3010 0.7450 0.9330] '#4DBEEE'

Sample of RGB triplet [0.3010 0.7450 0.9330], which appears as light blue

[0.6350 0.0780 0.1840] '#A2142F'

Sample of RGB triplet [0.6350 0.0780 0.1840], which appears as dark red

Tips

  • Thesemilogxfunction uses colors and line styles based on theColorOrderandLineStyleOrderproperties of the axes.semilogxcycles through the colors with the first line style. Then, it cycles through the colors again with each additional line style.

    You can change the colors and the line styles after plotting by setting theColorOrderorLineStyleOrderproperties on the axes. You can also call thecolororderfunction to change the color order for all the axes in the figure.

Algorithms

Thesemilogxfunction plotsx-coordinates on a log scale by setting theXScaleproperty of the axes to'log'. However, if the axesholdstate is'on'before you callsemilogx, the property does not change, and thex-coordinates might display on a linear scale.

Extended Capabilities

Version History

Introduced before R2006a

expand all