我正在尝试使用 tikz 数据可视化绘制一个简单的图形,但遇到了“尺寸太大”。
\documentclass[a4paper,10pt]{book}
\usepackage{tikz}
\usetikzlibrary{datavisualization.formats.functions}
\begin{document}
\tikz \datavisualization [scientific axes=clean, visualize as smooth line]
data [format=function] {
var x : interval [1338:5500] samples 100;
func y = (1000000 / \value{x} - 28 - 137.4) * 64 * 1.25;
};
\end{document}
关于如何修复此问题我有什么想法吗?
答案1
逐字复制自 tex.stackexchange.com/a/518311。
\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{datavisualization.formats.functions}
\newcommand{\pgfmathparseFPU}[1]{\begingroup%
\pgfkeys{/pgf/fpu,/pgf/fpu/output format=fixed}%
\pgfmathparse{#1}%
\pgfmathsmuggle\pgfmathresult\endgroup}
\begin{document}
\begin{tikzpicture}
\datavisualization [scientific axes=clean, visualize as smooth line,
/pgf/data/evaluator=\pgfmathparseFPU]
data [format=function] {
var x : interval [1338:5500] samples 100;
func y = (1000000 / \value{x} - 28 - 137.4) * 64 * 1.25;
};
\end{tikzpicture}
\end{document}
答案2
这是另一种选择pgfplots
\documentclass[a4paper]{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
domain =1338:5000,
samples=100,
]
\addplot[smooth] {1000000 / x - 28 - 137.4) * 64 * 1.25};
\end{axis}
\end{tikzpicture}
\end{document}