[Tex/LaTex] Label of edges in a forest – labels are not visible

edgeforestlabels

I decided to use tikz forest in my book which I prepare to make the figures more attractive… but I realized that it is not so funny without any previous experience with it. After hours of googling I got to this:

enter image description here

\documentclass{article}
\usepackage[czech,english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath, amssymb, latexsym, graphicx, makeidx, fancyhdr, sectsty, enumitem, ntheorem}
\usepackage[font=small,labelfont=bf,aboveskip=0.1cm,position=top,labelsep=quad]{caption}
\usepackage[IL2]{fontenc}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{pifont}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{forest}
\usepackage{tikz}
\begin{document}
\tikzstyle{ball}=[circle,shading=ball, ball color=red,minimum size=0.5cm]
\begin{forest}
    for tree={s sep=20pt,l sep=3cm,style=ball,grow=east}
%
[ ,name=root, ball color=blue, label={$\pmb{x}_1$},edge label = {node [right] {matched place} }
    [{}, 
 ]
]
\end{forest}
\end{document}

I would like to help with two problems:
1) I need to add a label to the edge (ideally below it). (more important)
2) If possible, I would need to replace the edge by the arrow. (less important)

I'am aware that there are many notations how to write the code of a tree, but this one is the only one where I succeeded with using of the ball style.

Thank you in advance for your comments and helps.

Frantisek

Best Answer

you placed edge label on the wrong place ... where you put it the edge not exist. where exactly you like to have edge label is not clear. as you write, it appear right of edge (i doubt that this is desired).

enter image description here

a really minimal working example (mwe) is:

\documentclass{article}
\usepackage{amsmath}
\usepackage{forest}

\begin{document}
\tikzset{
ball/.style = {circle,
               shading=ball,
               ball color=#1,
               minimum size=0.5cm}
        }
\begin{forest}
for tree = {
  grow=east,
  l sep+=33mm,
  s sep=1mm,
            }
[ ,name=root, ball=blue, label={$\pmb{x}_1$},
    [ ,ball=red, edge label = {node [midway,above] {matched place} } ]
]
\end{forest}
\end{document}
Related Question