How to plot the real line in SageMath
I am preparing a SageMath Jupyter notebook for expository purposes. I would like to be able to display the real line, with chosen points on it, and some arrows between certain pairs of points.
While this would be easy to do in LaTeX (by means of TikZ), I do not know how to do it in Sage. This feels like something that should be well within Sage's capabilities. What to do?
Let me give an easy, concrete example. Say I want to plot the points -5/11 + \beta, -4/11 + \beta,..., 5/11+\beta (labelled as such) on the real line, where $\beta = 1/50$ (for instance).
In a second version of the graph, I also want curved arrows going from -5/11+\beta to -4/11+\beta, from -4/11+\beta to -3/11+\beta, and so on until -2/11+\beta to -1+\beta; I also want a curved arrow from -1+\beta to 0.
How to do this?
Update: Let me include some (extremely amateurish) TikZ code, so that people can see exactly what I want:
\begin{tikzpicture}
\def\scale{2}
\def\bet{0.2}
\draw[-] (-\scale*3.5,0) -- (\scale*3.5,0);
\foreach \i in {-3,...,3} {
\draw[shift={(\scale*\i,0)},color=gray] (0pt,0pt) -- (0pt,-3pt) node[below] {$\frac{\i}{q}$};
\filldraw (\scale*\i+\scale*\bet,0) circle (2pt) node[above] {$\frac{\i}{q}+\beta$};
}
\foreach \i in {-3,...,-2} {
\draw[*->*] (\scale*\i+\scale*\bet-0.08,0.04) to[bend right] (\scale*\i+\scale*\bet+\scale+0.08,0.04);
}
\draw[*->] (-\scale+\scale*\bet-0.08,0.04) to[bend right] (0,0);
\end{tikzpicture}
I'd gladly include the result here, but I do not yet have enough points to upload files :(.
Of course I can just include the resulting image in my Jupyter notebook, but for some reason Jupyter is refusing to display vector graphics, and will display the image only if it is very low-resolution. Wouldn't it be nice if there were a way to do this within Sage...
Since you don't tell us what you want to plot and how, it's pretty difficult to venture even a hint.
FWIW, look up
text?
,line?
andarrow?
... Alternatively, give us some more information.Hi @Garald
I propose something like that first, because as @Emmanuel Charpentier points out, your request is not very clear.
code on sageCell
Sorry if it is not convenient, then precise your demand. you can add line with code below:
do you want plot in 3D ?,2D ?
Just added some information.
I ask myself if you are trolling, if not, look here: plotting tutorial.