LaTeX forum ⇒ Graphics, Figures & TablesA node on an exact coordinate Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
ehud
Posts: 3
Joined: Tue Jul 18, 2017 11:38 pm

A node on an exact coordinate

Postby ehud » Fri Aug 11, 2017 3:35 pm

I want my filldraw circle to be placed at coordinates (x,y)=(cos(30°), sin(30°)) - a point on the unit circle with angle 30°.
These are (actually) equivalent to (x,y)=(√3/2,1/2), or approximately (0.866,0.5).

So, how can I assign these coordinate as (cos(30°), sin(30°)) to my node, label, or any other object in my TikZ document, so that I am not working in the approximated regime?

  1. \documentclass[tikz,border=2mm]{standalone}
  2. \begin{document}
  3. \begin{tikzpicture}[scale=1]
  4. \draw [help lines] (-4,-4) grid (4,4);
  5. \filldraw [black] (0,0) circle [radius=2pt];
  6. \filldraw [black] (+0.866,-0.5) circle [radius=2pt]; %right
  7. \filldraw [black] (-0.866,-0.5) circle [radius=2pt]; %left
  8. \filldraw [black] (0,1) circle [radius=2pt]; %top
  9. \draw [blue, very thin] (0,0) circle [radius=1 cm];
  10. \end{tikzpicture}
  11. \end{document}

User avatar
thomasb
Posts: 54
Joined: Thu Aug 03, 2017 10:54 am
Location: france

Postby thomasb » Fri Aug 11, 2017 8:25 pm

Formulas seem to be for plot function only (section 3.9, page 11) : http://cremeronline.com/LaTeX/minimaltikz.pdf

(redit : Tikz doesn't have \frac{\pi}{2} (section 2.12, page 32) : http://www.texample.net/media/pgf/builds/pgfmanualCVS2012-11-04.pdf)

rais
Posts: 138
Joined: Sun Nov 16, 2014 8:51 pm

Postby rais » Sat Aug 12, 2017 8:46 am

ehud wrote:I want my filldraw circle to be placed at coordinates (x,y)=(cos(30°), sin(30°)) - a point on the unit circle with angle 30°.
These are (actually) equivalent to (x,y)=(√3/2,1/2), or approximately (0.866,0.5).

So, how can I assign these coordinate as (cos(30°), sin(30°)) to my node, label, or any other object in my TikZ document, so that I am not working in the approximated regime?

you could use polar coordinates, see `texdoc pgfmanual', section (2.15) Specifying Coordinates.
  1. \documentclass[tikz,border=2mm]{standalone}
  2. \begin{document}
  3. \begin{tikzpicture}[scale=1]
  4. \draw [help lines] (-4,-4) grid (4,4);
  5. \filldraw [black] (0,0) circle [radius=2pt];
  6. \filldraw [black] (+0.866,-0.5) circle [radius=2pt]; %right
  7. \filldraw [black] (-0.866,-0.5) circle [radius=2pt]; %left
  8. \filldraw [black] (0,1) circle [radius=2pt]; %top
  9. \filldraw [red] (30:1) circle [radius=2pt]; % top right
  10. \filldraw [red] (150:1) circle [radius=2pt]; % top left
  11. \filldraw [red] (270:1) circle [radius=2pt]; % bottom
  12. \draw [blue, very thin] (0,0) circle [radius=1 cm];
  13. \end{tikzpicture}
  14. \end{document}

KR
Rainer

ehud
Posts: 3
Joined: Tue Jul 18, 2017 11:38 pm

Postby ehud » Sat Aug 12, 2017 9:02 pm

@rais - Thank you. It works.


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 10 guests