pgfplots 1.14
我正在使用和绘制一系列相当复杂的图,这些图由多行 (5..25) 实验数据组成TikZ 3.0.1a
。这些曲线通常重叠、在x
或y
轴附近共存,并且通常具有不均匀的外观。我想注释每条曲线一次,因此目前使用以下节点代码:
\RequirePackage[l2tabu,orthodox]{nag}
\documentclass[12pt,a4paper]{report}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{german}
\usepackage{fontspec}
\usepackage{tikz}
\usetikzlibrary{
decorations.markings}
\tikzset{>=latex}
\usepackage{tikz-cd}
\usepackage{pgfplots}
\usepackage{chemfig}
\usepackage{chemmacros}
\begin{document}
\begin{tikzpicture}
\begin{axis} [
xlabel = {pH},
ylabel = {\ch{V^V}, \%},
axis lines = left,
clip = false,
xmin = 0.5, xmax = 14,
ymin = 0, ymax = 105,
xtick = {1,2,...,13},
ytick = {0,10,...,100},
width = \textwidth,
height = 12cm,
grid = major,
grid style = {dashed,gray!30},
]
\addplot [smooth,thick] table [x = pH, y = {[VO2]+}, col sep = comma] {plots/distr-V-O-01.csv}
node[pos = 0.2, pin = {90:\ch{[VO2]^+}}, inner sep = 0pt]{};
\addplot [smooth,thick] table [x = pH, y = {[H3V10O28]3-}, col sep = comma] {plots/distr-V-O-01.csv}
node[pos = 0.5, pin = {-90:\ch{[H3V10O28]^{3-}}}, inner sep = 0pt]{};
\addplot [smooth,thick] table [x = pH, y = {[H2V10O28]4-}, col sep = comma] {plots/distr-V-O-01.csv}
node[pos = 0.7, pin = {120:\ch{[H2V10O28]^{4-}}}, inner sep = 0pt]{};
%%% And so on for each data series, there are about 25 entries on average
\end{axis}
\end{tikzpicture}
\end{document}
其中\ch{A3B5O_x}
是与数据系列相对应的化学式之一。每次计算出正确的角度和节点位置(以便标签、线条和轴不重叠)非常繁琐,在我看来,似乎必须有一种更简单的方法来自动标记此类数据图,以便根据特定绘图区域的占用情况自动正确估计 3 个参数 - 引脚长度、引脚角度和线上的节点位置。
是的,我确实需要图钉,使用nodes near coords
或总结图例区域中的所有数据线不可避免地会使图变得混乱。
如果您能建议除此以外还有另一种适用于pgfplots
XeLaTeX 的工具来完成这项工作,请随意这样做。
我不确定如何正确附加 .csv 文件,因此这里是数据文件的第一行:
pH,[VO2]+,[H3V10O28]3-,[H2V10O28]4-,[HV10O28]5-,[V10O28]6-,[V4O12]4-,[H2VO4]-,[H2V2O7]2-,[V6O18]6-,[V5O15]5-,[V3O10]5-,[V4O13]6-,[HV4O13]5-,[HV2O7]3-,[HVO4]2-,[V2O7]4-,[VO4]3-
1,,0.021,,,,,,,,,,,,,,,
1,,,0.122,,,,,,,,,,,,,,
1.0099,99.62,,,,,,,,,,,,,,,,
1.0929,93.542,,,,,,,,,,,,,,,,
1.1033,,,3.605,,,,,,,,,,,,,,
1.1295,,3.035,,,,,,,,,,,,,,,
1.1328,90.377,,,,,,,,,,,,,,,,
1.1677,,,6.389,,,,,,,,,,,,,,
1.1991,86.072,,,,,,,,,,,,,,,,
1.2,,,,0.027,,,,,,,,,,,,,
1.252,82.906,,,,,,,,,,,,,,,,
1.271,,,9.994,,,,,,,,,,,,,,
1.2755,80.311,,,,,,,,,,,,,,,,
1.3187,77.082,,,,,,,,,,,,,,,,
1.3353,,,13.157,,,,,,,,,,,,,,
1.3558,,9.676,,,,,,,,,,,,,,,
1.3586,73.916,,,,,,,,,,,,,,,,
1.3739,,,15.309,,,,,,,,,,,,,,
1.3985,70.751,,,,,,,,,,,,,,,,