2

I would like to plot some percentages as a line graph, so I tried this:

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=2.12}
\begin{document}
\begin{tikzpicture}
\begin{axis}[legend style={at={(.9,0.9),anchor=north east}},
symbolic x coords={Accuracy, score, recall, precision, hamming loss, jaccard similarity, F-beta score}, xtick=data]
\addlegendentry{data set 1}
\addplot[mark=diamond*,thick,red] coordinates {
(Accuracy,12.90129) (score,34.908839) (recall,60.29032309) (precision,22.09321093) (hamming loss,50.3093) (jaccard similarity,90.2323) (F-beta score,89.1920129)
};

\addlegendentry{data set 2}
\addplot[mark=diamond*,thick,red] coordinates {
(Accuracy,12.90129) (score,34.908839) (recall,60.29032309) (precision,22.09321093) (hamming loss,50.3093) (jaccard similarity,90.2323) (F-beta score,89.1920129)
};


\end{axis}
\end{tikzpicture}
\end{document}

The problem with this is that the plots cant fit in the chart. How can I fix this issue in order to compare two different curves (data sets)?.

1 Answer 1

3

You have version 2.12? ;-) Make it 1.12 and change the x tick label style. Then you get this:

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}
\begin{document}
\begin{tikzpicture}
\begin{axis}[legend style={at={(.5,0.9)},anchor=north east},
symbolic x coords={Accuracy, score, recall, precision, hamming loss, jaccard similarity, F-beta score}, xtick=data,
x tick label style={rotate=45,anchor=east}]
\addlegendentry{data set 1}
\addplot[mark=*,thick,blue] coordinates {
(Accuracy,1.90129) (score,38.908839) (recall,50.29032309) (precision,28.09321093) (hamming loss,40.3093) (jaccard similarity,80.2323) (F-beta score,78.1920129)
};

\addlegendentry{data set 2}
\addplot[mark=diamond*,thick,red] coordinates {
(Accuracy,12.90129) (score,34.908839) (recall,60.29032309) (precision,22.09321093) (hamming loss,50.3093) (jaccard similarity,90.2323) (F-beta score,89.1920129)
};


\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

1
  • @ml_guy Happy to help. Have a nice day. :-)
    – user11232
    Mar 19, 2015 at 5:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .