4

Per title says, I want to draw a line plot and two additional versions of it. More specifically:

  • I would like to plot some(preferably a big number of) nodes between the unit interval.

Imgur

  • I want to point to particular nodes via arrows.

Imgur

  • I want to display the clusters of nodes (perhaps by some dashed ellipses)

Imgur

My best take on the graph has been the following, which I achieved by modifying an example I found on the web. But that's light years away from what I want to achieve.

Code:

\documentclass{minimal}

\usepackage{tikz}
\usetikzlibrary{plotmarks}

\begin{filecontents}{div_soft.data}
#NODES
1.33E-02
1.35E-02
2.66E-01
3.99E-01
5.31E-01
6.64E-01
7.97E-01
9.30E-01
\end{filecontents}

\begin{document}
\begin{tikzpicture}[y=.0cm, x=12.5cm,font=\sffamily]
    %axis
\draw (0,0) -- coordinate (x axis mid) (1,0);

    %ticks
    \foreach \x in {0,...,1}
        \draw (\x,1pt) -- (\x,-3pt)
        node[anchor=north] {\x};

%labels      
\node[below=0.8cm] at (x axis mid) {values};


%plots
\draw plot[mark=*, mark options={fill=black}] 
    file {div_soft.data};

\end{tikzpicture}
\end{document}

1 Answer 1

3

With only tikz

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{shapes.geometric,fit,arrows.meta}
\tikzset{mycircle/.style={circle,draw,blue,inner sep=3pt}
}
\begin{document}
\begin{tikzpicture}[x=10cm,font=\sffamily]
  \draw[|-|,thick] (-0.05,0)node[below=1mm]{0} -- node[below=5mm]{Values} (1,0)node[below=1mm]{1};
  \foreach \x/\A in {0.0133/a,0.035/b,0.266/c,0.399/d,0.531/e,0.664/f,0.797/g,0.930/h}{
  \node[mycircle] (\A) at (\x,0){};
  }
  \foreach \a in {d,h}{
  \draw[latex-,very thick,red] (\a.north) -- +(0,1);
  }
  \node[draw,ellipse,green,fit=(a)(c),inner sep=1pt] {};
  \node[draw,ellipse,green,fit=(f)(g),inner sep=1pt] {};
\end{tikzpicture}
\end{document}

enter image description here

7
  • 2
    I don't think you would do this with a data file even with 15 entries
    – percusse
    Feb 17, 2015 at 8:35
  • @percusse That is why the first sentence ;)
    – user11232
    Feb 17, 2015 at 8:36
  • @Harish Kumar Thank you so much but as percusse points out, I'd like to be able to read the data from a file so that I may populate the graph.
    – alexT
    Feb 17, 2015 at 17:10
  • @user125824 No problem, I can delete this answer if you feel like.
    – user11232
    Feb 17, 2015 at 18:06
  • 1
    @alexT Sure. Please see the edit.
    – user11232
    Feb 18, 2015 at 8:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .