我刚刚创建了一个 TikZ 图像,不知何故右下角的分隔符有点太宽了。分隔符应该是 3 厘米宽。将其中间放置在 x=6.5 处,它应该在 x=5 和 x=8 处结束。但事实并非如此,我没有发现错误。
梅威瑟:
\documentclass[12pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}[yscale=0.75]
\draw[help lines] (-2,-2) grid (8,6);
\tikzstyle{every node}=[font=\small, sharp corners, thick]
\tikzset{inner sep=2pt}
\newcommand{\akut}[1]{(0,0) -- node [draw, fill=white] {#1} (1,1)}
\newcommand{\chronisch}[1]{(0,0) -- node [draw, fill=white] {#1} (2,1)}
\newcommand{\schleichend}[1]{(0,0) -- node [draw, fill=white] {#1} +(1,1)}
\newcommand{\Schub}[1]{++(0.5,1.25) node [above, draw] {#1} -- ++(0.5,-0.5)}
\newcommand{\Welle}{+(0,0) to [out=0,in=180] +(0.5,1) node [above, draw] {1991} to [out=0,in=180] +(+0.5,-1)}
\newcommand{\Outcome}[1]{+(3,0) node [midway, above=2pt, draw] {#1}}
\draw [-][very thick, rounded corners] \akut{1990} -- \Schub{1991} -- \Schub{1992} -- \Schub{1995} -- \Schub{1996} -- \Outcome{1999--2009} ;
\node [draw] (x) at (9,0) {Zeit};
\node [draw,align=center] (y) at (0,7) {Symptom-\\schwere};
\draw [<->] [thick] (y) -- (0,0) -- (x);
\node [above, below delimiter=\}] at (0.5,0) {\parbox{1cm}{\color{white}{.}}};
\node [draw] at (0.5,-0.55) {Beginn};
\node [above, below delimiter=\}] at (3,0) {\parbox{4cm}{\color{white}{.}}};
\node [draw] at (3,-0.55) {9-j\"ahriger Verlauf};
\node [above, below delimiter=\}] at (6.5,0) {\parbox{3cm}{\color{white}{.}}};
\node [draw] at (6.5,-0.55) {Outcome};
\node [left=2pt, draw]at (0,2) {leicht};
\node [left=2pt, draw]at (0,4) {mittel};
\node [left=2pt, draw]at (0,6) {schwer};
\end{tikzpicture}
\end{document}
例子:
答案1
我用指定坐标绘制分隔符,然后添加 ,取代了之前的方法node
。新代码如下:
\draw[decorate,decoration={brace,amplitude=3pt,mirror}]
(0,-1pt) -- (1,-1pt) node [below=5pt, midway, draw] {Beginn};
\draw[decorate,decoration={brace,amplitude=3pt,mirror}]
(1,-1pt) -- (5,-1pt) node [below=5pt, midway, draw] {9-j\"ahriger Verlauf};
\draw[decorate,decoration={brace,amplitude=3pt,mirror}]
(5,-1pt) -- (8,-1pt) node [below=5pt, midway, draw] {Outcome};
梅威瑟:
\documentclass[12pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}[scale=1]
\draw[help lines] (-2,-2) grid (8,6);
\tikzstyle{every node}=[font=\small, sharp corners, thick]
\tikzset{inner sep=2pt}
\newcommand{\akut}[1]{(0,0) -- node [draw, fill=white] {#1} (1,1)}
\newcommand{\chronisch}[1]{(0,0) -- node [draw, fill=white] {#1} (2,1)}
\newcommand{\schleichend}[1]{(0,0) -- node [draw, fill=white] {#1} +(1,1)}
\newcommand{\Schub}[1]{++(0.5,1.25) node [above, draw] {#1} -- ++(0.5,-0.5)}
\newcommand{\Welle}[1]{++(0.5,1.25) node [above, draw] {#1} -- ++(0.5,-1.25)}
\newcommand{\Outcome}[1]{+(3,0) node [midway, above=2pt, draw] {#1}}
\draw [-][very thick, rounded corners] \akut{1990} -- \Schub{1991} -- \Schub{1992} -- \Schub{1995} -- \Schub{1996} -- \Outcome{1999--2009} ;
\node [draw] (x) at (9,0) {Zeit};
\node [draw,align=center] (y) at (0,7) {Symptom-\\schwere};
\draw [<->] [thick] (y) -- (0,0) -- (x);
\draw[decorate,decoration={brace,amplitude=3pt,mirror}]
(0,-1pt) -- (1,-1pt) node [below=5pt, midway, draw] {Beginn};
\draw[decorate,decoration={brace,amplitude=3pt,mirror}]
(1,-1pt) -- (5,-1pt) node [below=5pt, midway, draw] {9-j\"ahriger Verlauf};
\draw[decorate,decoration={brace,amplitude=3pt,mirror}]
(5,-1pt) -- (8,-1pt) node [below=5pt, midway, draw] {Outcome};
\node [above left=2pt, draw]at (0,0) {Heilung};
\node [left=2pt, draw]at (0,2) {leicht};
\node [left=2pt, draw]at (0,4) {mittel};
\node [left=2pt, draw]at (0,6) {schwer};
\end{tikzpicture}
\end{document}
例子