This is a follow-up question to this question. Thanks to the answers given there I have the following code now

\usetheme{metropolis} % Use metropolis theme
\usepackage[english,ngerman]{babel} % the new way

        xmin=-6.067, xmax=6.433,

        \addplot[scatter,only marks,mark size = 1pt,fill = red,scatter src=explicit symbolic]
        table {
            % some points go here...

        \addplot [|->, thick,  black]
        coordinates { (0,0) (3,1)};

        \addplot [|->, thick,  black]
        coordinates { (0,0) (-0.3,1)};


producing this output (please note that the missing arrow of the second vector seems to be a result of the Overleaf PDF export and is actually present in the preview): enter image description here

Now I would like to achieve the following:

  1. I would like to remove the vertical line at the start point of each vector.
  2. I would like to extend each vector such that they actually "touch" the axes of my plot (see the thin lines I added to the plot).

Any help is, as always, highly appreciated.

  • And what is stopping you? If you want to use Tikz/pgfplots, you need to have at least a basic understanding of what the code is doing. Arrows/line ends are defined in the addplot options (the square brackets) and the endpoints of your lines/vectors are defined by coordinates. Just change them according to what you want to achieve. You have already drawn in your thin lines (although I don't see the code that generates them), it should be easy to read off the coordinates.
    – Huang_d
    Jun 11, 2018 at 9:46
  • I "drew" those lines using Paint. You are right that I can simply look at the graph and use some hard numbers but I was under the impression that there is a nicer and cleaner way to do this by using some scaling option.
    – Hagbard
    Jun 11, 2018 at 10:06

1 Answer 1


I actually managed to solved this by simply adding a scaling factor and additional vectors with opposite signs:

    \addplot [-, thick,  black, dashed]
    coordinates { (0,0) (2.2*3,2.2*1)};

    \addplot [-, thick,  black, dashed]
    coordinates { (0,0) (2.2*-3,2.2*-1)};

    \addplot [-, thick,  black, dashed]
    coordinates { (0,0) (2.2*-0.3,2.2*1)};

    \addplot [-, thick,  black, dashed]
    coordinates { (0,0) (2.2*0.3,2.2*-1)};

You must log in to answer this question.

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