3

The following is my code:

\documentclass[12pt]{article}

\usepackage{tkz-fct}

\begin{document}
\begin{tikzpicture}[]
    \tkzInit[xmin=-5,xmax=5,ymax=2]
    \tkzGrid
    \tkzAxeXY
    \tkzFct[color=red,domain=0:2]{2*x**2/(x**2+1)}
    \tkzFct[color=blue,domain=0:2]{x**2}
\end{tikzpicture}
\end{document}

The result is: enter image description here

So why only one plot is displayed here?

Thank you!!!

Alain Matthes
  • 95,075
Catjazz
  • 51
  • 3
  • Welcome! I fail to reproduce your observation. When I compile this I get both plots, the blue one as shown in the screen shot, and an additional red plot. –  May 03 '20 at 02:28
  • 1
    I have the two plots too!. You don't need to call Tikz ! What is your version of tkz-fct? – Alain Matthes May 03 '20 at 04:51
  • @AlainMatthes the package tkz-fct is the latest version, I don't know if there is problem with the way of compilation, I use XeLaTeX – Catjazz May 04 '20 at 07:58
  • I use pdflatex xelatex and lualatex. I compile the documentation with lualatex. I create id only to use other macro (for example to place a point) – Alain Matthes May 04 '20 at 09:28
  • You must allow Latex to launch gnuplot, otherwise the tkzfct.gnuplot file contains only the last function and when you launch gnuplot in the terminal, you get the table of a single function. Try pdflatex --shell-escape nameourfile.tex – pascal974 Jan 28 '23 at 06:33

1 Answers1

2

Thank you every one, I have solved my problem by adding id=n to the options of \tkzFct, and n is the number of function, as shown below:

\documentclass[12pt]{article}

\usepackage{tkz-fct}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}

\begin{document}
\begin{tikzpicture}[]
    \tkzInit[xmin=-5,xmax=5,ymax=2]
    \tkzGrid
    \tkzAxeXY
    \tkzFct[id=1,color=red,domain=0:2]{2*x**2/(x**2+1)}
    \tkzFct[id=2,color=blue,domain=0:2]{x**2}
    \tkzFct[id=3,color=yellow,domain=0:4]{(2+x**2)/(exp(x))}
\end{tikzpicture}
\end{document}

The result is: enter image description here

Thanks for again!!

Catjazz
  • 51
  • 3