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.

Why there are different units used for rectangular and polar coordinates?

\begin{tikzpicture}[scale=2]
\draw[->] (-1,0) -- (1,0);
\draw[->] (0,-1) -- (0,1);
\draw node [red] at (-1,.25) {\scriptsize{Kardioida $r=5-5\sin \theta$}};
\draw[color=red,domain=0:6.28,samples=200,smooth] plot (canvas polar cs:angle=\x r,radius=      {5-5*sin(\x r)});    %r = angle en radian
\end{tikzpicture} 
share|improve this question

2 Answers 2

up vote 13 down vote accepted

When you use canvas polar cs, the radius is taken to be in TeX points and 5pt is not very big. To get the plot in the "natural" coordinates, use the xy polar syntax or use the implicit form, (<angle>:<radius>). What is perhaps a bit confusing about the implicit form is that it is a shorthand for both canvas polar cs and for xy polar cs. The rule is that if you supply an explicit length, it is canvas, but if you don't then it is xy.

Thus the lower two examples produce something that is on the right scale (I shrank the size to get it to fit on the page):

\documentclass{article}
%\url{http://tex.stackexchange.com/q/65446/86}

\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[scale=2]
\draw[->] (-1,0) -- (1,0);
\draw[->] (0,-1) -- (0,1);
\draw node [red] at (-1,.25) {\scriptsize{Kardioida $r=5-5\sin
\theta$}};
\draw[color=red,domain=0:6.28,samples=200,smooth] plot (canvas polar
cs:angle=\x r,radius=      {5-5*sin(\x r)});    %r = angle en radian
\end{tikzpicture}

\begin{tikzpicture}[scale=2]
\draw[->] (-1,0) -- (1,0);
\draw[->] (0,-1) -- (0,1);
\draw node [red] at (-1,.25) {\scriptsize{Kardioida $r=5-5\sin
\theta$}};
\draw[color=red,domain=0:6.28,samples=200,smooth] plot (canvas polar
cs:angle=\x r,radius=      {.5cm-.5cm*sin(\x r)});    %r = angle en
radian
\end{tikzpicture}

\begin{tikzpicture}[scale=2]
\draw[->] (-1,0) -- (1,0);
\draw[->] (0,-1) -- (0,1);
\draw node [red] at (-1,.25) {\scriptsize{Kardioida $r=5-5\sin
\theta$}};
\draw[color=red,domain=0:6.28,samples=200,smooth] plot (xy polar
cs:angle=\x r,radius=      {.5-.5*sin(\x r)});    %r = angle en radian
\end{tikzpicture} 
\end{document}
share|improve this answer
    
Aha, thank you. This should do it. –  Tony Aug 1 '12 at 10:36

In PSTricks, we can use \psset{runit=1.2cm,unit=\psrunit} to change the radial unit and rectangular unit. In this example, I made all equal.

enter image description here

\documentclass[border=12pt,pstricks]{standalone}

\usepackage{pst-plot}

\psset{runit=1.2cm,unit=\psrunit}

\begin{document}
\begin{pspicture}(-3.5,-3.5)(3.5,3.5)
\psaxes[axesstyle=polar,subticklinestyle=dashed,subticks=2,labelFontSize=\scriptstyle](3,3)
\psplot[polarplot,algebraic=true,linecolor=red,linewidth=2pt,plotpoints=2000]{0}{TwoPi}{1.5-1.5*sin(3*x)}
\end{pspicture}
\end{document}

Edit:

An animation might help us to choose a good constant for the function.

enter image description here

\documentclass[border=12pt,pstricks]{standalone}

\usepackage{pstricks-add}

\psset{runit=1cm,unit=\psrunit}

\begin{document}
\multido{\i=1+1}{10}{%
\begin{pspicture}(-3.5,-3.5)(3.5,3.5)
\psaxes[axesstyle=polar,subticklinestyle=dashed,subticks=2,labelFontSize=\scriptstyle](3,3)
\psplot[polarplot,algebraic,linecolor=red,linewidth=2pt,plotpoints=2000]{0}{TwoPi}{1.5-1.5*sin(\i*x)}
\rput(0,-3.5){\scriptsize Kardioida \ifnum\i=1\relax$r=1.5-1.5\sin \theta$\else$r=1.5-1.5\sin(\i \theta)$\fi}
\end{pspicture}}
\end{document}
share|improve this answer
    
Great! This is quite nice. Thank you. –  Tony Aug 1 '12 at 10:39

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.