Plot surface camera and other questions

Hello,

 

I am using
plotsurface(myPlot1, w_grid_M', w_grid_M, varget("P_"+gender[2]$+"_mee_"$+educ[2]$+educ[2]));

And I find that the best camera angle is "Behind High", but I have to do it manually in the Graph Settings, is there any way to code the camera angle.

On the other hand, I have a matrix with values between 1 and 6.  I am using plotContour(myPlot, w_grid_M', w_grid_M, z); for the matrix z, but the resulting graph is super ugly, and I would like to have like solid colors for the 1-6 values. I couldn't attach the graph that I have, but any help in this area is highly appreciated.

 

 

4 Answers



0



Surface camera angle

There is no convenience function to control the camera angle used by plotSurface. However, you can programmatically control the camera angle by directly modifying the surface.cameraAngle member of the plotControl structure. Here is a brief example:

new;

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

struct plotControl myPlot;
myPlot = plotGetDefaults("surface");

// Set camera angle to 'Behind high'
myPlot.surface.cameraAngle = 11;
plotSurface(myPlot, x, y, z );

Contour line control

You can control the line colors of a contour plot drawn with plotContour by using either plotSetLineColor or plotSetColormap. plotSetColormap can use magma, viridis, plasma as well as all of the color palettes shown here.

Note that you should use one or the other. If you use both then the second one will overwrite the changes of the first.

Below is an example that also controls the heights at which contour lines are drawn in case that is helpful.

new;
x = seqa(1, 1, 10);
z = reshape(x, 10, 10);

struct plotControl myPlot;
myPlot = plotGetDefaults("surface");

// Create the heights at which lines will be drawn
plotSetZLevels(&myPlot, 2|4|6|8);

/*
** Use either 'plotSetColorMap' or 'plotSetLineColor'
** NOT both
*/
plotSetColormap(&myPlot, "dark2");

// These lines will overwrite the color map.
// Comment out the next 4 lines if you want
// to use the 'dark2' color palette
blues = getColorPalette("blues");
print "The individual colors in the 'blues' palette are:";
print blues;
plotSetLineColor(&myPlot, blues);

plotContour(myPlot, x', x, z);

aptech

1,773


0



Thanks for the first answer.

For the second, Those are the graphs that I was able to produce, and I need something like solid for each cel of the matrix or something like that:

https://www.dropbox.com/s/s6i7gifbr41tlf7/mygraph_1.png?dl=0

https://www.dropbox.com/s/wi4f4rtixzpjzhb/mygraph_5.png?dl=0

And I want to do something like this:

https://www.dropbox.com/s/x3oibz5xnnaybpz/Marriage_SESE_M_leads_3.pdf?dl=0

By the way, how can I add horizontal/vertical lines to plots like these?

 

Thank you.



0



  1. You can add lines to contour plots with plotAddXY. Alternatively, you could use plotAddArrow and set the arrowhead size to zero, but I am not sure of any advantages of that over plotAddXY.

  2. It looks like those plots could be made more easily with a filled XY plot which is available in GAUSS 20. The stacked area charts from earlier versions (plotArea) might also work. We'd just have to think of a way to make the X and Y bounding coordinates from the Z matrix.

I think I could come up with something for that. Let me think about it.

aptech

1,773


0



Any ideas?

Your Answer

4 Answers

0

Surface camera angle

There is no convenience function to control the camera angle used by plotSurface. However, you can programmatically control the camera angle by directly modifying the surface.cameraAngle member of the plotControl structure. Here is a brief example:

new;

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

struct plotControl myPlot;
myPlot = plotGetDefaults("surface");

// Set camera angle to 'Behind high'
myPlot.surface.cameraAngle = 11;
plotSurface(myPlot, x, y, z );

Contour line control

You can control the line colors of a contour plot drawn with plotContour by using either plotSetLineColor or plotSetColormap. plotSetColormap can use magma, viridis, plasma as well as all of the color palettes shown here.

Note that you should use one or the other. If you use both then the second one will overwrite the changes of the first.

Below is an example that also controls the heights at which contour lines are drawn in case that is helpful.

new;
x = seqa(1, 1, 10);
z = reshape(x, 10, 10);

struct plotControl myPlot;
myPlot = plotGetDefaults("surface");

// Create the heights at which lines will be drawn
plotSetZLevels(&myPlot, 2|4|6|8);

/*
** Use either 'plotSetColorMap' or 'plotSetLineColor'
** NOT both
*/
plotSetColormap(&myPlot, "dark2");

// These lines will overwrite the color map.
// Comment out the next 4 lines if you want
// to use the 'dark2' color palette
blues = getColorPalette("blues");
print "The individual colors in the 'blues' palette are:";
print blues;
plotSetLineColor(&myPlot, blues);

plotContour(myPlot, x', x, z);

0

Thanks for the first answer.

For the second, Those are the graphs that I was able to produce, and I need something like solid for each cel of the matrix or something like that:

https://www.dropbox.com/s/s6i7gifbr41tlf7/mygraph_1.png?dl=0

https://www.dropbox.com/s/wi4f4rtixzpjzhb/mygraph_5.png?dl=0

And I want to do something like this:

https://www.dropbox.com/s/x3oibz5xnnaybpz/Marriage_SESE_M_leads_3.pdf?dl=0

By the way, how can I add horizontal/vertical lines to plots like these?

 

Thank you.

0

  1. You can add lines to contour plots with plotAddXY. Alternatively, you could use plotAddArrow and set the arrowhead size to zero, but I am not sure of any advantages of that over plotAddXY.

  2. It looks like those plots could be made more easily with a filled XY plot which is available in GAUSS 20. The stacked area charts from earlier versions (plotArea) might also work. We'd just have to think of a way to make the X and Y bounding coordinates from the Z matrix.

I think I could come up with something for that. Let me think about it.

0

Any ideas?


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.