TransWikia.com

Unable to use ymin to plot a curve using pgfplots

TeX - LaTeX Asked by Andros on February 8, 2021

I am experiencing difficulties to plot a curve using pgfplots. I am unable to remove the empty space under the x-axis.

Here is my code:

documentclass[11 pt]{article}
pagestyle{empty}
usepackage{tikz, pgfplots}

begin{document}
    
begin{figure}
centering
begin{tikzpicture}
begin{axis}[
axis y line = center,
axis x line = center,
xlabel = $x$,
ylabel = {$f(x)$},
thick,
xticklabels=empty,
yticklabels=empty,
xmin=-5.5,
xmax=5.5,
ymin=0,
ymax=3,
axis equal, 
grid,
]
addplot [
domain=-5.5:5.5, 
samples=100, 
color=colour3,
thick,
smooth,
]
{0.33*sin(10*deg(x))*x + 0.66*abs(x)};
end{axis}
end{tikzpicture}
        
end{figure}

end{document}

Here is the output

output

There is a lot of unused space under the x-axis despite that I used ymin=0. What did I do wrong?

One Answer

enter image description here

documentclass[11 pt]{article}
pagestyle{empty}
usepackage{tikz, pgfplots}

begin{document}
    
begin{figure}
centering
begin{tikzpicture}
begin{axis}[
axis y line = center,
axis x line = center,
xlabel = $x$,
ylabel = {$f(x)$},
thick,
xticklabels=empty,
yticklabels=empty,
xmin=-5.5,
xmax=5.5,
ymin=0,
ymax=6,
%axis equal, 
grid,
]
addplot [
domain=-5.5:5.5, 
samples=100, 
%color=colour3,
thick,
smooth,
]
{0.33*sin(10*deg(x))*x + 0.66*abs(x)};
end{axis}
end{tikzpicture}
        
end{figure}

end{document}

Answered by js bibra on February 8, 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