1

I have:

enter image description here

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

enter image description 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{\metre\cubed\per\hour} \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}
0

2 Answers 2

1

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:

  1. remove automatic scaling of the axis, like enlarge y limits
  2. use scale only axis, which will apply width and length just to the axis
  3. choose a vertical and a horizontal width proportional to the number of divisions.
\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{\metre\cubed\per\hour} \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}

enter image description here

0

I solved it this way:

\pgfmathsetlengthmacro\u{6.5mm}

and then

x=0.5*\u, y=0.01*\u

enter image description here

\documentclass[border=5pt, tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepackage{siunitx}
\sisetup{per-mode=fraction,
%fraction-function=\tfrac
}

\pgfmathsetlengthmacro\u{6.5mm}

\begin{document}
\begin{tikzpicture}[font=\footnotesize,
]
\begin{axis}[
xlabel={$t\, [\si{\hour}]$},
ylabel={$\displaystyle f(t)\, \left[   \si{\metre\cubed\per\hour} \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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .