1

i am doing a plot with pgfplots with data from a file. It takes the values from the file correctly but when i compile the pdf it prints the label with the same dimension of the text with which i'm writing my report. I want it smaller. My code for the plot's setup in the preamble is like this:

\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}

while in the document i have:

\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}

I attach also the plots that i get with this code. Hope i've been sufficently clear! thank you bye

enter image description here

1

Set the compat option before 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}

Result:

enter image description here

  • now i'am trying to add a legend for the two plots but i can't succeed. I add 'legend style={at={(1,1)},anchor=south east}' and than '\legend={}' but it doesn't show the name in the legend, only the marks. – Paolo Orsatti Feb 23 '16 at 21:31
  • 1
    Maybe it is better to ask a new question with a minimal working example. Note that we can not use your code in this question because we do not have your files. – esdd Feb 23 '16 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.