- type this following latex code in Latex editor for drawing a number line:
%!TEX TS-program=pdflatex
%!TEX encoding=UTF-8 Unicode
%Plotting inequalities on a number line
%* Using Relative Coordinates
\documentclass[12pt]{article}
\usepackage[left=0.1cm,right=0.1cm,top=0.5cm,bottom=0.5cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}
%draw axes line
\draw[latex-,thick] (-1,0) -- (9,0) ;
\draw[-latex,thick] (-1,0) -- (9,0) ;
%edit here for vertical lines
\foreach \x in {0,1,2,3,4,5,6,7,8} \draw[shift={(\x,0)},color=black] (0pt,3pt) -- (0pt,-3pt);
%edit here for number labels
\foreach \x in {0,1,2,3,4,5,6,7,8} \draw[shift={(\x,0)},color=black] (0pt,0pt) -- (0pt,-3pt) node[below] {$\mathbf{\x}$};
%draw a node in number
\draw[o-*] (2.9223,0) -- (5.075,0);
%edit to sharpen the intersection line of axes
\draw[ultra thick] (2.98,0) -- (5.02,0);
%draw x <= 5 line
\draw [red, thick, -stealth] (5,0) -- ++(0,0.6) -- ++(-5,0);
%draw x >= 3 line
\draw [blue, thick, -stealth] (3,0) -- ++(0,0.4) -- ++( 4,0);
\end{tikzpicture}
\end{document} - Save file as plotInequal1a.tex.
- Typeset or Build.
Output
Notes
To see the more clear screenshot, click on the picture.
< previous Number Line In Latex 2
<< back to Study About Draw In Latex 2
Tidak ada komentar:
Posting Komentar