我有一张显示条形和误差线的图表,数字来自外部.dat,只是黑白色。
以下是我到达那里的方式:
\documentclass[12pt]{report}
\usepackage{pgfplots}
\begin{figure} [ht]
\begin{tikzpicture}
\begin{axis}[xtick pos=left, unbounded coords=jump, scale=1.97, ybar, bar width=8pt, ylabel=$F_{Bruch}$\,${[N]}$,xtick=data,xticklabels from table={data.dat}{amount}]
\addplot [error bars/.cd,y dir=both,y explicit]
table[x expr=\coordindex,y=FB,y error =sFB]{dataEB.dat};
\end{axis}
\end{tikzpicture}
\vspace{-25pt}
\small
\begin{tabbing}
xxxxxxxxxxxxx\=xxxx\kill
\>\begin{tabular}[htbp]{*{6}{@{}c}}
$\underbrace{\;\;\;\;\;\;\;\;\;\;\;\;\;\;}$ & \;\;\;\;\,$\underbrace{\;\;\;\;\;\;\;\;\;\;\;\;\;\;}$ & \;\;\,$\underbrace{\;\;\;\;\;\;\;\;\;\;\;\;\;\;}$ & \,$\underbrace{\;\;\;\;\;\;\;\;\;\;\;\;\;\;}$ & \,$\underbrace{\;\;\;\;\;\;\;\;\;\;\;\;\;\;}$ & \;$\underbrace{\;\;\;\;\;\;\;\;\;\;\;\;\;\;}$ \\
PEL80\,L & \;\;\;\;PEL80\,B & \,\;\;\;\;PEL90A\,L & \;\;\;PEL90A\,B & \;\;\,PEL90B\,L & \;\;PEL90B\,B \\
\end{tabular}
\end{tabbing}
\caption{bla bla}
\end{figure}
我必须调整原始数据,以便误差线处于正确的位置(必须插入几个纳米才能获得我的间距)。
我的问题如下:如何让不同组的条形图具有不同的颜色(例如 PEL80L=红色、PEL80B=绿色,...)?有没有更聪明的方法将这些括号放在组下方?
data.dat(按行和列缩短):
Name FB sFM seM sFB seB amount
PEL80-L-0 196.971 7.1561 20.3208 6.9981 18.3839 0
PEL80-L-5 187.389 7.5195 15.8812 8.0784 15.2679 5
PEL80-L-10 202.529 5.0238 7.0358 3.6911 7.8109 10
PEL80-L-15 194.160 16.3605 40.9362 12.9954 41.6095 15
PEL80-B-0 192.586 2.1435 6.5643 3.1437 7.9701 0
PEL80-B-5 130.047 36.6504 19.4086 36.3431 19.6311 5
PEL80-B-10 77.6493 8.6906 1.6346 8.6906 1.6346 10
PEL80-B-15 79.3942 6.1144 0.9555 5.3075 1.2452 15
数据EB.dat:
Name FB sFM seM sFB seB amount
PEL80-L-0 196.9710 7.1561 20.3208 6.9981 18.3839 0
PEL80-L-5 187.3894 7.5195 15.8812 8.0784 15.2679 5
PEL80-L-10 202.5292 5.0238 7.0358 3.6911 7.8109 10
PEL80-L-15 194.1602 16.360 40.9362 12.9954 41.6095 15
nan nan nan nan nan nan 0
PEL80-B-0 192.5864 2.1435 6.5643 3.1437 7.9701 5
PEL80-B-5 130.0471 36.650 19.4086 36.3431 19.6311 10
PEL80-B-10 77.6493 8.6906 1.6346 8.6906 1.6346 15
PEL80-B-15 79.3942 6.1144 0.9555 5.3075 1.2452 0
nan nan nan nan nan nan 5