5

I am trying to do a sketch of fluid pathlines, streaklines, and streamlines using TikZ. The code

\documentclass{minimal}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
  \fill [fill=blue!25] (0.0, 0.0) -- (0.0, 2.0) -- (6.0, 2.0) -- (6.0, 1.0) to[out=180, in=0] (0.0, 0.0);
  \filldraw [semithick, fill=gray!50] (0.0, 2.0) rectangle (6.0, 2.1);
  \filldraw [semithick, fill=gray!50] (0.0, -0.1) -- (0.0, 0.0) to[out=0, in=180] (6.0, 1.0) -- (6.0, 0.9) to[out=180, in=0] (0.0, -0.1);
  %
  \draw [thick] (0.25, 0.25) to[out=0, in=180] node [pos=0.1, above] {$t_{1}$} node [pos=0.5, above] {$t_{2}$} node [pos=0.9, above] {$t_{3}$} (5.75, 1.125);
\end{tikzpicture}
\end{document}

generates the following image:

enter image description here

I would like there to be closed circles on the black line at the locations under the labels $t_{1}$, $t_{2}$, and $t_{3}$. Can someone suggest how to do this? Thanks.

Josh
  • 195

2 Answers2

6

You can also just add extra nodes as you go, one for the filled circles, and one for the label:

enter image description here

Notes:

Code:

\documentclass{article}
\usepackage{tikz}

\begin{document} \begin{tikzpicture} \fill [fill=blue!25] (0.0, 0.0) -- (0.0, 2.0) -- (6.0, 2.0) -- (6.0, 1.0) to[out=180, in=0] (0.0, 0.0); \filldraw [semithick, fill=gray!50] (0.0, 2.0) rectangle (6.0, 2.1); \filldraw [semithick, fill=gray!50] (0.0, -0.1) -- (0.0, 0.0) to[out=0, in=180] (6.0, 1.0) -- (6.0, 0.9) to[out=180, in=0] (0.0, -0.1); % \draw [thick] (0.25, 0.25) to[out=0, in=180] node [pos=0.1, circle, fill=red, inner sep=2pt] {} node [pos=0.1, above] {$t_{1}$} node [pos=0.5, circle, fill=blue, inner sep=2pt] {} node [pos=0.5, above] {$t_{2}$} node [pos=0.9, circle, fill=orange, inner sep=2pt] {} node [pos=0.9, above] {$t_{3}$} (5.75, 1.125); \end{tikzpicture} \end{document}

Peter Grill
  • 223,288
5

Specify coordinates inline rather than nodes. Then you can build up any constructs you require later on, like so:

\documentclass{minimal}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
  \fill [fill=blue!25] (0.0, 0.0) -- (0.0, 2.0) -- (6.0, 2.0) -- (6.0, 1.0) to[out=180, in=0] (0.0, 0.0);
  \filldraw [semithick, fill=gray!50] (0.0, 2.0) rectangle (6.0, 2.1);
  \filldraw [semithick, fill=gray!50] (0.0, -0.1) -- (0.0, 0.0) 
    to[out=0, in=180] (6.0, 1.0) -- (6.0, 0.9) to[out=180, in=0] (0.0, -0.1);
  %
  \draw [thick] (0.25, 0.25) to[out=0, in=180] coordinate[pos=0.1] (1) 
    coordinate[pos=0.5] (2)  coordinate[pos=0.9] (3) (5.75, 1.125);
  \foreach \coord in {1,2,3}{%
    \node[above] at (\coord) {$t_{\coord}$};
    \fill (\coord) circle (2pt);
  }
\end{tikzpicture}
\end{document}

Output is: enter image description here

Paul Gessler
  • 29,607