
누군가 나에게 다음 그림을 스케치하는 가장 쉬운 방법을 알려줄 수 있는지 궁금합니다. 아래 코드에서 볼 수 있듯이 pgfplots 패키지의 축 환경을 사용하기 시작했지만 중단되었습니다.
미리 감사드립니다!
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[axis lines=middle,axis equal,grid=both]
\addplot coordinates{(0,0) (5,5) };
\end{axis}
\end{tikzpicture}
\end{document}
답변1
꼭 사용할 필요는 없을 것 같아요 pgfplots
. 나는 단지 tikz
.
\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}
\coordinate (Q) at (0,0);
%% put this first even though you can use opacity.
\coordinate (indifferent/nw) at (-0.5in,0.5in);
\fill[gray,opacity=0.20] (indifferent/nw) rectangle ++ (1in,-1in);
\path (indifferent/nw) ++ (-0.5cm,0.5cm) node[anchor=south east] (indifferent/label) {indifference};
\draw (indifferent/nw) -- (indifferent/label.base east);
\draw[arrows=-Stealth,purple]
(Q) ++ (-2in,0) node [anchor=east,align=center,text width=0.75in]
{Need not~fulfilled}
--
++ (4in,0) node [anchor=west,align=center,text width=0.75in]
{Need well~fulfilled};
\draw[arrows=-Stealth,purple]
(Q) ++ (0,-2in) node [anchor=north,align=center,text width=0.75in]
{dissatisfied}
--
++ (0,4in) node [anchor=south,align=center,text width=0.75in]
{satisfied};
\draw[blue,text=blue]
(Q) ++ (-2in,-2in)
--
++ (4in,4in) node[pos=0.75,anchor=north west] {Performance};
\draw[red,text=red]
(Q) ++ (-2in,0.25cm) .. controls (-0.5cm,0.25cm) and
( 0.5cm,1.00cm)
..
(1.25in,2in)
node[pos=0.95,anchor=south east] {Excitement};
\draw[red,text=red]
(Q) ++ (-1.25in,-2in) .. controls (-0.5cm,-1.00cm) and
( 0.5cm,-0.45cm)
..
(2in,-0.5cm)
node[pos=0.80,anchor=north west] {Basic};
\end{tikzpicture}
\end{document}
여기서 기본 아이디어는 \draw
명령이 실제로 일종의 경로이고 node
s가 해당 경로를 따라 정의될 수 있다는 것입니다. 특히, pos=<val>
노드에 대한 선택적 인수를 사용하여 노드의 위치를 지정할 수 있습니다. 앵커링은 원하는 위치를 기준으로 텍스트를 배치하는 데 도움이 됩니다. text width
와 함께 -축을 align
따라 라벨을 x
감싸고 중앙에 배치하는 데 도움이 됩니다(저는 함께 ~
붙어서 well
사용 하곤 했습니다 fulfilled
). 마지막으로, text=<color>
선택적 인수를 사용하여 텍스트 색상을 지정할 수도 있습니다 . 마지막으로 .. controls (<coordinate>) and (<coordinate>) ..
곡선을 구성하는 데 사용했습니다 . 이제 나는 이것을 좀 더 점근적으로 만들려고 노력했어야 했다는 생각이 듭니다.성능, 하지만 조정할 수 있도록 놔두었습니다.
답변2
이러한 종류의 반기술적 스케치의 경우 고려할 수 있습니다.메타포스트대체 도구로. 여기서는 모든 것을 깔끔하게 정리하기 위해 내가 선호하는 순서를 따랐습니다. 경로를 정의합니다(가능한 한 서로 상대적으로). 그려라; 그런 다음 라벨을 추가하세요.
prologues := 3;
outputtemplate := "%j%c.eps";
beginfig(1);
% set a unit scale
u := 1cm;
% define the various paths
path fulfillment, satisfaction, indifference, performance, excitement, basic;
indifference = unitsquare shifted -(1/2,1/2) scaled 2u;
fulfillment = (left--right) scaled 3u;
satisfaction = fulfillment rotated 90;
performance = (xpart point 0 of fulfillment, ypart point 0 of satisfaction)
-- (xpart point 1 of fulfillment, ypart point 1 of satisfaction);
excitement = point 0 of fulfillment shifted (0,1/3u)
{direction 0 of fulfillment} ..
{direction 1 of performance}
point 1 of performance shifted (-1/3u,0);
basic = excitement rotated 180;
% draw the paths
fill indifference withcolor .9 white;
drawarrow fulfillment withcolor .5 white;
drawarrow satisfaction withcolor .5 white;
draw performance withcolor .67 blue;
draw excitement withcolor .67 red;
draw basic withcolor .67 green;
% do the labels
verbatimtex
\font\ss=phvr8r\ss
\def\s#1{$\vcenter{\halign{\hfil{##}\hfil\cr#1\crcr}}$}\let\\\cr
etex
label(btex \s{satisfied} etex, point 1 of satisfaction shifted 10 up);
label(btex \s{dissatisfied} etex, point 0 of satisfaction shifted 10 down);
label(btex \s{needs not\\fulfilled} etex, point 0 of fulfillment shifted 28 left);
label(btex \s{needs well\\fulfilled} etex, point 1 of fulfillment shifted 28 right);
z1 = point 3 of indifference shifted (-u/2,u/2); draw point 3 of indifference -- z1 withcolor .9 white;
label.lft(btex \s{indifference} etex, z1 + 3 up) withcolor .7 white;
label.ulft(btex \s{excitement} etex, point .9 of excitement) withcolor .67 red;
label.lrt (btex \s{performance} etex, point .8 of performance) withcolor .67 blue;
label.lrt (btex \s{basic} etex, point .2 of basic) withcolor .67 green;
endfig;
end.
노트
위의 링크는 MP를 작업 흐름에 통합하기 위한 다양한 접근 방식을 보여 주며 설명서 링크도 있습니다.
진행 중인 작업을 더 쉽게 따라갈 수 있도록 모든 경로에 다소 긴 이름을 사용했습니다.
u
상단 의 값을 조정하여 도면의 배율을 변경할 수 있습니다 .직선 경로에는 세그먼트가 하나만 있으므로
point 0
시작도point 1
끝도 마찬가지입니다.satisfaction
나는 시계 방향으로 90도 회전된 복사본fulfillment
과 180도 회전된basic
복사본으로 정의했습니다excitement
. 이렇게 하면 다이어그램이 멋지고 대칭이 됩니다.나는 레이블을 깔끔하게 설정할 수 있도록 몇 가지 매우 간단한 일반 TeX 명령을 정의했습니다. 매뉴얼에 설명된 대로 LaTeX도 사용할 수 있습니다. 실제로 패키지
gmp
또는 TikZ와 같은 LaTeX 소스 파일의 일부로 MP 코드를 포함할 수 있습니다.luatex
context