如何使用 pgfplots 在軸標籤中設定小字體

如何使用 pgfplots 在軸標籤中設定小字體

我正在使用 pgfplots 和文件中的數據進行繪圖。它正確地從文件中獲取值,但是當我編譯 pdf 時,它會列印與我編寫報告的文本尺寸相同的標籤。我想要它小一點。我在序言中的情節設定代碼如下:

\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\pgfplotsset{every tick label/.append style={font=\tiny},label style=
 {font=\tiny},width=6.5cm,height=5.5cm,compat=1.3}

在文件中我有:

\begin{figure}[!ht]
\centering
\subfloat[Andamento nel tempo di pressione e temperatura]{
\begin{tikzpicture}
\begin{axis}[xmin=0, xmax=90,axis y line*=left,ymin=8.62,ymax=8.69, xlabel=
{Tempo (ore)}, ylabel={Pressione (bar)}]
\addplot[thick,black] table[x=tempo,y=P_mean] 
{capitolo4/grafici/t_meanVSp_mean2.txt};
\end{axis}
\begin{axis}[xmin=0, xmax=90,axis y line*=right,ymin=20.5,ymax=23.0, 
ylabel=Temperatura (°C)]
\addplot[dashed,black] table[x=tempo,y=T_mean]
{capitolo4/grafici/t_meanVSp_mean2.txt};
\end{axis}
\end{tikzpicture}
}
\subfloat[Confronto tra la pressione misurata sperimentalmente e la   
 pressione calcolata con il modello di gas perfetto]{
\begin{tikzpicture}
\begin{axis}[xmin=0, xmax=90,ymin=8.55,ymax=8.75,xlabel=Tempo (ore), 
ylabel=Pressione (bar)]
\addplot[only marks,mark=o] table[x=tempo,y=p_sp]
{capitolo4/grafici/t_meanVSp_mean3.txt};
\addplot[thick,black] table[x=tempo,y=p_id]
{capitolo4/grafici/t_meanVSp_mean3.txt};
\end{axis}
\end{tikzpicture}
}
\end{figure}

我還附上了用這段程式碼得到的圖。希望我已經說得夠清楚了!謝謝你,再見

在此輸入影像描述

答案1

設定compat之前的選項label style

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{
  compat=1.3,
  tick label style={font=\tiny},
  label style={font=\tiny},
  width=6.5cm,
  height=5.5cm}
\begin{document}
Normal text
\begin{figure}[!ht]
\centering
\begin{tikzpicture}
\begin{axis}[xmin=0, xmax=90,axis y line*=left,ymin=8.62,ymax=8.69, xlabel=
{Tempo (ore)}, ylabel={Pressione (bar)}]
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}

結果:

在此輸入影像描述

相關內容