In my case, the value in 'data.dat' is all nan.
\addplot table [
x=X,
y=value
] {data.dat};
\addlegendentry{{\scriptsize small city}}
So in the legend, there is no entry for this table. But I still want to generate one. How should I customize it? Thanks!