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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 How to plot different part of worksheet together

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
olsy Posted - 10/24/2011 : 09:41:37 AM
Origin Ver. and Service Release (Select Help-->About Origin):Pro 8.5
Operating System:win7

Hi again!
and one more question about plotting.
I have the sheet with data:

What i would like to plot is:SF as a X Axis and Jsc,Voc,FF,PCE, Rs, Rp as Y Axis. But take in account temperature as a data set parameter.
So i would like to have 7 different curves (like 7 different temperatures) on one graph for each Y.

Is it possible to do like this?
I found this topic but somehow it doesn´t work for me http://www.originlab.com/forum/topic.asp?TOPIC_ID=4754

now i use this programm:
Worksheet wksdata("[Sun-Results.xls]Statistics");
	GraphPage gp;
	gp.Create("Origin");
 
	while(gp.Layers.Count() < 6)
	{
	    gp.AddLayer();
	}
	 
	graph_arrange_layers(gp, 3, 2);
	// Add XY data from worksheet to graph each layers
	
	int index = 4;
	foreach(GraphLayer gl in gp.Layers)
	{
	    DataRange dr;
	    dr.Add(wksdata, 1, "X");
	    dr.Add(wksdata, index+1, "Y");
	    
	    if( gl.AddPlot(dr, IDM_PLOT_SCATTER) >= 0 )
	        gl.UngroupPlots(0);  // ungroup plots
	    	gl.Rescale();
	    	Tree tr;
	    	tr.Root.Curves.Curve1.Line.Color.nVal = 0; // red
	        tr.Root.Curves.Curve1.Line.Width.dVal = 10;
	        if( 0 == gl.UpdateThemeIDs(tr.Root) ) // if no err
	        {
	            gl.ApplyFormat(tr, true, true);
	        }
        
	GraphObject gobj;
	// Point to X axis label object which has name XB, and change its font
	gobj = gl.GraphObjects("XB");
	gobj.Label.Font.Size.nVal = 36;
	// Point to Y axis label object which has name YL, and change its font
	gobj = gl.GraphObjects("YL");
	gobj.Label.Font.Size.nVal = 36;
	// Point to Legend label object which has name Legend, and change its font
	gobj = gl.GraphObjects("Legend");
	gobj.Label.Font.Size.nVal = 36;
	
	// Can see what properties exist by loading into tree and dumping to script window
	Tree trFormat;
	trFormat = gobj.Label;
	out_tree(trFormat);
					 
	LT_execute("layer1.x.label.pt=36"); // set X axis tick label font size to 28 in layer 1
	LT_execute("layer2.x.label.pt=36"); // set X axis tick label font size to 28 in layer 1
	LT_execute("layer3.x.label.pt=36"); // set X axis tick label font size to 28 in layer 1
	LT_execute("layer4.x.label.pt=36"); // set X axis tick label font size to 28 in layer 1
	LT_execute("layer5.x.label.pt=36"); // set X axis tick label font size to 28 in layer 1
	LT_execute("layer6.x.label.pt=36"); // set X axis tick label font size to 28 in layer 1
    
	LT_execute("layer1.y.label.pt=36"); // set Y axis tick label font size to 28 in layer 1
	LT_execute("layer2.y.label.pt=36"); // set Y axis tick label font size to 28 in layer 1
	LT_execute("layer3.y.label.pt=36"); // set Y axis tick label font size to 28 in layer 1
	LT_execute("layer4.y.label.pt=36"); // set Y axis tick label font size to 28 in layer 1
	LT_execute("layer5.y.label.pt=36"); // set Y axis tick label font size to 28 in layer 1
	LT_execute("layer6.y.label.pt=36"); // set Y axis tick label font size to 28 in layer 1
        
    index++;

}


Help please!
2   L A T E S T    R E P L I E S    (Newest First)
jamesmorison2011 Posted - 10/25/2011 : 08:35:09 AM
I had the same issue. Thanks for this thread.
All the best.
Penn Posted - 10/25/2011 : 12:06:28 AM
Hi,

I have tried the code in the post you mentioned, I have changed the line

DataPlot dp = gly.DataPlots(-1);

to

DataPlot dp = gly.DataPlots(0);

then it works in Origin 8.5.

In your code, I found a lot of problems.

1. You said SF as X axis, Jsc, Voc, FF, PCE, Rs, Rp as Y axis, however, in the line dr.Add(wksdata, index+1, "Y");, with index=4, it will start from F column, that is FF, so, it cannot cover Jsc and Voc.

2. In the line if( gl.AddPlot(dr, IDM_PLOT_SCATTER) >= 0 ), you have added a scatter plot to the layer, then, why try to set the color of line (no line plot in the graph) in the line tr.Root.Curves.Curve1.Line.Color.nVal = 0;. Also not able to set the width.

3. You have only add one plot into the layer, then no grouped data plots in the layer, no need to use gl.UngroupPlots(0);.

4. The code about the GraphObject, I am not sure what you want to do.

5. You said you wanted to take in account temperature as a data set parameter. Then how do you want it to work? As group IDs?

So, I think you can still refer to the post you have mentioned. The sample code has included how to add plot to layer, and then get the plot of the layer and set the subset of the data range. If the temperature you mentioned is used to separate each group data, you can get the subset indice by the temperature column.

Penn

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000