我知道有类似的问题,但由于它们使用的语法与我尝试的语法不完全相同,所以我看不出我编写函数的方式与其他方式有什么不同。以下是我正在尝试做的事情:
\documentclass[13pt,a4paper,headlines=6,headinclude=true]{scrartcl}
\usepackage{amsmath,amssymb,stmaryrd}
\usepackage{tikz,pgfplots}
\usetikzlibrary{datavisualization.formats.functions}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{tikzpicture}[yscale=.5, xscale=.5, scale=3.5]
\datavisualization
[school book axes,
legend={below,rows=1},
visualize as smooth line/.list={f1,f2},
f1={style=blue, style=very thick,label in legend={text=$\frac{1}{x-1}$}},
f2={style=green, style=very thick,label in legend={text=$\frac{1}{x^2 - 7x - 30}$}}
]
data [set=f1, format=function] {
var x : interval[0.5:4];
func y = 1/(\value{x}-1);
}data [set=f2, format=function] {
var x : interval[0.5:4];
func y = \frac{1}{x^2 - 7x - 30};
};
\end{tikzpicture}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
我需要更改什么?谢谢
func y = 1/(\value x - 1)
其结果是: