1
votes

What I'm trying to achieve is to have a 3D graph defined by function and of top that a set of points defined by their coords. To draw a 3D graph I use pm3d option which cannot be used to draw individual points, but I found out it should be possible to combine more types of graphs into one by using "explicit" option. So I tried to do:

GnuPlot.Set("pm3d explicit");
GnuPlot.Set("isosamples 80");
GnuPlot.Set("autoscale");
GnuPlot.Unset("surface");
GnuPlot.Set("contour base");
GnuPlot.SPlot("x**2 + y**2 with pm3d");

But I only got error:

gnuplot> splot x**2 + y**2 with pm3d with lines
                                     ^
         line 0: duplicated or contradicting arguments in plot options

Where I don't know where "with lines" came from.

The second thing I don't know is how to combine set of points with function text in SPlot - doing each of these things separately is easy with

public static void SPlot(double[] x, double[] y, double[] z, string options = "")
public static void SPlot(string filenameOrFunction, string options = "")

but together...is there a way to write array of points as a string for this purpose or am I supposed to use

public static void Plot(List<StoredPlot> storedPlots)

somehow?

Thank you for answers...

1
Where is your GnuPlot class defined? Which library do you use? - Christoph

1 Answers

0
votes

You must use

GnuPlot.SPlot("x**2 + y**2", "with pm3d");

The plotting options must be given in the second argument, otherwise the defaults are appended, which is with lines.

To plot a function and a set of points, the following should work:

GnuPlot.HoldOn();
GnuPlot.SPlot(" x**2 + y**2", "with pm3d");
GnuPlot.SPlot(x, y, z, "with points");