2

Right. Total novice here so you might need to go easy.

I'm trying to use Gnuplot with TikZ to draw an elliptic curve. Using TeXShop 3.58, Gnuplot 5.0 patchlevel 1... don't know what else is relevant.

Trying to use the following code to test the process:

\begin{tikzpicture}
\draw[very thin,color=gray] (-1.9,-3.9) grid (3.9,3.9);
\draw[->] (-2,0) -- (4.2,0) node[right] {$x$};
\draw[->] (0,-4.2) -- (0,4.2) node[above] {$y$};
\draw plot[id=curve, raw gnuplot, smooth] function{
f(x,y) = y**2 - x**3 + x;
set xrange [-4:4];
set yrange [-4:4];
set view 0,0;
set isosample 1000,1000;
set table;
set size square;
set cont base;
set cntrparam levels incre 0,0.1,0;
unset surface;
splot f(x,y)
};
\end{tikzpicture}

(This is taken from the article at https://pbelmans.wordpress.com/2010/11/11/howto-draw-algebraic-curves-using-pgftikz/.)

The output shows only the axes and gridlines, but no curve, as follows:

Output

Absolutely no idea where to start with this. Anyone have any thoughts?

==============

EDIT 29/11/2015

\documentclass[10pt,a4paper,twoside]{article}

\usepackage{amsmath, amssymb}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage[pdftex]{graphicx}
\input xy
\xyoption{all}
\usepackage{tikz}
\usepackage{pgfplots} \pgfplotsset{compat=1.7}
\usetikzlibrary{external}
\tikzexternalize[prefix=tikz/]
\usepackage{gnuplot}

\begin{document}

\begin{figure}
\centering
\begin{tikzpicture}
  \draw[very thin,color=gray] (-1.9,-3.9) grid (3.9,3.9);
  \draw[->] (-2,0) -- (4.2,0) node[right] {$x$};
  \draw[->] (0,-4.2) -- (0,4.2) node[above] {$y$};
  \draw plot[id=curve, raw gnuplot, smooth] function{
    f(x,y) = y**2 - x**3 + x;
    set xrange [-4:4];
    set yrange [-4:4];
    set view 0,0;
    set isosample 1000,1000;
    set table;
    set size square;
    set cont base;
    set cntrparam levels incre 0,0.1,0;
    unset surface;
    splot f(x,y)
  };
\end{tikzpicture}
\end{figure}

\end{document}
  • Welcome to TeX.SX! Can you please make the code snippet into a full compilable document from \documentclass to \end{document}? – egreg Nov 27 '15 at 23:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.