The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 adding matrix data to a 3d plot
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Voostra

USA
Posts

Posted - 03/21/2005 :  8:32:13 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin):
Operating System:

So, I had some data in a worksheet, created a new matrix, then did some transformations on the worksheet before moving the data into the matrix (a matrix page in the project. and a Matrix matA)

The short of the problem is - I have been able to generate a graph page using a template for for the kind of 3d plot I want, and have added a graphlayer gly, I defined a matix object based on the matrixlayer where I though the data was, then tried to :

gly.AddPlot(matrixlayer)

But, it doesn't do anything. I get the graph window opened up, and a blank 3-d plot, but no data.

I'm hoping there is an easy way to add matrix data to 3-d plot graphlayer?

(On another note, is there an easy way to switch which layer is the active layer - i.e. if I have a worksheet, a matrix and a graph page in a project, is there an easy way to make one of them active? , also, is there an easy way to change the name of an active layer?)

Pretty new at this... thank for the help,
Evan

(sorry if this is a double post, first one didn't seem to go through)

edsger

Netherlands
Posts

Posted - 03/22/2005 :  08:20:40 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
well I was not sure if you meant a surface plot. but if that is what you mean then you might try this. Note that the values should be evenly spread between the X and Y axis
 
// worksheet with the data
Worksheet wks("surface");

// create matrixpage to accomodate the data
MatrixPage mp("matrix1");
mp.Create("origin");
MatrixLayer mly = mp.Layers(0);
Matrix matA(mly);

// copy data to matrix
matA.CopyFromWks(wks);

// define X axis values and Y axis values for surface
matA.Xmin = -10;
matA.Xmax = 10;
matA.Ymin = 0;
matA.Ymax =100;

MatrixObject mobj = mly.MatrixObjects();

// create graph
GraphPage gp;
gp.Create("Wirefrm");// important!!

GraphLayer glay = gp.Layers();
// plot surface and indicate that it should be a
// IDM_PLOT_SURFACE_COLORMAP for colormap
// or IDM_PLOT_SURFACE_WIREFRAME for WIREFRAME
//
int nPlot = glay.AddPlot(mobj, IDM_PLOT_SURFACE_COLORMAP);
glay.Rescale();


unfortunately this is not documented well
(or at least I didn't find it yet but with a little common sense and some post from the forum I got the colormap to work)


Edited by - edsger on 03/24/2005 3:22:21 PM
Go to Top of Page

Voostra

USA
Posts

Posted - 03/22/2005 :  12:44:29 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Is there a list of the "IDM_PLOT_SURFACE_COLORMAP" definitions anywhere - I want to use some other types, but can't find a list to know what I need to plug in here.

Thanks,
Evan
Go to Top of Page

Voostra

USA
Posts

Posted - 03/22/2005 :  1:08:12 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
okay, scratch that - they're listed in the graph.h header file.
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000