I'm trying to make a contour plot with pgfplots
and gnuplot
, but I get the error "dimension too large". Why? That seems like a TeX error, I thought gnuplot
was doing the calculations?
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width=0.8\textwidth,
view={0}{90},
grid=major,
xlabel = $x$,
ylabel = $y$,
xmin=-2,
ymin=-2,
xmax=+2,
ymax=+2,
unit vector ratio = 1,
]
\addplot3[
contour gnuplot={
number=10,
contour label style={
nodes={text=black}
}
},
contour/draw color={black},
contour/label distance=1000pt,
thick,
samples=50]
{ 3*x^2 + 4*y^3 + 2*x^3 - 12*y };
\end{axis}
\end{tikzpicture}
\end{document}
If I add restrict z to domain=-20:30
(which should encompass all relevant output values of f(x,y)=3*x^2 + 4*y^3 + 2*x^3 - 12*y
in the given domain), an output is produced but with only one contour (not 10
contours as desired).
I'm expecting something similar to:
lualatex
engine?pdflatex -shell-escape
(my TextMate default).restrict z to domain=-20:30
(which I suspect is the relevant command in this case, since we're usingaddplot3
. Do you know why restricting z domain might be limiting the number of contours?