Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to draw a diagram , which contains repeated lines for that i would like to use a new command. what would be the best command? any suggestions?

That diagram is this and not to worry about the grid lines Repeated lines

share|improve this question
3  
It is impossible to say without your minimal code. Please, explain better what you want and what you'd tried. –  Sigur Dec 23 '13 at 15:07
3  
Welcome to TeX.SX. Questions about how to draw specific graphics that just post an image of the desired result or not even that are really not reasonable questions to ask on the site. Please post a minimal compilable document showing that you've tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. –  Tobi Dec 23 '13 at 15:12
    
\foreach \angle in {0,10,...,360}{\draw[blue](0,0)--(\angle:1cm) node[fill,circle,inner sep=2pt]{};} might be a starting point –  Claudio Fiandrino Dec 23 '13 at 15:20
2  
You need to be more specific. "That diagram may be like this" is very vague. What about the grid in the background? –  Werner Dec 23 '13 at 15:30

3 Answers 3

up vote 6 down vote accepted

The picture is from page 34 of the pstricks-add manual; the code (after being marginally improved) is as follows:

\documentclass{article}

\usepackage{pstricks-add}

\begin{document}

\psset{yunit = 4, xunit = 2}
\begin{pspicture}(-1,0)(3,2)
\psgrid[subgridcolor = lightgray]
\pnodes(-1,0){A}(1,1){B}
\psline[linecolor = red](A)(3,2)
\multido{\iA = 0+10}{36}{
  \psRelLine[linecolor = blue, angle = \iA](B)(A){-0.5}{EndNode}
  \qdisk(EndNode){2pt}
}
\end{pspicture}

\end{document}

output

share|improve this answer
    
+1 for recognizing the picture. –  Sigur Dec 23 '13 at 16:25

Via TiKZ draw. Use of foreach loop and scale the y axis.

enter image description here

Code

\documentclass{article} % or standalone
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[yscale=2]
\draw [help lines, xstep=0.2, ystep=0.4,thin] (-1,0.2) grid (3,2.8);
\foreach \angle in {0,10,...,360}{
\draw[blue](1,1.5)--+(\angle:1.5cm) node[fill=gray,circle,radius=2pt,inner sep=1pt]{};
}
\end{tikzpicture}
\end{document}
share|improve this answer

A recommended solution with PSTricks just for fun!

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-plot,pst-node}
\psset{algebraic,plotpoints=37}

\begin{document}


\begin{pspicture}[showgrid](-2,-2)(4,4)
\curvepnodes{0}{2 Pi mul}{1.5*cos(t)+1|2.5*sin(t)+1}{P}
\multido{\i=0+1}{\Pnodecount}{\psline{-*}(1,1)(P\i)}
\end{pspicture}

\end{document}

enter image description here

Animated version

This is the orbit of our earth around the sun.

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-plot,pst-node}
\psset{algebraic,plotpoints=37}

\begin{document}

\multido{\i=0+1}{36}{%
\begin{pspicture}[showgrid](-2,-2)(4,4)
\curvepnodes{0}{2 Pi mul}{1.5*cos(t)+1|2.5*sin(t)+1}{P}
\psline{-*}(1,1)(P\i)
\end{pspicture}}

\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.