Tag Info

30

Okay, here’s what I came up with. It isn’t in the “spirit” of the question, since I haven’t used any of TikZ’s polar coordinate features: instead, I just drew the grid on by hand and with some basic loops. This is the code I used, with some hopefully self-explanatory comments: \documentclass{article} \usepackage{tikz} \begin{document} \begin{...

29

A try in pgfplots in case you ever decide to learn/use it. :-) In this case, much of the code is setting up the styling to match your example. This could be stored as a style defined once in your document, as I have done, and used for consistent style for all plots. There is surely a better way to draw the double line at the outer edge. I tried lots of ...

19

You can transform the polar coordinates to cartesian using an x filter and a y filter. If you wrap those in a style like this: \pgfplotsset{ interpret as polar/.style={ x filter/.code=\pgfmathparse{cos(rawx)*rawy}, y filter/.code=\pgfmathparse{sin(rawx)*rawy} } } you can just add interpret as polar to your \addplot ...

15

Late to the party but another opportunity of nonlinear transformations and pretty printing radians for me. I stole the plotted function from alexwlchan's answer. \documentclass[tikz]{standalone} \usetikzlibrary{fpu} \usepgfmodule{nonlineartransformations} \makeatletter \def\polartransformation{\pgfmathsincos@{\pgf@x}\pgf@x=\pgfmathresultx\pgf@y\pgf@y=\...

13

