TransWikia.com

Change values on y-axis of plot

TeX - LaTeX Asked by CowNerd on March 27, 2021

I need the values on the y-axis to start from 0 instead of 5. How do I change this?

begin{tikzpicture}
begin{axis}[
    axis lines = left,
    xlabel = $t$,
    ylabel = {textit{lengte kaars in cm}},
]
%Below the red parabola is defined
addplot [
    domain=0:10, 
    samples=100, 
    color=red,
]
{35- 3*x};
addlegendentry{$textit{lengte kaars in cm} = 35 - 3t$}

addplot[mark=*, color=green] coordinates {(0,35)};

addplot[mark=*, color=blue] coordinates {(2, 29)};

end{axis}
end{tikzpicture}

One Answer

Just add the axes limits.

xx

begin{tikzpicture}
begin{axis}[
axis lines = left,
xlabel = $t$,
ylabel = {textit{lengte kaars in cm}},
ytick={0,5,...,35}, % <<<<<
ymin=0, % <<<<<
ymax=40, % <<<<< +5
xmin=0, % <<<<<
xmax=11, % <<<<< +1 
xtick={0,2,...,10},  % <<<<<
]
%Below the red parabola is defined
addplot [
domain=0:10, 
samples=100, 
color=red,
]
{35- 3*x};
addlegendentry{$textit{lengte kaars in cm} = 35 - 3t$}

addplot[mark=*, color=green] coordinates {(0,35)};

addplot[mark=*, color=blue] coordinates {(2, 29)};

end{axis}
end{tikzpicture}

I expanded the max limits a little for better looking of the head of the arrows.

Answered by Simon Dispa on March 27, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP