我有一个简单的问题。我制作了下面的 pgfplot。但不知何故,所有函数都只显示 x 值为 5。当定义
[
width=10cm, height=7.5cm,
xmin=0, xmax=30,
ymin=0, ymax=100,
xlabel=Zeit / min,
ylabel= Temperatur / °C,
]
没有。有人知道这是什么原因吗?
\documentclass[paper=a4,12pt,version=last,landscape]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\usepackage{color}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width=10cm, height=7.5cm,
xmin=0, xmax=30,
ymin=0, ymax=100,
xlabel=Zeit / min,
ylabel= Temperatur / °C,
]
\addplot+[
no markers,
ultra thick,
color=red,
ultra thick,
%] coordinates{(0,85) (25,10)};
]{-3*x+80};
\addplot+[
sharp plot,
no markers,
color=blue,
ultra thick,
]{-2.033*x+80};
\addplot+[
no markers,
color=magenta,
ultra thick,
]{x^2};
\end{axis}
\end{tikzpicture}
\end{document}
答案1
包括domain=0:30
。默认域是-5:5
,因此您的图将停止在x=5
。
\documentclass[paper=a4,12pt,version=last,landscape]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\usepackage{color}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width=10cm, height=7.5cm,
xmin=0, xmax=30,
ymin=0, ymax=100,
xlabel=Zeit / min,
ylabel= Temperatur / °C,
domain=0:30
]
\addplot+[
no markers,
ultra thick,
color=red,
ultra thick,
%] coordinates{(0,85) (25,10)};
]{-3*x+80};
\addplot+[
sharp plot,
no markers,
color=blue,
ultra thick,
]{-2.033*x+80};
\addplot+[
no markers,
color=magenta,
ultra thick,
]{x^2};
\end{axis}
\end{tikzpicture}
\end{document}