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
 LabTalk Forum
 Plotting detaills

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
ONeilll Posted - 02/27/2011 : 09:56:18 AM
Hello!

I an importet file that gives me 73 Data point. They were importet into 2 coloums. The first is the x, the second the y information. I want to plot from the first data point to the 33th, and from the 33th to 73 rd in the same plot. Is this possible without taking the last values from 33th to 73 rd into two additional coloums? I have a lot of data to analyse. It would be not possible to do this by hand for each data.

I need to seperate the imported data, because I want to give them a different design. It should look like this:
http://img600.imageshack.us/i/soll.gif/
But at the moment its like this:
http://img20.imageshack.us/i/istr.gif/
Any idea? Thanks in advance.
Jack
13   L A T E S T    R E P L I E S    (Newest First)
ONeilll Posted - 06/15/2015 : 08:25:14 AM
Thank you very much, that works.

Cheers ONeilll
cdrozdowski111 Posted - 06/11/2015 : 11:25:20 AM
Yes, indeed you need to use ogl:=1 for the second call to plotxy.

Replace the code within the brackets with:

{
    // Declare range for next row after max to end of range
    range r2 = rCol3[$(nIdx+1):end];

    // Plot that range into same layer as previous plot
    plotxy iy:=r2 plot:=202 ogl:=1;
}
ONeilll Posted - 06/11/2015 : 04:00:56 AM
Hello again,

just one small featuere I would like to ad:
For another import I use the following syntax to rename the file and use a template for the design:

%A = page.info.system.import.filename$; //Get the filename
%B = %[%A, '.'];
plotxy iy:=((1,4)) plot:=202 ogl:=[<new template:= PRVPublikation name:= %A>]; // Plot data, rename the graph window

I tried to include this to the previous code, but this does not work because two different graphs were generated:
%A = page.info.system.import.filename$; //Get the filename
%B = %[%A, '.'];
// Create range for entire col 3
range rCol3 = col(3);
// stats X-Function will give us maximum value and number of rows
stats ix:=rcol3;
// Get row index of maximum value (or first occurrence of max value)
int nIdx = list(stats.max, rCol3);
// Declare range for row 1 to row index of max value
range r1 = rCol3[1:$(nIdx)];
// Plot that range
plotxy iy:=r1 plot:=202 ogl:=[<new template:= PRVPublikation name:= %A>];
// Check to make sure max value isn't the last row before making second plot
// If it is the last row, we don't need the second plot
if (nIdx < stats.n)
{
// Declare range for next row after max to end of range
range r2 = rCol3[$(nIdx):end];

// Plot that range into same layer as previous plot
plotxy iy:=r2 plot:=202 ogl:=[<new template:= PRVPublikation name:= %A>];
}
I suppose due to the missing ogl:=1 there are two graphs. Any suggestions? Many thanks in advance.

Cheers ONeilll
ONeilll Posted - 06/11/2015 : 02:10:46 AM
Hello Chris,

your code works thank you very much.

Kind regards
ONeilll
cdrozdowski111 Posted - 06/10/2015 : 11:18:23 AM
Hi,

I made some modifications to the code to reflect the older version of Origin you are using. The code below should work correctly for your version.

// Create range for entire col 2
range rCol2 = col(2);

// stats X-Function will give us maximum value and number of rows
stats ix:=rcol2;

// Get row index of maximum value (or first occurrence of max value)
int nIdx = list(stats.max, rCol2);

// Declare range for row 1 to row index of max value
range r1 = rCol2[1:$(nIdx)];

// Plot that range
plotxy iy:=r1 plot:=202;

// Check to make sure max value isn't the last row before making second plot
// If it is the last row, we don't need the second plot
if (nIdx < stats.n)
{
	// Declare range for next row after max to end of range
	range r2 = rCol2[$(nIdx+1):end];

	// Plot that range into same layer as previous plot
	plotxy iy:=r2 plot:=202 ogl:=1;
}


Cheers,
Chris
ONeilll Posted - 06/10/2015 : 08:00:28 AM
Hi,

if I use your suggestions with the brackets I get.

"Failed to initialize range from string, VarName = iy, VarValue = [CW415]CW-415!(,col(2))[nIdx+1:end]"

CW-415 ist the name of the importet file. Many thanks
ONeilll
cdrozdowski111 Posted - 06/08/2015 : 06:34:01 AM
What happens when you keep the brackets? Does it work correctly for you?

