Three-Dimensional Plot

Hi, I want to learn how to produce a three-dimensional plot in Gauss. Can Gauss make it? If so, can you please illustrate how to make it and what is required to make it? Thanks!

3 Answers



0



GAUSS can create surface and contour plots. Here is some code to create a simple surface plot.

// Create data
y = seqa( -4, 0.1, 80);
x = y';
z = sin(y)*cos(y)';

// Plot data using default
// settings from Tools->Preferences->Graphics
plotSurface( x, y, z );

You can also run the example file plotspline.e, which is another surface plot example that comes with GAUSS.

aptech

1,773


0



That is great and the plot looks fantastic, but what if z is a one-dimensional vector like x and y?



0



Well plotSurface is not really designed to draw lines, but any z values which contain a missing value will be invisible. So you could fill in only the z values that you want like this:

// Create data
y = seqa( -4, 0.1, 80);
x = y';

// Line we want to draw
tmp = sin(y);

// Create matrix of missing values
z = reshape(error(0), rows(y), cols(x));

// Fill two columns of 'z' with the line we want to draw
// because a line using only 1 column will be hard to see
z[.,9 10] = reshape(tmp, rows(tmp), 2);

plotSurface( x, y, z );

The line does not have to be just down a row or column, but that just makes for the simplest example.

aptech

1,773

Your Answer

3 Answers

0

GAUSS can create surface and contour plots. Here is some code to create a simple surface plot.

// Create data
y = seqa( -4, 0.1, 80);
x = y';
z = sin(y)*cos(y)';

// Plot data using default
// settings from Tools->Preferences->Graphics
plotSurface( x, y, z );

You can also run the example file plotspline.e, which is another surface plot example that comes with GAUSS.

0

That is great and the plot looks fantastic, but what if z is a one-dimensional vector like x and y?

0

Well plotSurface is not really designed to draw lines, but any z values which contain a missing value will be invisible. So you could fill in only the z values that you want like this:

// Create data
y = seqa( -4, 0.1, 80);
x = y';

// Line we want to draw
tmp = sin(y);

// Create matrix of missing values
z = reshape(error(0), rows(y), cols(x));

// Fill two columns of 'z' with the line we want to draw
// because a line using only 1 column will be hard to see
z[.,9 10] = reshape(tmp, rows(tmp), 2);

plotSurface( x, y, z );

The line does not have to be just down a row or column, but that just makes for the simplest example.


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.