pgfplots:为每个groupplot分别修改堆积图中y轴的比例

时间:2015-11-16 20:11:53

标签: plot latex tikz

我需要使用不同的参数设置从各种模拟中绘制结果。它们在x轴上共享相同的类别(A到Q)。所以,我从this主题的一些有用的代码开始堆叠它们。不幸的是,所有y轴都按相同的比例缩放。尝试在每个\ nextgroupplot部分中插入不同的比例以便最佳地使用可用空间失败。有没有人知道如何从一般缩放改为个别缩放?目前的代码如下:

% Preview source code

%% LyX 2.0.1 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.

\usepackage {tikz}
\usepackage{pgfplots}
\usetikzlibrary{pgfplots.groupplots}
\usetikzlibrary{shapes}
\usetikzlibrary{plotmarks}

\makeatother

\usepackage{babel}
\begin{document}
\begin{tikzpicture}
\begin{groupplot}[group style={group name=my plots,group size=1 by 3,xlabels at=edge bottom,xticklabels at=edge bottom,ylabels at=edge left,yticklabels at=edge left,vertical sep=0pt},footnotesize,width=16cm,xlabel=,height=5cm,xmin=-0.5,xmax=16.5,ymin=0,ymax=8,ytick={0,1,2,3,4,5,6,7},xtick={0,1,...,16},xticklabels={A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q},tickpos=left,ytick align=outside,xtick align=outside]
\nextgroupplot
\addplot coordinates{(0,1.00)(1,1.00)(2,1.00)(3,1.00)(4,1.00)(5,1.00)(6,1.00)(7,1.00)(8,1.00)(9,1.00)(10,1.00)(11,1.00)(12,1.00)(13,1.00)(14,1.00)(15,1.00)(16,1.00)};
\addplot coordinates{(0,1.00)(1,0.88)(2,1.83)(3,1.05)(4,1.02)(5,0.99)(6,0.98)(7,0.95)(8,1.00)(9,1.15)(10,1.19)(11,2.34)(12,1.06)(13,1.00)(14,1.00)(15,1.00)(16,1.00)};
\addplot coordinates{(0,1.00)(1,0.60)(2,5.02)(3,1.26)(4,1.12)(5,0.94)(6,0.92)(7,0.75)(8,1.00)(9,1.75)(10,1.92)(11,7.50)(12,1.29)(13,1.00)(14,1.00)(15,1.00)(16,1.00)};
\nextgroupplot
\addplot coordinates{(0,1.00)(1,1.00)(2,1.00)(3,1.00)(4,1.00)(5,1.00)(6,1.00)(7,1.00)(8,1.00)(9,1.00)(10,1.00)(11,1.00)(12,1.00)(13,1.00)(14,1.00)(15,1.00)(16,1.00)};
\addplot coordinates{(0,1.01)(1,0.99)(2,1.09)(3,1.00)(4,1.00)(5,1.00)(6,1.00)(7,1.00)(8,1.00)(9,1.00)(10,1.00)(11,1.00)(12,1.00)(13,1.01)(14,1.01)(15,1.76)(16,1.03)};
\nextgroupplot
\addplot coordinates{(0,1.00)(1,1.00)(2,1.00)(3,1.00)(4,1.00)(5,1.00)(6,1.00)(7,1.00)(8,1.00)(9,1.00)(10,1.00)(11,1.00)(12,1.00)(13,1.00)(14,1.00)(15,1.00)(16,1.00)};
\addplot coordinates{(0,0.98)(1,0.99)(2,1.06)(3,0.99)(4,1.00)(5,0.98)(6,0.98)(7,0.93)(8,1.00)(9,0.98)(10,0.98)(11,1.08)(12,1.00)(13,0.99)(14,0.98)(15,1.74)(16,1.02)};
\end{groupplot}
\end{tikzpicture}
\end{document}

结果如this。为了使源代码更易读,一些行已被删除,图像显示更多。在中间和下部,可以看出该图不使用所有可用空间,但应该这样做。

我希望我做的事情是正确的,因为这是我在堆栈溢出时的第一篇文章。非常感谢您的帮助。蒂洛

0 个答案:

没有答案