How can I control the color of a dotplot created with pgfplots
?
I tried the point meta
key, but apparently I did not get it right, since it is not respected.
\begin{edit}
I would also like to have control over what colors to use.
\end{edit}
Here is what I get:
Here is what I want (via gimp):
And here follows the code:
\documentclass{article}
%% -------- %%
%% the data %%
%% -------- %%
\begin{filecontents}{data.tsv}
number name point error_l error_r
6 foo -0.017 0.1 0.096
5 bar 0.035 0.1 0.100
4 baz 0.383 0.1 0.106
3 tmp 0.202 0.1 0.176
2 wee 0.171 0.1 0.100
1 lot 0.270 0.1 0.120
\end{filecontents}
%% -------- %%
%% packages %%
%% -------- %%
\usepackage{pgfplotstable}
\usepackage{pgfplots}
\begin{document}
%% ------------- %%
%% read the data %%
%% ------------- %%
\pgfplotstableread{data.tsv}\data
%% ------------- %%
%% plot the data %%
%% ------------- %%
\begin{tikzpicture}%
\begin{axis}[
y=\baselineskip,%
scale only axis,%
width=10cm,%
xmin=-1,%
xmax=1,%
ymin=0.2,%
ymax=6.4,%
axis y line*=none,%
ytick=\empty,%
axis x line*=bottom]
\addplot+[only marks,%
point meta=explicit,% <<<<< does not work
error bars/.cd,%
x dir=plus,%
x explicit,%
error mark=none,%
error bar style={line width=1pt}]%
table[x=point,y=number,x error=error_r,meta=number]{\data};
\addplot+[only marks,%
point meta=explicit,% <<<<< does not work
error bars/.cd,%
x dir=minus,%
x explicit,%
error mark=none,%
error bar style={line width=1pt}]%
table[x=point,y=number,x error=error_l,meta=number]{\data};
\end{axis}%
\end{tikzpicture}%
\end{document}