1

I am drawing a function using raw gnuplot in pgfplots and I am not able to make the lines thicker and to change the colour (for instance grey).

My example is the following:

\begin{tikzpicture}
    \begin{axis}[xmin=-2,xmax=2,ymin=-2,ymax=2]
        \draw plot[id=curve,raw gnuplot] function{
            f(x,y) = (y**2 + x**2) - 0.5;
            set xrange [-1:1];
            set yrange [-1:1];
            set view 0,0;
            set isosample 1000,1000;
            set cont base;
            set cntrparam levels discrete 0; 
            unset surface;
            splot f(x,y)
        };
    \end{axis}
\end{tikzpicture}

Even though in the example I am showing a circumference I would like to use raw gnuplot since for some examples the function may become also an ellipse.

Many thanks.

2

Not sure what you tried, but line styles are set using the normal pgfplots/TikZ options, e.g. \addplot [blue, ultra thick, raw gnuplot] .... (I think it makes more sense to use \addplot than \draw plot, since it's inside an axis.)

\documentclass{standalone}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
    \begin{axis}[
         xmin=-2,xmax=2,
         ymin=-2,ymax=2
         ]

    \addplot [ % <-- changed
         gray, thick, % <-- added
        id=curve,raw gnuplot
        ]
           function{
            f(x,y) = (y**2 + x**2) - 0.5;
            set xrange [-1:1];
            set yrange [-1:1];
            set view 0,0;
            set isosample 1000,1000;
            set cont base;
            set cntrparam levels discrete 0; 
            unset surface;
            splot f(x,y)
        };
    \end{axis}
\end{tikzpicture}

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.