1

currently trying to make a graph with the forumla 0.5+(2x/3) but it does not seem to be correct? This is the code I am using (sorry if it looks bad :D)

\begin{tikzpicture}
    \begin{axis}[
        title={\texttt{Vatten hastighet från kant till mitt}},
            xlabel=$Meter från kant (m)$,
            ylabel={$v (m/s)$},
            xmin=0,
            xmax=3
    ] 
            \addplot[color=red] {0.5 + 2*x/3 };
    \end{axis}
\end{tikzpicture}

enter image description here

It is not correct, it should start at 0.5?

  • Try forcing ymin=0 – bonanza Apr 28 '16 at 15:56
  • Just for the record: the plot was and is right. The 0 you see on the axis is only the origin of the x axis but not of the y axis. This is changed by the above setting. – bonanza Apr 28 '16 at 16:03
  • Yeah I noticed that now, thank you again :-) – Johan von Hacht Apr 28 '16 at 16:05
  • Don't mark questions with [solved], this is not a forum. You can ask @bonanza to post an answer or post it yourself. – Alenanno Apr 29 '16 at 14:47
  • Also, don't write text in math mode, as you have done with the x label. If you want italics, use for example \textit{...}. Otherwise write xlabel={Meter från kant (m)},ylabel={$v$ (m/s)}. – Torbjørn T. Apr 29 '16 at 17:39
4

The plot is correct, in order to see the the origin include ymin=0, i.e.:

\begin{tikzpicture}
    \begin{axis}[
        title={\texttt{Vatten hastighet från kant till mitt}},
            xlabel=$Meter från kant (m)$,
            ylabel={$v (m/s)$},
            ymin=0,
            xmin=0,
            xmax=3
    ] 
            \addplot[color=red] {0.5 + 2*x/3 };
    \end{axis}
\end{tikzpicture}
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.