Gibt es vielleicht eine Möglichkeit, die Labels wie auf dem Bild zu platzieren?

alt text

Öffne in Overleaf
%\documentclass[]{article}
\documentclass[border=3pt, varwidth]{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.13}

\begin{document}

\begin{tikzpicture}
\begin{axis}[enlargelimits=false,
xticklabel pos=right,   % x-Achse oben statt unten
xlabel = {k}, 
ylabel = {n}, 
% hide x axis, hide y axis,  % Achsen ausblenden
%x = 5mm, y =5mm,   % Maßstab
]
\addplot[
matrix plot,
%mark=*,%nodes near coords=\coordindex,
mesh/color input=explicit,
]
coordinates {
(1,1) [color=red]      (2,1) [color=blue]  (3,1) [color=yellow]

(1,2) [color=black] (2,2) [color=brown] (3,2) [color=magenta]

(1,3) [color=green] (2,3) [color=red]  (3,3) [color=white]
};
\node at (1,1) []{a/b};
\end{axis}
\end{tikzpicture}

\end{document}

gefragt 15 Jan '18, 20:00

cis's gravatar image

cis
9.5k75452491
Akzeptiert-Rate: 29%

bearbeitet 15 Jan '18, 20:15


Öffne in Overleaf
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.13}

\begin{document}

\begin{tikzpicture}
\begin{axis}[enlargelimits=false,
xticklabel pos=right,   % x-Achse oben statt unten
xlabel = {k}, 
ylabel = {n},
every axis x label/.style={at={(ticklabel cs:0)},anchor=near ticklabel},
every axis y label/.style={at={(ticklabel cs:1)},anchor=near ticklabel},
% hide x axis, hide y axis,  % Achsen ausblenden
%x = 5mm, y =5mm,   % Maßstab
]
\addplot[
matrix plot,
%mark=*,%nodes near coords=\coordindex,
mesh/color input=explicit,
]
coordinates {
(1,1) [color=red]      (2,1) [color=blue]  (3,1) [color=yellow]

(1,2) [color=black] (2,2) [color=brown] (3,2) [color=magenta]

(1,3) [color=green] (2,3) [color=red]  (3,3) [color=white]
};
\node at (1,1) []{a/b};
\coordinate (lu) at (yticklabel* cs:1);
\end{axis}
\draw (lu) -- +(135:1);
\end{tikzpicture}

\end{document}

Permanenter link

beantwortet 15 Jan '18, 22:50

Henri's gravatar image

Henri
15.7k133943
Akzeptiert-Rate: 46%

Ui, da muss man mal drauf kommen. :)

(16 Jan '18, 00:36) cis
Deine Antwort
Vorschau umschalten

Folgen dieser Frage

Per E-Mail:

Wenn sie sich anmelden, kommen Sie für alle Updates hier in Frage

Per RSS:

Antworten

Antworten und Kommentare

Markdown-Grundlagen

  • *kursiv* oder _kursiv_
  • **Fett** oder __Fett__
  • Link:[Text](http://url.com/ "Titel")
  • Bild?![alt Text](/path/img.jpg "Titel")
  • nummerierte Liste: 1. Foo 2. Bar
  • zum Hinzufügen ein Zeilenumbruchs fügen Sie einfach zwei Leerzeichen an die Stelle an der die neue Linie sein soll.
  • grundlegende HTML-Tags werden ebenfalls unterstützt

Frage-Themen:

×296
×58
×6

gestellte Frage: 15 Jan '18, 20:00

Frage wurde gesehen: 6,546 Mal

zuletzt geändert: 16 Jan '18, 00:36