# obtaining an image in Pstricks

How do I draw this image in PStricks:

I know to draw the axis but not sure how to name the points and all.

• Is TikZ, Metapost and Asymptote allowed for drawing? Have you tried to draw it by yourself? If you have, please post your code as a starting point for others. – Malipivo Apr 5 '15 at 13:26
• @Malipivo I dont know tikz metapost and all. So its better that i get a pstricks command. – crskhr Apr 5 '15 at 15:24

Here is a code in psTricks:

 \documentclass[pdf, x11names, dvipsnames]{article}%

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc }
\usepackage{fourier}
\usepackage{nccmath}
\newpsobject{bluedot}{psdot}{linecolor=RoyalBlue3, dotsize=4pt}

\begin{document}

\psset{llx=-5mm,lly=-5mm,urx=5mm,ury=5mm, arrowinset=0, %
psgrid, gridwidth=0.6pt, gridcolor=RoyalBlue3, griddots=10, subgriddiv=1}%

\begin{pspicture*}(-1.5,-1.5)(9.6,8.5)
\psaxes[labels=none, ticks=none](0,0)(-1.5,-1.5)(9.6,8.5)
\psgrid[gridlabels = 8pt](0,0)(-1.5,-1.5)(9.6,8.5)
\multido{\i=-1 + 1}{11}{\multido{\I=-1 + 1}{10}{\bluedot(\i, \I)}}
\psline[linestyle = dashed, linewidth=0.4pt]{*-*}(0,6.5)(8.5,6.5)(8.5,0)
\bluedot(0,6.5)\bluedot(8.5,0)\uput[l](0,6.5){$\bigl (0,\mfrac q2\bigr)$}\uput{0.3}[d](8.5,0){$\bigl (\mfrac p2,0\bigr)$}
\dotnodes(0,0){O}(8.5,6.5){A}
\ncline{O}{A}\naput[npos=0.325, nrot=:U, labelsep=2pt]{$y = \mfrac qp x$}
\uput[r](A){$\bigl (\mfrac p2,\mfrac q2\bigr)$}\uput{0.33}[-120](O){$(0,0)$}
\psline{<->}(6.25,0.04)(6.25,3.96)
\bluedot(6.25,4)\bluedot(6.25,0)\rput[bl](6.25,4){$\bigl(k, \mfrac qp k\bigr)$}\uput{0.4}[d](6.25,0){$(k, 0)$}
\rput(2.5,4.5){\Large\bfseries\sffamily A}
\rput(4.5,1.5){\Large\bfseries\sffamily B}
\multido{\i = 1 + 1}{4}{\psdot(6,\i)}
\end{pspicture*}

\end{document}