[Tex/LaTex] How to draw the graph of the floor function floor(x/2)?


Im confused as to how to draw some values because they take the same spot.

For example:


How do i draw it when the values are the same? I am unable to draw the circle in one end because there is another value starting at that point.

Best Answer

As the PostScript language has a floor function, it's easy with pst-plot:

\usepackage[pdf, svgnames]{pstricks}%
\def\myfunc{x 2 div floor}


\psset{plotpoints=100, labelFontSize=\textstyle, ticksize=-2pt 2pt}
\psset{linecolor=VioletRed, arrows = *->}
\multido{\i =-6 + 2, \I = -4 + 1,\n = -4.01 + 2.00}{6}{%
{\psline[linestyle=dashed, linecolor=black, linewidth=0.4pt, arrows=-](\i,\numexpr\i/2-1\relax)(\i, 0)}%
{\psline[linestyle=dashed, linecolor=black, linewidth=0.4pt, arrows=-](\i,\numexpr\i/2\relax)(\i, 0)}%


enter image description here

Related Question