The brackets are necessary for it to work correctly and I get the same error if I remove them.

Without the brackets for the IF conditional statement, only the next line after the IF() is conditional. When brackets are used, all statements within the brackets become conditional.
ONeilll Posted - 06/08/2015 : 04:28:19 AM
Hi cdrozdowski111,

thank you very much for your work. Unfortunately this does not work. After removing of your brackets {} I get the following error message:
"Failed to resolve range string, VarName = iy, VarValue = (,r2), r2"
The import itself works, but there is only one range of datapoints.

Any further suggestions? Many thanks in advance.

Cheers ONeilll
cdrozdowski111 Posted - 06/06/2015 : 07:53:15 AM
ONeilll,

See if the code below works for you. I don't have your version of Origin so I can't test it but hopefully it will work for you.


// Create range for entire col 2
range rCol2 = col(2);

// stats X-Function will give us maximum value and number of rows
stats ix:=rcol2;

// Get row index of maximum value (or first occurrence of max value)
int nIdx = list(stats.max, rCol2);

// Declare range for row 1 to row index of max value
range r1 = rCol2[1:nIdx];

// Plot that range
plotxy iy:=r1 plot:=202;

// Check to make sure max value isn't the last row before making second plot
// If it is the last row, we don't need the second plot
if (nIdx < stats.n)
{
	// Declare range for next row after max to end of range
	range r2 = rCol2[nIdx+1:end];

	// Plot that range into same layer as previous plot
	plotxy iy:=r2 plot:=202 ogl:=1;
}
ONeilll Posted - 06/05/2015 : 08:44:17 AM
Origin8G SR4
v8.0951 (B951)
Windows 7 64 bit

Hi,

after some time I am planing to optimize my import filter. At the moment it looks like this:

// Define two ranges from col 2 of the worksheet
range r1=2[1:33], r2=2[33:74];
// Plot first range creating a new graph
plotxy iy:=r1 plot:=202;
// Plot second range into same layer of the graph
plotxy iy:=r2 plot:=202 ogl:=1;

At the momen I have a lot of data files with a varying number of points. Point 33 above is the point with the highest y-value. Is it possible to optimize this? I´m thinking of something like

range r1=2[1:a], r2=2[a:b];

where a is the point with the highest y-value and b the last point in the list. Many thanks in advance.

Cheers ONeilll
ONeilll Posted - 02/28/2011 : 2:55:59 PM
Hello easwar, thank you very much for that helful informations. There is just one problem for me.
I have designed a plot like youcan see it in this picture:
http://img600.imageshack.us/i/soll.gif/
I have saved it as Template under the name xy in the User directory of Origin. Then I have used your script:
// Define two ranges
range r1=2[1:33], r2=2[33:72];
// Plot first range, creating a new graph from custom template
plotxy iy:=r1 ogl:=[<new template:="xy">];
// Plot second range into same layer of the graph
plotxy iy:=r2 ogl:=1;
When I import now a file it plots on his one something like this:
http://img101.imageshack.us/i/ist2.gif/
Everything is fine, but the line between the dots is missing. I have repeated to save a new template, but it always plots just the dots, the line is still missing. Any idea what my mistake is?

Thanks again, Jack
easwar Posted - 02/27/2011 : 11:29:34 AM
Hello Jack,

You can change your script a the end of the import assistant/wizard to be like below:

// Define two ranges from col 2 of the worksheet
range r1=2[1:15], r2=2[16:30];
// Plot first range creating a new graph
plotxy iy:=r1 plot:=202;
// Plot second range into same layer of the graph
plotxy iy:=r2 plot:=202 ogl:=1;


Then you can add more script code to format the plots. An easier way to get the format you want is to customize the graph such as setting desired symbol type and size etc, and then save the graph as a template. Then when you run the plotxy command, you can use your predefined template to create the graph, such as:

// Define two ranges
range r1=2[1:15], r2=2[16:30];
// Plot first range, creating a new graph from custom template
plotxy iy:=r1 ogl:=[<new template:="my custom template">];
// Plot second range into same layer of the graph
plotxy iy:=r2 ogl:=1;
ONeilll Posted - 02/27/2011 : 09:58:14 AM
Edit: I forgott to say, that at hte moment I use for the importassistent following code:plotxy iy:=(1,2) plot:=202;

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