Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
I would go with hobby, definitely. –  Claudio Fiandrino Jan 29 at 19:05

2 Answers 2

up vote 6 down vote accepted

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}
share|improve this answer
    
Thanks, Peter. I did not realize that I could create two nodes in the same physical location, such as you showed. This worked well. –  Josh Jan 29 at 23:14
    
@Josh: Glad it worked for you. Please see How do you accept an answer?. –  Peter Grill Jan 29 at 23:20

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.