TeX - LaTeX Asked on February 2, 2021
I have:
What do I have to set, that x-units (0,1,2,…,24) have the same width as the height of the y-units (100,…,800).
So that the grid’s rectangles becomes squares like here
Is there something with
%axis equal,
%unit vector ratio=1 1,
%x=0.1cm*3, y=0.001cm*3,
MWE:
documentclass[border=5pt, tikz]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=newest}
usepackage{siunitx}
sisetup{per-mode=fraction,
%fraction-function=tfrac
}
begin{document}
begin{tikzpicture}[font=footnotesize,
]
begin{axis}[
xlabel={$t, [si{hour}]$},
ylabel={$displaystyle f(t), left[ si{metrecubedperhour} right]$},
title={$f(t)=frac14 t^3 -12t^2 +144t +250$},
axis lines=middle, % so kein Ursprung
axis x line=bottom, % so ein Ursprung
%axis equal,
%unit vector ratio=1 1,
%x=0.1cm*3, y=0.001cm*3,
xmin=0, xmax=25.5,
ymin=0, ymax=800,
xtick={0,2,...,24},
ytick={100,200,...,800},
xlabel style={anchor= south east},
ylabel style={anchor= north west},
grid=major,
%enlarge x limits={abs=1.1, upper},
enlarge y limits={rel=0.1, upper},
]
addplot[thick, smooth, samples=222, domain=0:25, variable=t] {0.25*t^3-12*t^2+144*t+250};
end{axis}
end{tikzpicture}
end{document}
If what you want is that the division on the x-axis (that are 13) have the same size as the ones of the y-axis (8), you can do the following:
enlarge y limits
scale only axis
, which will apply width
and length
just to the axisdocumentclass[border=5pt, tikz]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=newest}
usepackage{siunitx}
sisetup{per-mode=fraction,
%fraction-function=tfrac
}
begin{document}
begin{tikzpicture}[font=footnotesize,
]
begin{axis}[
xlabel={$t, [si{hour}]$},
ylabel={$displaystyle f(t), left[ si{metrecubedperhour} right]$},
title={$f(t)=frac14 t^3 -12t^2 +144t +250$},
axis lines=middle, % so kein Ursprung
axis x line=bottom, % so ein Ursprung
scale only axis,
% 6.15cm = 10cm * hor_division * vert_divisions =10cm/13*8
width=10cm, height=6.15cm,
xmin=0, xmax=26,
ymin=0, ymax=800,
xtick={0,2,...,26},
ytick={100,200,...,800},
xlabel style={anchor= south east},
ylabel style={anchor= north west},
grid=major,
]
addplot[thick, smooth, samples=222, domain=0:25, variable=t] {0.25*t^3-12*t^2+144*t+250};
end{axis}
end{tikzpicture}
end{document}
Answered by Rmano on February 2, 2021
I solved it this way:
pgfmathsetlengthmacrou{6.5mm}
and then
x=0.5*u, y=0.01*u
documentclass[border=5pt, tikz]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=newest}
usepackage{siunitx}
sisetup{per-mode=fraction,
%fraction-function=tfrac
}
pgfmathsetlengthmacrou{6.5mm}
begin{document}
begin{tikzpicture}[font=footnotesize,
]
begin{axis}[
xlabel={$t, [si{hour}]$},
ylabel={$displaystyle f(t), left[ si{metrecubedperhour} right]$},
title={$f(t)=frac14 t^3 -12t^2 +144t +250$},
axis lines=middle, % so kein Ursprung
axis x line=bottom, % so ein Ursprung
x=0.5*u, y=0.01*u,
xmin=0, xmax=25.5,
ymin=0, ymax=800,
xtick={0,2,...,24},
ytick={100,200,...,800},
xlabel style={anchor= south east},
ylabel style={anchor= north west},
grid=major,
%enlarge x limits={abs=1.1, upper},
enlarge y limits={rel=0.1, upper},
]
addplot[thick, smooth, samples=222, domain=0:25, variable=t] {0.25*t^3-12*t^2+144*t+250};
end{axis}
end{tikzpicture}
end{document}
Answered by cis on February 2, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP