![如何使节点上的标签变小(pgfplots)](https://linux22.com/image/428821/%E5%A6%82%E4%BD%95%E4%BD%BF%E8%8A%82%E7%82%B9%E4%B8%8A%E7%9A%84%E6%A0%87%E7%AD%BE%E5%8F%98%E5%B0%8F%EF%BC%88pgfplots%EF%BC%89.png)
我想让图表中的节点(如下图)具有较小的标签(即较小的字体),因为目前我的图表在编译时会使所有节点相互碰撞。我该怎么做?
\begin{figure}[H]
\centering
\begin{tikzpicture}
\begin{axis}[grid=both,
xmin=-1, xmax=2,ymin=-2, ymax=2,
axis lines=middle,
enlargelimits]
\addplot[black] (2,0) node[above] {$dx$};
\addplot[black] (0,2.2) node[below right] {$df$};
\addplot[blue,samples=1000,domain=0:15] {0.7-0.7*x^2-0.5*sin(180*10*x/pi)};
\node[label={135:{(0.0,0)}}, circle, fill, inner sep = 1pt] at (axis cs:0.0,0) {};
\node[label={135:{(0.285,0)}}, circle, fill, inner sep = 1pt] at (axis cs:0.285,0) {};
\node[label={135:{(0.66,0)}}, circle, fill, inner sep = 1pt] at (axis cs:0.66,0) {};
\node[label={135:{(0.934,0)}}, circle, fill, inner sep = 1pt] at (axis cs:0.934,0) {};
\node[label={45:{(1.218,0)}}, circle, fill, inner sep = 1pt] at (axis cs:1.218,0) {};
\end{axis}
\end{tikzpicture}
\caption{The graph of equation \ref{fig:eqN}, $\frac{df}{dx}= r - rx^2 -\frac{1}{2}\sin{nx}\mbox{, for }r = 0.7, n = 10$}
\label{fig:logistic8}
\end{figure}
答案1
您不能将坐标文本设置得太小,以免它们重叠。除了减小字体大小外,还可以旋转字体:
\documentclass[border=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\begin{document}
\begin{tikzpicture}[
every label/.style = {font=\tiny, inner sep=2pt, rotate=30, anchor=west},
dot/.style = {circle, fill, inner sep = 1pt}
]
\begin{axis}[
axis lines=middle,
grid=both,
xlabel=$dx$,
ylabel=$df$,
xmin=-1, xmax=2,
ymin=-2, ymax=2,
ticklabel style = {font=\footnotesize},
enlargelimits]
\addplot[blue,samples=1000,domain=0:15] {0.7-0.7*x^2-0.5*sin(180*10*x/pi)};
\node[label=135:{(0.0,0)}, dot] at (0.0,0) {};
\node[label=135:{(0.285,0)}, dot] at (0.285,0) {};
\node[label=135:{(0.66,0)}, dot] at (0.66,0) {};
\node[label=135:{(0.934,0)}, dot] at (0.934,0) {};
\node[label=135:{(1.218,0)}, dot] at (1.218,0) {};
\end{axis}
\end{tikzpicture}
\end{document}