我是乳胶开发的新手,我发现了这个代码可以制作度盘:
\documentclass[tikz, margin=5mm]{standalone}
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=newest}
\usepackage{eurosym} % écriture du €
\usetikzlibrary{arrows.meta}
%\usepackage{pgf-pie}
\begin{document}
% Define a few constants for easy configuration
\def\radius{2cm}
\def\onedegrad{1.8cm}
\def\fivedegrad{1.75cm}
\def\tendegrad{1.7cm}
\def\labelrad{1.6cm}
\begin{tikzpicture}[scale=4]
% adding a subtle gray tone to add a bit of "personality"
\shade[shading=radial, inner color=white, outer color=gray!15] (0,0) circle (\radius);
\draw (0,0) circle (\radius);
\draw[fill=black] (0,0) circle (.02mm);
\node[draw, circle, inner sep=.2mm] (a) at (0,0) {};
% helper lines
%\foreach \x in {-16, 90} \draw[very thick, gray!40] (a) -- (\x:\radius);
% main lines
\foreach \x in {0,...,359} \draw (\x:\onedegrad) -- (\x:\radius);
% labels and longer lines at every 10 degrees
\foreach \x in {0,10,...,350}
{
\node[scale=1.4, rotate=\x*-1] at (360-\x+90:\labelrad) {\x};
\draw (\x:\tendegrad) -- (\x:\radius);
};
% lines at every 5 degrees
\foreach \x in {0,5,...,355} \draw (\x:\fivedegrad) -- (\x:\radius);
\end{tikzpicture}
\end{document}
我只是在更改标签方向时遇到了一些麻烦:我想将其设置为逆时针方向!我有这而且我要这。 任何想法?
谢谢
iOS 10.15.4
MacTeX 2020 发行版
与 texmaker 合作
答案1
@beardedIntern
\documentclass[tikz, margin=5mm]{standalone}
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=newest}
\usepackage{eurosym} % écriture du €
\usetikzlibrary{arrows.meta}
%\usepackage{pgf-pie}
\begin{document}
% Define a few constants for easy configuration
\def\radius{2cm}
\def\onedegrad{1.8cm}
\def\fivedegrad{1.75cm}
\def\tendegrad{1.7cm}
\def\labelrad{1.6cm}
\begin{tikzpicture}[scale=4]
% adding a subtle gray tone to add a bit of "personality"
\shade[shading=radial, inner color=white, outer color=gray!15] (0,0) circle (\radius);
\draw (0,0) circle (\radius);
\draw[fill=black] (0,0) circle (.02mm);
\node[draw, circle, inner sep=.2mm] (a) at (0,0) {};
% helper lines
%\foreach \x in {-16, 90} \draw[very thick, gray!40] (a) -- (\x:\radius);
% main lines
\foreach \x in {0,...,359} \draw (\x:\onedegrad) -- (\x:\radius);
% labels and longer lines at every 10 degrees
\foreach \x in {0,10,...,350}
{
\node[scale=1.4, rotate=0] at (\x:\labelrad) {\x};
\draw (\x:\tendegrad) -- (\x:\radius);
};
% lines at every 5 degrees
\foreach \x in {0,5,...,355} \draw (\x:\fivedegrad) -- (\x:\radius);
\end{tikzpicture}
\end{document}