pgfplot 从轴更改标签

pgfplot 从轴更改标签

我用 tikz 创建了这个情节

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}

\begin{document}
 \begin{tikzpicture}[scale=0.9]
     \begin{axis}[
    xlabel=$\alpha$,
    ylabel=$\beta$]
    \addplot[smooth,mark=*,blue] plot coordinates {
(190.728393646,196.570620518) (160.02707719,175.430559421) (164.125220206,182.103291039) (176.15829007,177.090660212) (187.341046916,176.087180673) (193.821169011,174.354254307) (176.904045293,197.933268209) (181.069040516,169.025260202) 
    };
     \addplot[smooth,mark=*,red] plot coordinates {
    (190.728393646,196.570620518) (180.588633071,193.390056336) (183.404873834,179.52351824) (173.721786053,184.741768818) (174.727003532,170.598902591) (190.579518039,183.334835567) (193.020394587,189.098640907) (176.298883572,184.158520273) 
    };
    \end{axis}

            \end{tikzpicture} 
\end{document}

我想更改轴的标签。我宁愿使用 190° 而不是 190 度,等等。有没有简单的方法可以实现这一点?

答案1

添加选项

xticklabel={$\pgfmathprintnumber{\tick}^\circ$},
yticklabel={$\pgfmathprintnumber{\tick}^\circ$}

到你的轴环境会导致:

在此处输入图片描述

相关内容