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
 Problem with 3D Colormap Surface.
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

scobypl

Poland
3 Posts

Posted - 06/28/2016 :  5:17:50 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,
I try to create graph 3D Colormap Surface for furnance with thermal sensors. I create worksheet with data where in first row I have Y data(width), in first column X data(length) and another cells contain value of temperature. I can create this manualy and set X and Y data range, but I can't do in Origin C.
I try do it like this:

DataRange dr;
dr.Add("X", Wtemp1, 1, 0, 3, 0); // First row except the first cell
dr.Add("Y", Wtemp1, 0, 1, 0, 3); // First column except the first cell
dr.Add("Z", Wtemp1, 1, 1, 3, 3);

GraphPage gp;
gp.Create("glcmap");
GraphLayer gl = gp.Layers(0);
gl.AddPlot(dr, IDM_PLOT_3D_SURFACE_NEW );

and also I try to put this DataRange to MatrixObject and use IDM_PLOT_3D_MESH for matrix.

Maybe someone can help me with my problem to create this graph or show simillar example to solve my problem.

Paweł W.



PW

Chris D

428 Posts

Posted - 06/29/2016 :  11:39:28 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Paweł,

I gather that you mean you have what we may refer to as a "virtual matrix" where the data is as in the image below. Column A is the X data and the rest of the columns contain Z data with the 1st row of each column being the Y value.



If that is the case, then the easier way is to leverage running the plotvm X-Function via LabTalk from within Origin C as follows. Note: this assumes you are plotting all the data in the worksheet. If you need only a subset of the worksheet, let us know.


GraphPage gp;
gp.Create("glcmap");
string strRange;
if (Wtemp1.GetRangeString(strRange))
{
	string strCmd;
	strCmd.Format("plotvm irng:=%s ogl:=! format:=0 rowpos:=2 colpos:=1 type:=%d", strRange, IDM_PLOT_3D_SURFACE_NEW);
}


Docs for plotvm X-Function: http://www.originlab.com/doc/X-Function/ref/plotvm

Thanks,
Chris Drozdowski
Originlab Technical Support
Go to Top of Page

scobypl

Poland
3 Posts

Posted - 06/30/2016 :  08:08:23 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,
this is exacly what I want, I try it and it's works like I need. Thanks you very much.

Now, I have one more problem, I want to set my surface as a flat(two the same surface but first must be flat and second normal), I see this options in plot setup and I also find commands to set this parameters:

spf value; Control the flatten-mode for 3D surface plot

Syntax: set name -spf value;

Specify whether to flatten the 3D surface plot. 1 = enable flatten-mode, 0 = disable flatten mode.

Minimum Origin Version Required: 9.0 SR0
-spz value; Set the Z offset by percent of the scale range for 3D surface plot


I don't now how exacly use it on my graph in my Origin C code. (I create mechanism to automatic draw many graphs)

Sorry, my problem is probably very easy but I don't know how to use it. I don't know how set the name in "set name " I tryed to write something like this set Graph1 -spf 1 and execute in command window where Graph1 is the name of my chart, but it isn't work.

PW
Go to Top of Page

Chris D

428 Posts

Posted - 06/30/2016 :  12:12:15 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

I think you mean you want a surface plot plus a flat projection of the same data. If so, then try this.

You can modify the example I provided by calling additional LabTalk in your Origin C code as follows:


	GraphPage gp;
	gp.Create("glcmap");
	string strRange;
	if (Wtemp1.GetRangeString(strRange))
	{
		string strCmd;
		strCmd.Format("plotvm irng:=%s ogl:=! format:=0 rowpos:=2 colpos:=1 type:=%d", strRange, IDM_PLOT_3D_SURFACE_NEW);
		LT_execute(strCmd);

		strCmd = "layer -ip103 %c; range rr = 2; set rr -spf 1; set rr -spz 100;";
		LT_execute(strCmd);
	}


NOTE: The 100 after -spf is the percent position for the projection in the 3rd dimension.

Thanks,
Chris Drozdowski
Originlab Technical Support
Go to Top of Page

scobypl

Poland
3 Posts

Posted - 07/12/2016 :  3:59:48 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,
sorry for no answer but I don't have time in last week.
Thanks you again for great help.

I have one more problem.
I build somethink like this:



And the first colum is X column and first row is the Y column. Another data is a Z values. Among the Z values I have empty cell where I don't have sensores to read temperature.



I need to plot 3D colormap surface from this data. But the graph what I was create, contain empty space.

I think that the solution could be interpolation unknown data on base the other data.

How I can do this ?
Thank you for your help.

PW

Edited by - scobypl on 07/12/2016 4:07:02 PM
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