You could use intersection segments: \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.15}% <- added!! \usepgfplotslibrary{fillbetween}% <- changed \begin{document} \begin{tikzpicture} \begin{axis}[grid = both, set layers% <- added ] % Outer curve \addplot [data cs=polar, domain=0:360, samples=180, black, line ...

12

You can tell pgfplots that the input is actually given in polar coordinates using data cs=polar. Pgfplots will automatically transform it to the output coordinate system: \documentclass{standalone} \usepackage{pgfplots} \usepackage{tikz} \begin{document} \begin{tikzpicture} \begin{axis}[ axis lines=center, axis equal image, enlargelimits=true, ...

12

With PSTricks, the following is too short for typing exercise. \documentclass[border=12pt,pstricks]{standalone} \usepackage{pst-plot} \def\r{2*(1-sin(x))} \begin{document} \begin{pspicture}[algebraic,plotpoints=100,polarplot](-5.5,-5.5)(5.5,5.5) \psaxes[axesstyle=polar,subticklinestyle=dashed](5,0) \pscustom*[linecolor=orange,opacity=.75]{\psplot{...

12

Yes, it can be done in TikZ. I enclose my try. %! *latex mal-polar.tex \documentclass[a4paper]{article} \pagestyle{empty} \usepackage{tikz} \begin{document} \begin{tikzpicture}[>=latex] \fill[fill=lightgray] plot[domain=-pi/2:pi/2] (xy polar cs:angle=\x r,radius= {2-2*sin(\x r)}); \draw[thick, color=red, domain=0:2*pi, samples=200,smooth] plot (xy polar ...

11

Not hard to do in Metapost... prologues := 3; outputtemplate := "%j%c.eps"; beginfig(1); s = 1cm; path f; f = (for t = 0 upto 359: (cosd(t), sind(t)) scaled (2-2sind(t)) .. endfor cycle) scaled s; fill subpath(0,90) of f -- subpath(270,360) of f .. cycle withcolor .1 red + .7 white; for r = s/2 step s until 4s: draw fullcircle scaled 2r withcolor .8 ...

11

3D is really hard to achieve properly, I cheated too. I'm looking through Section 96 (pg. 978) of the manual that describes 3d polar systems. It has a latitude/longitude system defined, but the equator lies in the page -.- Until I figure out how to rotate the globe as given there, my solution: \documentclass[tikz,border=20pt]{standalone} \usetikzlibrary{...

9

You need to place the \foreach loop inside the frame and use overlay specifications for the \draw command (this will produce several slides inside a single frame, which then will give you the animation effect); something along these lines: \documentclass{beamer} \usepackage{tikz} \tikzset{ invisible/.style={opacity=0,text opacity=0}, visible on/....

9

Without polar coordinates, this can easily be done as follows \documentclass[border={10}]{standalone} \usepackage{tikz} \begin{document} \def \f {1.0} \begin{tikzpicture} \foreach \a in {0, 30, ..., 350 } \draw ({\f*cos(\a)}, {\f*sin(\a)}) circle (0.2cm); \end{tikzpicture} \end{document} The result is

9

TikZ is inherently 2D. You can perhaps do something like the following, but on the other hand it might not be good enough for you. Note that I edited the image with Gimp to remove the white background, and saved it as a PNG with transparency: Output: \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{decorations.text} \begin{document} \begin{...

9

I have added this as a new answer since the approach is different from my previous work. 3D is possible and it is surprisingly easy. Well, it is still fake by any means (occlusion for example still depends on drawing order) but you can now place points on the canvas based on radius, phi and theta. The important word here is points: All arc or curve to ...

7

Another try with MetaPost. I chose a longer way than Thruston's before by implementing the possibility of drawing a more general polar grid, with arbitrary polar and radial boundaries, as shown in the first figure. The second figure being the desired image with standard polar grid. Transparency is supported by the MetaFun format of MetaPost, at the ...

7

The root cause is a bug in pgfplots: apparently, the ticklabel coordinate systems do not work as expected. This morning, I have managed to improve the polar library such that the default for pgfplots 1.13 will directly result in the label placement as in your screenshot. I will also simplify sloped tick labels and add some more fine tuning to it. For the ...

7

With polar coordinates this can also be done :) \draw (\a:1) circle (0.2cm); The syntax is (<angle>:<radius>). The output is % arara: pdflatex % !arara: indent: {overwrite: yes} \documentclass[border=3mm]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \foreach \a in {0, 30, ..., 350 } \draw (\a:1) circle (0.2cm); \end{...

7

There is no predefined thing. You have to convert it by hand. \documentclass{article} \usepackage{pgfplots} \usepgfplotslibrary{polar} \newcommand\subticks{0.30103,0.47712125,0.60205999,0.69897, 0.77815125,0.84509804,0.90308999,0.95424251, 1.30103,1.47712125,1.60205999,1.69897, 1.77815125,1.84509804,1.90308999,1.95424251, 2.30103,2.47712125,2....

6

Polar coordinates are by default relative to the origin, so when you simply write: \draw[dashed, gray, thick,->] (6,0) -- (170:2); you draw a line from (6,0) to the point which is at distance 2, angle 170 from the origin (0,0), as the following example demonstrates: \begin{tikzpicture} \fill[red] (0,0) circle(2pt); % Dot at origin \fill[...

6

Here's a partial try using TikZ's Data Visualization library (Part VI of the manual). I still haven't worked out how to do the fill. It's not clear whether development in this area of TikZ will continue, but I wanted to try it out. :-) \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{datavisualization,datavisualization.polar,datavisualization....

6

In the meantime, here is a solution with MetaPost. Since the syntax of Tikz and MetaPost have many similarities, it may help to provide the desired solution. The key point is to append the two spirals (one of them reverted), close the resulting path (--cycle instruction) and then fill it: fill spiral1--reverse spiral2--cycle withcolor .8white; I have ...

6

I did manage to get the tikz code working. Below is the code. Thanks for the hints everyone. \documentclass[tikz,border=5pt]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.12} \usepgfplotslibrary{fillbetween} \usepgfplotslibrary{polar} \begin{document} \begin{tikzpicture}[scale=0.5] \begin{polaraxis}[hide axis] \begin{scope}[] ...

6

As @egreg suggests, you can plot your data in polar graphs. Say you want to plot r = sin(2a) where a is the angle and r is the magnitude, \documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots} \usetikzlibrary{pgfplots.polar} \begin{document} \begin{tikzpicture} \begin{polaraxis} \addplot+[mark=none,domain=0:360,samples=100] {...

6

as pure tikz picture: \documentclass[tikz, border=10pt]{standalone} \usetikzlibrary{backgrounds} \begin{document} \begin{tikzpicture} % axis \draw[->] (-3,0.0) -- (3.5,0) node[below left] {$x$}; \draw[->] (0,-0.5) -- (0.0,3) node[below left] {$y$}; \draw (-5:2) arc (-5:185:2); % ticks \foreach \angle in {90, 60, ...,-90} \draw (90+\...

6

This is a way that can be adjusted in colors and the "blur" by you: \documentclass{standalone} \usepackage{pgfplots} \usepackage{tikz} \pgfplotsset{compat=1.13} \usepgfplotslibrary{polar} \newlength\figureheight \newlength\figurewidth \definecolor{GPS_Color}{RGB}{0, 187, 0} \definecolor{GLO_Color}{RGB}{196, 163, 0} \definecolor{GAL_Color}{RGB}{0, 140, ...

6

Since you know the coordinates, just use fill. \fill[blue,opacity=0.4] (o) -- (a) -- (b); Note that I have the named the coordinates. See the full code: \documentclass[border=5pt]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ smooth, trig format plots=rad, axis lines=middle, axis equal] \addplot [...

5

You have to explicitly multiply the 4 and the \x r using *, otherwise you're just concatenating the strings: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw[domain=0:2*pi, samples=100, smooth] plot (xy polar cs:angle=\x r,radius={2 -sin(4*\x r)}); \end{tikzpicture} \end{document}

5

You can transform the coordinates into the positive domain using y coord trafo/.code=\pgfmathparse{#1+10} and correct the tick labels by setting y coord inv trafo/.code=\pgfmathparse{#1-10}: \documentclass[10pt,border=10pt]{standalone} \usepackage{pgfplots} \usepgfplotslibrary{polar} \begin{document} \begin{tikzpicture} \begin{polaraxis}[ xticklabel=\$\...

Only top voted, non community-wiki answers of a minimum length are eligible