2

I want to plot the SWOT Internal External Matrix similar to the attached. However, with reversed x-axis coordinates. I have tried to make one but could really reverse the coordinate. Here is my plot and code

enter image description here

\documentclass[]{article}

\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}

\begin{figure}[]
  \centering
  \begin{tikzpicture}
  \begin{axis}[
   width=.85\textwidth,
   height=.55\textwidth,grid=both,grid style={dotted,gray!30}, ymin=-       3,ymax=3,xmax=3,xmin=-3,
legend pos=north west,
xlabel=Internal,
ylabel=External],
\addplot[smooth,mark=square*,blue!80!black] plot coordinates {(1.06,0.93)}
node[above, yshift=.2cm,xshift=1.05cm]{(4.47,4.44)};
\addplot[blue!80!black] plot coordinates {(5,0.93) (1.06,0.93)};
\addplot[blue!80!black] plot coordinates {(1.06,5) (1.06,0.93)};
\addplot[->] plot coordinates {(-3,0) (3,0)};
\addplot[->] plot coordinates {(0,-3) (0,3)};
\node[] at (axis cs: 2.50,2.15) {\Large WO};
\node[] at (axis cs: -2.50,2.15) {\Large SO};
\node[] at (axis cs: 2.50,-1.8) {\Large WT};
\node[] at (axis cs: -2.50,-1.8) {\Large ST};
\node[fill=black!60!green,text=white,rounded corners=4pt] at (axis cs: -01.50,.45) {Growth \& Expansion};
\node[fill=black!50!blue,text=white,rounded corners=4pt] at (axis cs: 01.50,.45) {Filling the Gaps};
\node[fill=red,text=white,rounded corners=4pt] at (axis cs: -01.50,-.45) {Facing Challenges};
\node[fill=red,text=white,rounded corners=4pt] at (axis cs: 01.50,-.45) {Adapting Challenges};
\end{axis}
\node at (3,8) {\Huge S};
\node at (8.5,8) {\Huge W};
\node at (-.75,5.5) {\Huge O};
\node at (-.75,1.8) {\Huge T};
\end{tikzpicture}
\caption{Caption}
\end{figure}

\end{document}

2 Answers 2

1

One possibility is to play with the current axis node.

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}

\begin{figure}[]
  \centering
  \begin{tikzpicture}
  \begin{axis}[
   width=.85\textwidth,
   height=.55\textwidth,grid=both,grid style={dotted,gray!30}, ymin=-       3,ymax=3,xmax=3,xmin=-3,
legend pos=north west,
xlabel=Internal,xlabel style={yshift=-10pt},
ylabel=External,ylabel style={yshift=10pt},
ytick=\empty,xtick=\empty %<- added
]
\addplot[smooth,mark=square*,blue!80!black] plot coordinates {(1.06,0.93)}
node[above, yshift=.2cm,xshift=1.05cm]{(4.47,4.44)};
\addplot[blue!80!black] plot coordinates {(5,0.93) (1.06,0.93)};
\addplot[blue!80!black] plot coordinates {(1.06,5) (1.06,0.93)};
\addplot[->] plot coordinates {(-3,0) (3,0)};
\addplot[->] plot coordinates {(0,-3) (0,3)};
\node[] at (axis cs: 2.50,2.15) {\Large WO};
\node[] at (axis cs: -2.50,2.15) {\Large SO};
\node[] at (axis cs: 2.50,-1.8) {\Large WT};
\node[] at (axis cs: -2.50,-1.8) {\Large ST};
\node[fill=black!60!green,text=white,rounded corners=4pt] at (axis cs: -01.50,.45) {Growth \& Expansion};
\node[fill=black!50!blue,text=white,rounded corners=4pt] at (axis cs: 01.50,.45) {Filling the Gaps};
\node[fill=red,text=white,rounded corners=4pt] at (axis cs: -01.50,-.45) {Facing Challenges};
\node[fill=red,text=white,rounded corners=4pt] at (axis cs: 01.50,-.45) {Adapting Challenges};
\end{axis}
\path (current axis.south west) -- (current axis.south east)
node[anchor=north,pos=0] {5} node[anchor=north,pos=0.25] {4}
node[anchor=north,pos=0.5] {3} node[anchor=north,pos=0.75] {2}
node[anchor=north,pos=1] {1};
\path (current axis.north west) -- (current axis.north east)
node[anchor=south,pos=0] {5} node[anchor=south,pos=0.25] {4}
node[anchor=south,pos=0.5] {3} node[anchor=south,pos=0.75] {2}
node[anchor=south,pos=1] {1}
node[anchor=south,yshift=12pt,font=\Huge,pos=1/4]{S}
node[anchor=south,yshift=12pt,font=\Huge,pos=3/4]{W};
\path (current axis.south west) -- (current axis.north west)
node[anchor=east,pos=0] {1} node[anchor=east,pos=0.25] {2}
node[anchor=east,pos=0.5] {3} node[anchor=east,pos=0.75] {4}
node[anchor=east,pos=1] {5}
node[anchor=east,xshift=-12pt,font=\Huge,pos=1/4]{T}
node[anchor=east,xshift=-12pt,font=\Huge,pos=3/4]{O};
\end{tikzpicture}
\caption{Caption}
\end{figure}
\end{document}

enter image description here

2
  • The coordinates numbering is fine; however, the point (4.47,4.44) is not correct. How can I fix?
    – OOzy Pal
    Commented Jul 24, 2018 at 10:13
  • @OOzyPal Where should it end? At the ficticious values?
    – user121799
    Commented Jul 24, 2018 at 11:21
1

Another option is to play with value of x reference. By default x=(1cm,0) but you can change it to x=-1.75cm to make x axis grow to the left. After that you can use regular coordinates:

\documentclass[tikz,border=2mm]{standalone} 

\begin{document}
\begin{tikzpicture}[x=-1.75cm,
mynode/.style={
    fill=#1, rounded corners,
    text=white,
    font=\small,
    inner sep=2pt}
    ]
\draw (1,1) rectangle (5,5);
\foreach \i in {1,...,5}{
    \node[above] at (\i,5) {\i};
    \node[below] at (\i,1) {\i};
    \node[left] at (5,\i) {\i};
    }
\draw[->] (3,1)--(3,5);
\draw[->] (5,3)--(1,3);

\foreach \i/\j in {(5.5,2)/T, (5.5,4)/O, (4,5.75)/S, (2,5.75)/W}
\node[font=\LARGE] at \i {\j};

\foreach \i/\j in {(4.6,4.5)/SO, (4.6,1.75)/ST, (1.4,4.5)/WO, (1.4,1.75)/WT}
\node[font=\large] at \i {\j};

\node[rotate=90] at(5.35,3) {External};
\node at (3,.4) {Internal};

\node[mynode=black!60!green, above] at (4,3.1) {Growth \& Expansion};
\node[mynode=black!50!blue, above] at (2,3.1) {Filling the Gaps};
\node[mynode=red, below] at (4,2.9) {Facing Challenges};
\node[mynode=red, below] at (2,2.9) {Adapting Challenges};

\draw[black!50!blue] (5,4.44)-|(4.47,5) node[midway, inner sep=1pt, fill=black!50!blue, 
label={[inner sep=0pt,text=black!50!blue, font=\small]-45:{(4.47,4.44)}}] {};
\end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .