I tried to plot a scatter in latex using tikzpicture
.
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture} [x=12cm,y=4cm]
\begin{axis}[xlabel={y title}, ylabel={x title}]
\addplot[scatter,mark=*,only marks, point meta=x,nodes near coords*={\data},
visualization depends on={value \thisrow{dataname} \as \data},]
table [x=x,y=y]{
x y dataname
99 113 water
37 142 rain
18 164 liver
5 195 coast
69 95 butterfly
330 36 mountain
121 96 dragonfly
208 0 greentree
};
\end{axis}
\end{tikzpicture}
\end{document}
However, in this case, some labels are overlapped and one can't see correctly.
How can I avoid the overlap?
I think one way to do it is to draw it more widely. However I found that [x=12cm,y=4cm]
does not work. Or is there a smarter way to do it?