# Arrows with charts, labels, tkiz and pgf [closed]

I would like to draw an arrow from the K in the first chart to the E in the x-label of the second chart. Normal arrows are working but nodes in the axis labels don't seem to work. Do you have any suggestions?

\documentclass[10pt,a4paper]{article}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{ucs}
\usepackage[ngerman]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{lmodern}
\usepackage{tikz}
\usetikzlibrary{decorations.text, calc}
\usepackage{pgfplots}

% Commands for Arrows
\newcommand{\VerticalShiftForArrows}{0.0em, -0.5em}
\newcommand{\tikzmark}[2]{%
\tikz[overlay, remember picture] \node[text = black, inner sep = 2pt] (#1) {#2};%
}
\newcommand{\DrawArrow}[3][]{%
\coordinate (Start Mid) at ($(#2Left)!0.5!(#2Right) + (\VerticalShiftForArrows)$);
\coordinate (End Mid)   at ($(#3Left)!0.5!(#3Right) + (0em, 1.5em) + (\VerticalShiftForArrows)$);
\draw[-stealth, thick, #1] (Start Mid) to (End Mid);
}

\begin{document}
\begin{center}
\begin{tikzpicture}
\begin{axis}[
title = {First Chart},
%title style = {font = \footnotesize},
ybar,
bar width = 5pt,
symbolic x coords={A,B,C,D,E,F,G,H,I,J,\tikzmark{kcLeft}{}K\tikzmark{kcRight}{},L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z},
xtick = data,
%ticklabel style = {font = \tiny},
grid = major,
enlarge y limits = false,
enlarge x limits = 0.025,
height = 0.4\textheight,
width = \textwidth,
]
(A,0)(B,0)(C,0)(D,0)(E,0)(F,1.887)(G,1.887)(H,0)(I,3.774)(J,3.774)(\tikzmark{kcLeft}{}K\tikzmark{kcRight}{},16.981)(L,0)(M,0)(N,13.208)(O,13.208)(P,0)(Q,0)(R,3.774)(S,5.66)(T,9.434)(U,1.887)(V,5.66)(W,0)(X,1.887)(Y,5.66)(Z,11.321)};
\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
\begin{axis}[
title = {Second Chart},
%title style = {font = \footnotesize},
ybar,
bar width = 5pt,
symbolic x coords={A,B,C,D,\tikzmark{ecLeft}{}E\tikzmark{ecRight}{},F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z},
xtick = data,
%ticklabel style = {font = \tiny},
grid = major,
enlarge y limits = false,
enlarge x limits = 0.025,
height = 0.4\textheight,
width = \textwidth,
]
(A,6.51)(B,1.89)(C,3.06)(D,5.08)(\tikzmark{ecLeft}{}E\tikzmark{ecRight}{},17.4)(F,1.66)(G,3.01)(H,4.76)(I,7.55)(J,0.27)(K,1.21)(L,3.44)(M,2.53)(N,9.78)(O,2.51)(P,0.79)(Q,0.02)(R,7)(S,7.27)(T,6.15)(U,4.35)(V,0.67)(W,1.89)(X,0.03)(Y,0.04)(Z,1.13)};
\end{axis}
\end{tikzpicture}
\end{center}
First character: \tikzmark{kLeft}{}K\tikzmark{kRight}{} \\[2em]
Second character: \tikzmark{eLeft}{}E\tikzmark{eRight}{} \\[2em]
\begin{tikzpicture}[overlay, remember picture]
\DrawArrow[black, in=90, out=270]{k}{e}
\DrawArrow[black, in=90, out=270]{kc}{ec}
\end{tikzpicture}
\end{document}


## closed as off-topic by Stefan Pinnow, ebosi, Moriambar, CarLaTeX, ZarkoMay 18 '17 at 21:36

• This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

• Welcome! The tikzmark TikZ library includes a \subnode macro for creating marks within TikZ nodes. Have you tried that? Nesting tikzpictures as you're doing is known to be problematic and should be avoided. – cfr Apr 14 '16 at 22:03
• Hi cfr, thanks for your comment. I tried your idea, but i get an error ! Undefined control sequence. \tick ->\subnode {kc}{K} \end{axis}. Think, that I can't use nodes in the addplot coordinates. – Wolfgang Apr 14 '16 at 22:56
• Your code gives me i.imgur.com/mlUxGmn.png, so not entirely wrong, but a bit offset to the right (recently updated TL 2015). – Torbjørn T. Apr 15 '16 at 6:40
• I found out that it depends of the way how I compile my LaTeX-File. When I compile it with pdfLaTeX I get the same picture like you, @TorbjørnT. . Normally I compile it with LaTeX > dvips > ps2pdf, but I think thats fine. Thank you very much! – Wolfgang Apr 15 '16 at 19:10
• I'm voting to close this question because it was solved in the comments. – Stefan Pinnow May 18 '17 at 20:50