
Ich möchte ein Polardiagramm in dB-Skalierung zeichnen, in diesem Fall habe ich positive und negative Werte. Normalerweise wird ein negativer Radius in die entgegengesetzte Richtung gezeichnet, aber mit Hilfe vonTransformieren der KoordinatenIch bekomme das gewünschte Ergebnis.
Aber jetzt gibt es das Problem, dass die negativen und positiven Striche nicht perfekt ausgerichtet sind. Ich habe versuchtein Hinweisaber dadurch wird der Versatz nur ein wenig korrigiert. Dies könnte daran liegen, dass die Lösung für ein Problem mit rotierenden Ticks gegeben wurde.
Wie kann ich die Teilstriche auf der Radiusachse richtig ausrichten?
\documentclass{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\begin{document}
\begin{tikzpicture}
\begin{polaraxis}[%
xtick={0,30,...,180},
ymin=-25,
ymax=10,
xmax=180,
y coord trafo/.code=\pgfmathparse{#1+25},
y coord inv trafo/.code=\pgfmathparse{#1-25},
xticklabel=$\pgfmathprintnumber{\tick}^\circ$,
yticklabel style={yshift=-0.5cm},
],
\addplot[%
]
coordinates{%
(0,-15)
(30,-5)
(90,0)
(120,5)
};
\end{polaraxis}
\end{tikzpicture}
\end{document}
Antwort1
Wie bereits erwähntim Kommentar unter der Frage, die TeilstrichbeschriftungenSindperfekt ausgerichtet. Weitere Einzelheiten finden Sie in den Kommentaren im Code.
\documentclass{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\begin{document}
\begin{tikzpicture}
\begin{polaraxis}[
ymin=-25,
ymax=10,
xmax=180,
% when you have at PGFPlots v1.13 you can use the `xtick distance' feature
% xtick={0,30,...,180},
xtick distance=30,
y coord trafo/.code=\pgfmathparse{#1+25},
y coord inv trafo/.code=\pgfmathparse{#1-25},
xticklabel=$\pgfmathprintnumber{\tick}^\circ$,
yticklabel style={
% draw a frame around the tick labels to see, that they are
% indeed centered
draw=red,
% (and use there is a better way to position the tick labels
% on the other side of the axis ...)
% yshift=-0.5cm,
anchor=near yticklabel opposite,
},
],
\addplot coordinates {
(0,-15) (30,-5) (90,0) (120,5)
};
\end{polaraxis}
\end{tikzpicture}
\end{document}