Start LaTex

Size

You can use: ultra thin , very thin , thin , semithick , thick , very thick and ultra thick
There is also the “help lines” option, “line width", "dashed" or "dotted"

Color

You have direct access to the following colors: red , green , blue , cyan, magenta , yellow , black , gray , darkgray , lightgray ,brown , lime , olive , orange , pink , purple , teal , violet and white . And you can define all the colors you might want — see the manual.

Shape

Common

draw [<->, rounded corners, thick, purple] (0,2) -- (0,0) -- (3,0); % There are rounded corners at the intersection

draw [blue] (0,0) rectangle (1.5,1);   % width hight

draw [red, ultra thick] (3,0.5) circle [radius=0.5];

two convenient ways to representing Arc
draw [gray] (6,0) arc [radius=1, start angle=45, end angle= 120]; % count from left, The arc is of radius 1, starts at the point (6,0) leaving it at an angle of 45 degrees and stops when its slope is 120 degrees  
draw[very thick] (0,0) to [out=90,in=195] (2,1.5);
% count degree from right 
draw [<->,thick, cyan] (0,0) to [out=90,in=180] (1,1)
to [out=0,in=180] (2.5,0) to [out=0,in=-135] (4,1) ;

Function

draw [<->] (0,0.8) -- (0,0) -- (0.5,0);
draw[green, ultra thick, domain=0:0.5] plot (x, {0.025+x+x*x});

egin{tikzpicture}[yscale=1.5]
draw [help lines, <->] (0,0) -- (6.5,0);
draw [help lines, ->] (0,-1.1) -- (0,1.1);
draw [green,domain=0:2*pi] plot (x, {(sin(x r)* ln(x+1))/2});
draw [red,domain=0:pi] plot (x, {sin(x r)});
draw [blue, domain=pi:2*pi] plot (x, {cos(x r)*exp(x/exp(2*pi))});

The domain instruction shows the range of x which is plotted

Type

Many mathematical functions are possible; you will probably have enough
with factorial(x), sqrt(x), pow(x,y) (which gives y power of x), exp(x), ln(x),log10(x), log2(x), abs(x) (the absolute value of x), mod(x,y) (x modulo y),

round(x) (rounds x to the nearest integer), floor(x) (the largest integer smaller than x), ceil(x) (the smallest integer larger than x),

sin(x) (sin(x), it assumes that x is in degrees; if x is expressed in radians use sin(x r)),

cos(x) (cos(x), it assumes that x is in degrees; if x is expressed in radians use cos(x r)),

tan(x) (tan(x), it assumes that x is in degrees; if x is expressed in radians use tan(x r)),

min(x,y,), max(x,y). You can even use rnd (without argument) which yields a random number between 0 and 1.

Fill

draw [ultra thick] (0,0) to [out=87,in=150] (1,1) -- (.85,.15) -- (0,0);
draw [ultra thick, fill=purple] (2,0) to [out=87,in=150] (3,1) -- (2.85,.15) -- (2,0);
path [fill=purple] (4,0) to [out=87,in=150] (5,1) -- (4.85,.15) -- (4,0);   % have no outline

Label

You can choose "below", "above", "left", "right", "below right", "above left", "below left", "above right"


ode at (1,1) {yes};

axis

draw [thick, <->] (0,1) -- (0,0) -- (1,0);

ode [below right] at (1,0) {$x$};

ode [left] at (0,1) {$y$};
draw[fill] (.4,.6) circle [radius=.5pt];

ode[above right] (.4,.6) {$A$}

equal to 

draw [thick, <->] (0,1) node [left] {$y$}
-- (0,0) -- (1,0) node [below right] {$x$};
draw[fill] (.4,.6) circle [radius=.5pt]
node[above right] (.4,.6) {$A$};

aline
draw [thick] (0,0) -- (9,0);
draw (0,-.2) -- (0, .2);
draw (3,-.2) -- (3, .2);
draw (6,-.2) -- (6, .2);
draw (9,-.2) -- (9, .2);

ode[align=left, below] at (1.5,-.5)%
{This happens\in period 1\and is aligned\ left};

ode[align=center, below] at (4.5,-.5)%
{This happens\in period 2\and is centered};

ode[align=right, below] at (7.5,-.5)%
{This happens\in period 2\and is right\aligned};

Beamer

With uncover the lines are “drawn” on
all the slides but made invisible when not called for. With only the lines are only drawn when called for

egin{frame}
a few lines
egin{center}
egin{tikzpicture}
draw [blue, ultra thick] (-1,2) -- (6,3);
uncover<1>{draw [green,thick] (-4,3) -- (2,2.5);}
uncover<2>{draw [red,thick] (0,0) -- (0,5);}
end{tikzpicture}
end{center}
and something under.
end{frame}

Example

\means new line, $means math symbol

egin{tikzpicture}[xscale=8]
draw[-][draw=red, very thick] (0,0) -- (.5,0);
draw[-][draw=green, very thick] (.5,0) -- (1,0);
draw [thick] (0,-.1) node[below]{0} -- (0,0.1);
draw [thick] (0.5,-.1) node[below]{$a=b=1/2$} -- (0.5,0.1);
draw [thick] (1,-.1) node[below]{1} -- (1,0.1);
end{tikzpicture}
egin{tikzpicture}
draw [help lines] (0,0) grid (5,5);
draw [<->] (5,0) -- (0,0) -- (0,5);
draw (4,0) -- (0,4);
draw[dashed,ultra thick]
(1.5,3.5) to [out=-80,in=135] (2.5,1.5);
draw [dashed,ultra thick]
(2.5,1.5) to [out=-45,in=160] (4.2,0.5);
end{tikzpicture}
原文地址:https://www.cnblogs.com/icodeworld/p/11372642.html