有人能帮我管理条形图中条形之间的间距吗?我有以下数据:
0.0000,0.0001,0.0001,0.0003,0.0006
0.0001,0.0001,0.0003,0.0006,0.0011
0.0001,0.0003,0.0006,0.0011,0.0022
0.0003,0.0006,0.0011,0.0023,0.0045
0.0006,0.0011,0.0022,0.0045,0.0088
0.0001,0.0001,0.0003,0.0006,0.0011
0.0001,0.0003,0.0005,0.0011,0.0021
0.0003,0.0005,0.0011,0.0021,0.0042
0.0006,0.0011,0.0021,0.0043,0.0085
0.0011,0.0021,0.0042,0.0085,0.0167
0.0001,0.0003,0.0006,0.0011,0.0022
0.0003,0.0005,0.0011,0.0021,0.0042
0.0006,0.0011,0.0021,0.0044,0.0085
0.0011,0.0021,0.0044,0.0088,0.0173
0.0022,0.0042,0.0085,0.0173,0.0339
0.0003,0.0006,0.0011,0.0023,0.0045
0.0006,0.0011,0.0021,0.0043,0.0085
0.0011,0.0021,0.0044,0.0088,0.0173
0.0023,0.0043,0.0088,0.0179,0.0351
0.0045,0.0085,0.0173,0.0351,0.0688
0.0006,0.0011,0.0022,0.0045,0.0088
0.0011,0.0021,0.0042,0.0085,0.0167
0.0022,0.0042,0.0085,0.0173,0.0339
0.0045,0.0085,0.0173,0.0351,0.0688
0.0088,0.0167,0.0339,0.0688,0.1349
我希望将其绘制成如图所示的样子;5 个组中的间距尽可能小或没有间距,但组间间距明显。我还希望能够标记 25 个超级组(即前 5 个 5 个组等)。
这是我从 matlab 导出的代码,我认为它很糟糕
% This file was created by matlab2tikz.
%
%The latest updates can be retrieved from
\documentclass[tikz]{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\usepackage{grffile}
\pgfplotsset{compat=newest}
\usetikzlibrary{plotmarks}
\usetikzlibrary{arrows.meta}
\usepgfplotslibrary{patchplots}
\usepackage{amsmath}
\begin{document}
\definecolor{mycolor1}{rgb}{0.24220,0.15040,0.66030}%
\definecolor{mycolor2}{rgb}{0.19633,0.48472,0.98915}%
\definecolor{mycolor3}{rgb}{0.09640,0.75000,0.71204}%
\definecolor{mycolor4}{rgb}{0.82031,0.74981,0.15353}%
\definecolor{mycolor5}{rgb}{0.97690,0.98390,0.08050}%
%
\begin{tikzpicture}
\begin{axis}[%
width=4.521in,
height=3.566in,
at={(0.758in,0.481in)},
scale only axis,
bar shift auto,
xmin=0,
xmax=30,
xlabel style={font=\color{white!15!black}},
xlabel={X},
ymin=0,
ymax=0.14,
ylabel style={font=\color{white!15!black}},
ylabel={values},
axis background/.style={fill=white},
legend style={legend cell align=left, align=left, draw=white!15!black}
]
\addplot[ybar, bar width=0.123, fill=mycolor1, draw=black, area legend] table[row sep=crcr] {%
1 3.70431952744087e-05\\
2 7.04261696203777e-05\\
3 0.000143323021708694\\
4 0.000290586712930211\\
5 0.000569855172911954\\
6 7.04261696203777e-05\\
7 0.000133893562114625\\
8 0.00027248436217744\\
9 0.000552460687655345\\
10 0.0010834032207333\\
11 0.000143323021708694\\
12 0.00027248436217744\\
13 0.000554527988191721\\
14 0.00112430273514572\\
15 0.00220481426380882\\
16 0.000290586712930211\\
17 0.000552460687655345\\
18 0.00112430273514572\\
19 0.00227951819777061\\
20 0.00447024994242766\\
21 0.000569855172911954\\
22 0.0010834032207333\\
23 0.00220481426380882\\
24 0.00447024994242766\\
25 0.00876638518056936\\
};
\addplot[forget plot, color=white!15!black] table[row sep=crcr] {%
0 0\\
30 0\\
};
\addlegendentry{Data \$1\$}
\addplot[ybar, bar width=0.123, fill=mycolor2, draw=black, area legend] table[row sep=crcr] {%
1 7.04261696203777e-05\\
2 0.000133893562114625\\
3 0.00027248436217744\\
4 0.000552460687655345\\
5 0.0010834032207333\\
6 0.000133893562114625\\
7 0.000254557163514336\\
8 0.000518044671023999\\
9 0.00105033299123322\\
10 0.00205975587217604\\
11 0.00027248436217744\\
12 0.000518044671023999\\
13 0.00105426332329968\\
14 0.00213751363896864\\
15 0.00419177185375532\\
16 0.000552460687655345\\
17 0.00105033299123322\\
18 0.00213751363896864\\
19 0.00433379826064407\\
20 0.00849879656327567\\
21 0.0010834032207333\\
22 0.00205975587217604\\
23 0.00419177185375532\\
24 0.00849879656327567\\
25 0.0166665679110804\\
};
\addplot[forget plot, color=white!15!black] table[row sep=crcr] {%
0 0\\
30 0\\
};
\addlegendentry{Data \$2\$}
\addplot[ybar, bar width=0.123, fill=mycolor3, draw=black, area legend] table[row sep=crcr] {%
1 0.000143323021708694\\
2 0.000272484362177439\\
3 0.000554527988191721\\
4 0.00112430273514572\\
5 0.00220481426380882\\
6 0.000272484362177439\\
7 0.000518044671023999\\
8 0.00105426332329968\\
9 0.00213751363896864\\
10 0.00419177185375532\\
11 0.000554527988191721\\
12 0.00105426332329968\\
13 0.00214551218654151\\
14 0.00435001527602447\\
15 0.0085305989468414\\
16 0.00112430273514572\\
17 0.00213751363896864\\
18 0.00435001527602447\\
19 0.00881963431405572\\
20 0.0172957468921281\\
21 0.00220481426380882\\
22 0.00419177185375532\\
23 0.0085305989468414\\
24 0.0172957468921281\\
25 0.0339178303662568\\
};
\addplot[forget plot, color=white!15!black] table[row sep=crcr] {%
0 0\\
30 0\\
};
\addlegendentry{Data \$3\$}
\addplot[ybar, bar width=0.123, fill=mycolor4, draw=black, area legend] table[row sep=crcr] {%
1 0.000290586712930211\\
2 0.000552460687655345\\
3 0.00112430273514572\\
4 0.00227951819777061\\
5 0.00447024994242766\\
6 0.000552460687655345\\
7 0.00105033299123322\\
8 0.00213751363896864\\
9 0.00433379826064407\\
10 0.00849879656327567\\
11 0.00112430273514572\\
12 0.00213751363896864\\
13 0.00435001527602447\\
14 0.00881963431405572\\
15 0.0172957468921281\\
16 0.00227951819777061\\
17 0.00433379826064407\\
18 0.00881963431405572\\
19 0.0178817646600907\\
20 0.0350670407108193\\
21 0.00447024994242766\\
22 0.00849879656327567\\
23 0.0172957468921281\\
24 0.0350670407108193\\
25 0.0687682321957155\\
};
\addplot[forget plot, color=white!15!black] table[row sep=crcr] {%
0 0\\
30 0\\
};
\addlegendentry{Data \$4\$}
\addplot[ybar, bar width=0.123, fill=mycolor5, draw=black, area legend] table[row sep=crcr] {%
1 0.000569855172911954\\
2 0.0010834032207333\\
3 0.00220481426380882\\
4 0.00447024994242766\\
5 0.00876638518056936\\
6 0.0010834032207333\\
7 0.00205975587217604\\
8 0.00419177185375532\\
9 0.00849879656327567\\
10 0.0166665679110804\\
11 0.00220481426380882\\
12 0.00419177185375532\\
13 0.0085305989468414\\
14 0.0172957468921281\\
15 0.0339178303662568\\
16 0.00447024994242766\\
17 0.00849879656327567\\
18 0.0172957468921281\\
19 0.0350670407108193\\
20 0.0687682321957155\\
21 0.00876638518056936\\
22 0.0166665679110804\\
23 0.0339178303662568\\
24 0.0687682321957155\\
25 0.134857965299158\\
};
\addplot[forget plot, color=white!15!black] table[row sep=crcr] {%
0 0\\
30 0\\
};
\addlegendentry{Data \$5\$}
\end{axis}
\end{tikzpicture}%
\end{document}