This is a follow-up question to this question. Thanks to the answers given there I have the following code now
\documentclass{beamer}
\usetheme{metropolis} % Use metropolis theme
\usepackage[english,ngerman]{babel} % the new way
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{pgfplots}
\usepackage{tikz}
\begin{document}
\begin{figure}[!htb]
\vspace{-0.5cm}
\centering
\begin{tikzpicture}
\begin{axis}[
xmin=-6.067, xmax=6.433,
ymin=-1.3,ymax=2.2,
scatter/classes={a={mark=o,draw=black}},
xlabel={$x$},
ylabel={$y$},
scale=0.9
]
\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)};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
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):
Now I would like to achieve the following:
- I would like to remove the vertical line at the start point of each vector.
- 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.
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.