I'm using sublime text 2 with skim, on Mac OSX 10.8.3.
I'm plotting microphone pick up patterns as follows:
\begin{tikzpicture} % p56
\begin{polaraxis} [ytick=\empty,legend entries={Omnidirectional,Figure-8,,Subcardioid,Cardioid,Supercardioid,,,,Hypercardioid,,,,},legend cell align=left,legend style={at={(1.7,0.5)},anchor=east}]
%Ominidirectional
\addplot[style=thick,domain=0:360, samples=100]{1};
%Figure 8 (Bidirectional)
\addplot[style=thick,color=blue,domain=0:180, samples=100]{cos(x)};
\addplot[style=thick,color=blue,domain=180:360, samples=100]{-cos(x)};
%subcardiod
\addplot[style=thick,color=green,domain=0:360, samples=100]{0.7 + 0.3*cos(x)};
%cardiod
\addplot[style=thick,color=brown,domain=0:360, samples=100]{0.5 + 0.5*cos(x)};
%Supercardioid
\addplot[style=thick,color=red,domain=0:126, samples=100]{0.37 + 0.63*cos(x)};
\addplot[style=thick,color=red,domain=126:234, samples=100]{-0.37 - 0.63*cos(x)};
\addplot[style=thick,color=red,domain=234:360, samples=100]{0.37 + 0.63*cos(x)};
%Hypercardioid
\addplot[style=thick,color=violet, domain=0:110, samples=100]{0.25 + 0.75*cos(x)};
\addplot[style=thick,color=violet,domain=110:250, samples=100]{-0.25 - 0.75*cos(x)};
\addplot[style=thick,color=violet,domain=250:360, samples=100]{0.25 + 0.75*cos(x)};
\end{polaraxis}
\end{tikzpicture}
This creates the correct polar plots, but the angles are without the degree symbol.
How can I add the degree symbol and also how can I remove the black radial line running from the centre horizontally to the right?
Best Answer
For printing the degree symbol in the tick labels, you can set
xticklabel=$\pgfmathprintnumber{\tick}^\circ$
(\pgfmathprintnumber
makes sure that the numbers are rounded nicely,\tick
contains the label value, and\circ
is the symbol).The horizontal black line is the y axis, which you can hide using the key
hide y axis
.Bonus hints: Instead of using empty legend entries, you can add
forget plot
to the helper plots. That way they won't get a legend entry. In your case, you don't even need the helper plots: You can let all plots run from 0 to 360 degrees, and useabs(<expr>)
instead of just<expr>
to get the same results.For line plots, you don't need to say
color=red
, you can just sayred
.Options that are common to all plots can be set using
every axis plot/.style={thick, samples=100, domain=0:360}
, which helps keep the code leaner and more maintainable.