I am using
plotsurface(myPlot1, w_grid_M', w_grid_M, varget("P_"+gender$+"_mee_"$+educ$+educ));
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.
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
plotSetColormap can use
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);
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:
And I want to do something like this:
By the way, how can I add horizontal/vertical lines to plots like these?
You can add lines to contour plots with
plotAddXY. Alternatively, you could use
plotAddArrowand set the arrowhead size to zero, but I am not sure of any advantages of that over
- 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.