How to resize a part of the text in a node using tikz

fontsizetikz-pgf

I have this graph where the times above the nodes is the departure time. How can I format the "+1" better? It stands for the "next day". Now is too big with respect to the time, and also the 'plus' is exaggerated. I was trying to put the "+1" smaller and maybe with a different colour.

How can I achieve this? Thanks!

EDIT: How can I also reduce the white part that covers each edges? (the part in the middle of the edge covered by a number)

\documentclass[margin=10pt]{standalone}
\usepackage{color,xcolor}
\usepackage{tikz-qtree, tikz}
\usepackage{pgfplots}
\usepackage[utf8]{inputenc} 
\usetikzlibrary{decorations.pathreplacing,arrows,shapes,positioning,shadows,calc}
\usetikzlibrary{decorations, decorations.text,backgrounds}
\tikzset{every picture/.style={font issue=\footnotesize},
    font issue/.style={execute at begin picture={#1\selectfont}}
}

\pgfplotsset{width=10cm,compat=1.17}
\usepgfplotslibrary{fillbetween}

\usetikzlibrary{arrows.meta}
\usetikzlibrary{positioning}
\usepackage{clock}
\usepackage[clock]{ifsym}

\ClockFrametrue\ClockStyle=0

\newcommand{\orig}{\mathcal{O}} % origin position
\newcommand{\dest}{\mathcal{D}} % destination position

\begin{document}
    \begin{tikzpicture}
            \begin{scope}[every node/.style={circle,thick,draw}]
            \node[fill=red!30] (Orig) at (0,0) {$\orig$};
            \node (A) at (2,2) {A};
            \node (B) at (2.3,0.5) {B};
            \node (C) at (3.3,-1.2) {C};
            \node (H) at (4.2,2.1) {H};
            \node (L) at (6.4,-0.5) {L};
            \node (E) at (5.9,1.9) {E} ;
            \node[fill=green!30] (Dest) at (8,1) {$\dest$};
        \end{scope}
        
        \begin{scope}[>={stealth[black]},
            every node/.style={fill=white,circle},
            every edge/.style={draw=red,very thick}]
            \path [->] (Orig) edge node {$5$} (A);
            \path [->] (A) edge node {$5$} (H);
            \path [->] (H) edge node {$3$} (E);
            \path [->] (E) edge node {$8$} (Dest); 
            % \path [->] (B) edge[bend right=60] node {$1$} (E); 
        \end{scope}
    
        \begin{scope}[>={stealth[black]},
            every node/.style={fill=white,circle},
            every edge/.style={draw=black,very thick}]
            \path [->] (Orig) edge node {$5$} (B);
            \path [->] (Orig) edge node {$5$} (C);
            \path [->] (B) edge node {$3$} (C);
            \path [->] (B) edge node {$3$} (H);
            \path [->] (B) edge node {$3$} (L);
            \path [->] (C) edge node {$5$} (L);
            \path [->] (E) edge node {$8$} (L); 
            \path [->] (L) edge node {$8$} (Dest); 
        \end{scope}
    

        \begin{scope}[font=\tiny]
            \node [above=0.5pt of A] {\clock{15}{30} 15:30};
            \node [below=0.5pt of Orig] {\clock{18}{15} 18:15};
            \node [above=0.5pt of H] {\clock{8}{30} 8:30$^{+1}$};
            \node [above=0.5pt of E] {\clock{10}{45} 10:45$^{+1}$};
            \node [above=0.5pt of Dest, align=center] {Arrive \\ \clock{12}{00} 12:00$^{+1}$};
        \end{scope}

    
        \matrix [draw,above left, row sep=1mm, nodes={font=\scriptsize}] at (current bounding box.north east) {
            \node [circle, black, draw, label=right:Hotel] {H}; \\
            \node [circle, black, draw, label=right:Lunch] {L}; \\
        };
    \end{tikzpicture}
\end{document}

Graph

Best Answer

I would a bit redesign your image. I suggest to use :

  • quotes library for edges labels
  • at nodes O,A,H,E and D use labels for time information
  • most of styles write as option to tikzpicture:
\documentclass[margin=10pt]{standalone}

\usepackage{clock}
\ClockFrametrue\ClockStyle=1

\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                positioning,
                quotes}

\begin{document}
    \begin{tikzpicture}[
C/.style = {circle, draw, fill=#1, minimum size=1em, inner sep=1pt},
C/.default = white,
every label/.style = {align=center, font=\tiny, inner sep=2pt},
every edge/.style = {draw, - Stealth, thick},
every edge quotes/.style = {font=\scriptsize, text=black, fill=white, inner sep=2pt}
                        ]
\node (O) [C=red!30, 
           label=below:\clock{18}{15}\\\scriptsize{18:15}]  {$\mathcal{O}$};
\node (A) [C,
           label=above:\clock{15}{30}\\\scriptsize{15:30}]          at (2,2)    {A};
\node (B) [C] at (2.3,0.5) {B};
\node (C) [C] at (3.3,-1.2) {C};
\node (H) [C, 
           label=above:\clock{8}{30}\\\scriptsize{8:30$^{+1}$}]      at (4,2)    {H};
\node (L) [C] at (6.4,-0.5) {L};
\node (E) [C, 
           label=above:\clock{10}{45}\\\scriptsize{10:45$^{+1}$}]   at (6,2)    {E} ;
\node (D) [C=green!30,
           label=85:{\scriptsize Arrive:\\[1ex] 
                        \clock{12}{00}
                        \scriptsize 12:00$^{+1}$}]  at (8,1)    {$\mathcal{D}$};

\path [red] (O) edge ["5"]  (A) 
            (A) edge ["5"]  (H) 
            (H) edge ["3"]  (E) 
            (E) edge ["8"]  (D);
\path       (O) edge ["5"]  (B)
            (O) edge ["5"]  (C)
            (B) edge ["3"]  (C)
            (B) edge ["3"]  (H)
            (B) edge ["3"]  (L)
            (C) edge ["5"]  (L)
            (E) edge ["8"]  (L)
            (L) edge ["8"]  (D);

\matrix [draw,above left, row sep=1mm] 
        at (current bounding box.north east) 
{\node [C, label=right:Hotel] {H}; \\
 \node [C, label=right:Lunch] {L}; \\
};
    \end{tikzpicture}
\end{document}

enter image description here