سلام
با تشکر از پاسخ جناب دکتر وفا و مسعود یزدانی
برای آشنایی با دستورات این روش را قرار دادم.
روش اول) بصورت زیر:
\documentclass[a4paper,12pt]{report}
\usepackage{tikz,amsmath,color}
\usepackage{xepersian}
\settextfont{Yas}
\setdigitfont{Yas}
\begin{document}
\begin{center}
\begin{tikzpicture}[>=latex]
\draw [thick,->](-4.5,0)--(3.5,0);
\draw[->] (0,-1)--(0,2);
\foreach \x/\xtext in {-4,...,-1,1,2,3}
\draw (\x,-.4) node{$\xtext$};
\foreach \x in {-3,-2,...,3}
\draw [blue](\x,1) circle (0.05cm);
\foreach \x in {-4,-3,...,2}
\draw [fill=blue](\x,0) circle (0.05cm);
\foreach \x in {-3,-2,...,2}
\draw [dashed,blue](\x,0)--(\x,1);
\foreach \x in {-4,-3,...,2}
\draw [blue] (\x,0)--(\x+.97,.97);
\node at (0,2.2) {$y=x-[x]$};
\end{tikzpicture}
\end{center}
\end{document}
خروجی:
ویرایش:
روش 2) رسم با GeoGebra
\documentclass[12pt,a4paper]{report}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\begin{document}
\definecolor{ffffff}{rgb}{1.,1.,1.}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\draw[->,color=black] (-3.5,0.) -- (4.,0.);
\foreach \x in {-3,-2,-1,1,2,3}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] { $\x$};
\draw[->,color=black] (0.,-1.) -- (0.,2.);
\foreach \y in {1}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\y$};
\draw[color=black] (0pt,-10pt) node[right] {\footnotesize $0$};
\draw (0.,-1.) -- (0.,2.);
\draw [red](-3.,0.)-- (-2.,1.);
\draw [red](-2.,0.)-- (-1.,1.);
\draw [red](-1.,0.)-- (0.,1.);
\draw [red](0.,0.)-- (1.,1.);
\draw [red](1.,0.)-- (2.,1.);
\draw [red](2.,0.)-- (3.,1.);
\draw [dash pattern=on 1pt off 1pt,red] (-2.,0) -- (-2.,1.);
\draw [dash pattern=on 1pt off 1pt,red] (-1.,0) -- (-1.,1.);
\draw [dash pattern=on 1pt off 1pt,red] (0.,0) -- (0.,1.);
\draw [dash pattern=on 1pt off 1pt,red] (1.,0.) -- (1.,1.);
\draw [dash pattern=on 1pt off 1pt,red] (2.,0.) -- (2.,1.);
\begin{scriptsize}
\draw [red,fill=red] (-1.,0.) circle (2.5pt);
\draw [red,fill=ffffff] (0.,1.) circle (2.5pt);
\draw [red,fill=red] (0.,0.) circle (2.5pt);
\draw [red,fill=ffffff] (1.,1.) circle (2.5pt);
\draw [red,fill=red] (1.,0.) circle (2.5pt);
\draw [red,fill=ffffff] (2.,1.) circle (2.5pt);
\draw [red,fill=red] (2.,0.) circle (2.5pt);
\draw [red,fill=ffffff] (3.,1.) circle (2.5pt);
\draw [red,fill=red] (-2.,0.) circle (2.5pt);
\draw [red,fill=ffffff] (-1.,1.) circle (2.5pt);
\draw [red,fill=red] (-3.,0.) circle (2.5pt);
\draw [red,fill=ffffff] (-2.,1.) circle (2.5pt);
\end{scriptsize}
\end{tikzpicture}
\end{document}
خروجی:
مثال: نمودار تابع y=[x]
در آدرس زیر:
http://tex.stackexchange.com/questions/118406
ویرایش: 95/02/22
روش 3)
\documentclass[12pt,a4paper]{report}
\usepackage{tikz}
\begin{document}
\begin{center}
\begin{tikzpicture}[>=latex]
\draw[step=1cm,gray,very thin] (-2,-1) grid (5,2);
\draw[red,very thick,domain=-2:5,samples=1000] plot (\x,{\x-floor(\x)});
\draw [thick,->] (-2,0)-- (5,0);
\draw [thin,->](0,-1) --(0,2);
\end{tikzpicture}
\end{center}
\end{document}
خروجی: