1

I have a plot that looks like this:

my graph

I want to achieve something like this in efficient way:

graph I want

As shown, I want vertical red bars or lines from each point on the straight line.

My code:

\documentclass[tikz,border=3mm]{standalone}

\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
    \begin{axis}[
        xmin=0,
        xmax=9.5,
        ymin=-5,
        ymax=105,
    ]
        \addplot[only marks] table [x=x_k,y=T_k]{
            x_k T_k
            1   15.6
            2   17.5
            3   36.6
            4   43.8
            5   58.2
            6   61.6
            7   64.2
            8   70.4
            9   98.8
        };
        \addplot[thick,black,domain=1:9,samples=1000]{4.8+9.41*x};
    \end{axis}
\end{tikzpicture}

\end{document}

SolidMark
  • 1,389

0 Answers0