我已经花了几个小时来创建这个图形 - 但没有成功。
我尝试过不同类型的tikz
和pstricks
usepackages multido
。
我最大的问题是添加文本、添加更正确的曲折线以及添加两条虚线。
我的代码如下所示:
\documentclass{article}
\usepackage{MinionPro}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[thick,-] (0,0) -- (4.5,0);
\draw[thick,-] (0,0) -- (0,4.5);
\draw[thick,-] (0,0) -- (-4.5,0);
\draw[thick,-] (0,0) -- (0,-4.5);
\draw (0,0) .. controls (0,2) and (2,2) .. (4,2);
\draw (-4,-3) .. controls (-2,-3) and (0,-2) .. (0,0);
\end{tikzpicture}
\end{document}
我得到这个数字:
答案1
这是使用 Tikz 的简单解决方案。您可以使用图来实现,但我认为这样做更容易。
“绘制”曲线是使用命令绘制的简单边
\draw (-4.5,-3) edge[out=0,in=180,looseness=1.5] (4.5,3);
。
如您所见,起点和终点是对称的。边缘内的控制选项指定边缘从哪里出来(0 度)以及从哪里进去(180 度)。松散度控制曲率:1 为默认值,0 为直线,数字越大,曲率越明显。
\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\tikzset{
nodeax/.style={
text centered,
text width=2.5cm
},
every path/.style={
thick
}
}
\begin{document}
\begin{tikzpicture}
%X and Y axis and relative nodes
\draw (-4.5,0) node[nodeax,left] {Expectations failed} -- (4.5,0) node[nodeax,right] {Expectations exceeded}; % X Axis
\draw (0,-4.5) node[nodeax,below] {Dissatisfied} -- (0,4.5) node[nodeax,above] {Confirmation satisfied}; % Y Axis
% "plot"
\draw (-4.5,-3) edge[out=0,in=180,looseness=1.5] (4.5,3);
% dashed lines and relative nodes
\draw[dashed] (-1,-4.5) -- (-1,4.5) node[left, anchor=east, xshift=-1em] {Discomfirmation};
\draw[dashed] (1,-4.5) -- (1,4.5)
node[right, anchor=west, xshift=1em] {Affirmation}
node[nodeax,pos=0.3,left, xshift=-8em] {(Difference between perfomance and expectations)};
\end{tikzpicture}
\end{document}
顺便说一下,虚线已经添加dashed
到路径选项中,但还有更多:
\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[
y=.5cm,
every node/.style=midway, above, font=\scriptsize
]
\draw[densely dashdotted] (0,9) -- (5,9) node {densely dashdotted};
\draw[densely dotted] (0,8) -- (5,8) node {densely dotted};
\draw[densely dashed] (0,7) -- (5,7) node {densely dashed};
\draw[loosely dashdotted] (0,6) -- (5,6) node {loosely dashdotted};
\draw[loosely dotted] (0,5) -- (5,5) node {loosely dotted};
\draw[loosely dashed] (0,4) -- (5,4) node {loosely dashed};
\draw[dashdotted] (0,3) -- (5,3) node {dashdotted};
\draw[dotted] (0,2) -- (5,2) node {dotted};
\draw[dashed] (0,1) -- (5,1) node {dashed};
\draw (0,0) -- (5,0) node {normal};
\end{tikzpicture}
\end{document}
答案2
使用 MetaPost 完成。虚线由dashed
操作员绘制:
for k = u, -u: draw (k, ymin) -- (k, ymax) dashed evenly; endfor
看MetaPost 手册,第 37 页,了解如何随意个性化破折号图案。
该曲线由以下简单线绘制:
draw A{right} .. origin{dir 80} .. B{right};
括号之间的指令表示切线的方向,以度数表示(right
是 的别名dir 0
)。
请注意hobby
该软件包tikz
提供了与 MetaPost 类似的用于构建贝塞尔曲线的功能。
input latexmp; setupLaTeXMP(mode=rerun, textextlabel=enable);
numeric u, xmin, xmax, ymin, ymax;
u = cm; xmax = -xmin = ymax = -ymin = 4.5u;
pair A, B; A = (xmin, -3u); B = (xmax, 2u);
beginfig(1);
draw (xmin, 0) -- (xmax, 0);
draw (0, ymin) -- (0, ymax);
for k = u, -u: draw (k, ymin) -- (k, ymax) dashed evenly; endfor
draw A{right} .. origin{dir 80} .. B{right};
label.lft("\begin{tabular}{c}Expectations\\ failed \end{tabular}", (xmin, 0));
label.rt("\begin{tabular}{c}Expectations\\ exceeded \end{tabular}", (xmax, 0));
label.bot("Dissatisfied", (0, ymin));
label.top("\begin{tabular}{c}\textbf{Confirmation}\\Satisfied\end{tabular}", (0, ymax));
label.top("\textbf{Disconfirmation}", (.4[xmin,-u], ymax));
label.top("\textbf{Affirmation}", (.5[u,xmax], ymax));
label.lft("\begin{tabular}{c}Difference between\\Performance and\\Expectations\end{tabular}", (.5[xmin, u], .3ymin));
endfig;
end.
输出: