تمنای طلوع

به تمنای طلوع تو جهان چشم به راه...

تمنای طلوع

به تمنای طلوع تو جهان چشم به راه...

دنبال کنندگان ۳ نفر
این وبلاگ را دنبال کنید
طبقه بندی موضوعی

LineSpec (Line Specification) in Matlab

تنظیمات مربوط به خطوط در دستور پلات (یا هر دستور دیگری) در مطلب در ادامه مطلب ...

Description

Plotting functions accept line specifications as arguments and modify the graph generated accordingly. You can specify these three components:

  • Line style

  • Marker symbol

  • Color

For example:

plot(x,y,'-.or')

plots y versus x using a dash-dot line (-.), places circular markers (o) at the data points, and colors both line and marker red (r). Specify the components (in any order) as a character vector after the data arguments. Note that linespecs are not name-value pairs.

Plotting Data Points with No Line

If you specify a marker, but not a line style, only the markers are plotted. For example:

plot(x,y,'d')

Line Style Specifiers

You indicate the line styles, marker types, and colors you want to display, detailed in the following tables:

Specifier LineStyle
'-'

Solid line (default)

'--'

Dashed line

':'

Dotted line

'-.'

Dash-dot line

Marker Specifiers

Specifier

Marker Type

'+'

Plus sign

'o'

Circle

'*'

Asterisk

'.'

Point

'x'

Cross

'square' or 's'

Square

'diamond' or 'd'

Diamond

'^'

Upward-pointing triangle

'v'

Downward-pointing triangle

'>'

Right-pointing triangle

'<'

Left-pointing triangle

'pentagram' or 'p'

Five-pointed star (pentagram)

'hexagram' or 'h'

Six-pointed star (hexagram)

Color Specifiers

Specifier

Color

r

Red

g

Green

b

Blue

c

Cyan

m

Magenta

y

Yellow

k

Black

w

White

Related Properties

This page also describes how to specify the properties of lines used for plotting. MATLAB® graphics give you control over these visual characteristics:

  • LineWidth — Specifies the width (in points) of the line.

  • MarkerEdgeColor — Specifies the color of the marker or the edge color for filled markers (circle, square, diamond, pentagram, hexagram, and the four triangles).

  • MarkerFaceColor — Specifies the color of the face of filled markers.

  • MarkerSize — Specifies the size of the marker in points (must be greater than 0).

In addition, you can specify the LineStyleColor, and Marker properties instead of using a line specification character vector. This is useful if you want to specify a color that is not in the list by using RGB triplet values. See Chart Line Properties for details on these properties and ColorSpec for more information on color.

Examples

Plot the sine function over three different ranges using different line styles, colors, and markers.

figure
t = 0:pi/20:2*pi;
plot(t,sin(t),'-.r*')
hold on
plot(t,sin(t-pi/2),'--mo')
plot(t,sin(t-pi),':bs')
hold off

Create a plot illustrating how to set line properties:

figure
plot(t,sin(2*t),'-mo',...
                'LineWidth',2,...
                'MarkerEdgeColor','k',...
                'MarkerFaceColor',[.49 1 .63],...
                'MarkerSize',10)

  • علیرضا منتظر

نظرات  (۰)

هیچ نظری هنوز ثبت نشده است
ارسال نظر آزاد است، اما اگر قبلا در بیان ثبت نام کرده اید می توانید ابتدا وارد شوید.
شما میتوانید از این تگهای html استفاده کنید:
<b> یا <strong>، <em> یا <i>، <u>، <strike> یا <s>، <sup>، <sub>، <blockquote>، <code>، <pre>، <hr>، <br>، <p>، <a href="" title="">، <span style="">، <div align="">
تجدید کد امنیتی