0

I would like to plot a graph that does not really plot any values, and it is just a symbolic representation of two properties (x & y) of four different classes (A to D).

I would like it to look like this:

What I am seeking

The text is meant to be different than this, including the axis titles.

Is this possible to do? I have looked for similar things in pgfplots, but did not manage to find anything quite like this...

Thanks in advance for all the help!

1
  • You don’t need the full power of pgfplots if all you want is axes. TikZ would be more than enough. Commented May 11, 2020 at 14:19

2 Answers 2

2

This can be achieved by using tikz only.

\documentclass{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}

\draw[->] (-4,0) -- (4,0) node[anchor=west] {$x$};
\draw[->] (0,-4) -- (0,4) node[anchor=south east] {$y$};
\node[draw,inner sep=4em] at (2, 2) {B};
\node[draw,inner sep=4em] at (-2, 2) {A};
\node[draw,inner sep=4em] at (-2, -2) {C};
\node[draw,inner sep=4em] at (2, -2) {D};

\end{tikzpicture}
\end{document}

enter image description here

2

Using the matrix of nodes approach

enter image description here

\documentclass[tikz,border=5mm]{standalone}
\usetikzlibrary{matrix,calc}
\begin{document}
    \begin{tikzpicture}
        \matrix (mymatrix) [
            matrix of nodes,
            row sep = 1em,
            column sep = 1em,
            nodes={
                rectangle, draw=black, minimum height=1.25em, minimum width=1.25em,
                anchor=center,
                inner sep=0pt, outer sep=0pt
            }
        ] {
            A & B \\
            C & D \\
        };
    \draw[latex-] 
    ([yshift=1ex] $(mymatrix-1-1.north east)!0.5!(mymatrix-1-2.north west)$) node[above]{$y$} --
    ([yshift=-1ex]$(mymatrix-2-1.south east)!0.5!(mymatrix-2-2.south west)$)
    ;
    %
    \draw[latex-] 
    ([xshift=1ex] $(mymatrix-1-2.south east)!0.5!(mymatrix-2-2.north east)$) node[right]{$x$} --
    ([xshift=-1ex]$(mymatrix-1-1.south west)!0.5!(mymatrix-2-1.north west)$)
    ;
    \end{tikzpicture}
\end{document}

You must log in to answer this question.

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