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
 Origin Forum
 plot graph and name it
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

ONeilll

33 Posts

Posted - 02/20/2012 :  08:40:17 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello everybody.
I use Origin v8.0951 and I try to do following. With drag & drop I can import and directly plot some data from a .txt file. I use following command:
plotxy iy:=((1,2)) plot:=200 ogl:=[<new template:= WAXSPublikation name:= FileName>];
The graph I get from this is now named "FileName", but I would like to get the real filename from what the data is extractet.

For example:
I have the file with the name "abc.txt", then the graphname should be abc.txt, that would be great ;-). Even just the name "abc" would be better, but I think thats much more complicate.

Thanks for help.

Cheers Chris

Drbobshepherd

USA
Posts

Posted - 02/20/2012 :  10:45:06 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Is your plotxy command executed in your import filter? If so, then I believe you are in luck.

The filename of the latest file imported is saved in the page tree. So, edit your filter script to do this:

%A=page.info.user.variables.filename$; // Get filename.
plotxy iy:=((1,2)) plot:=200 ogl:=[<new template:= WAXSPublikation name:= %A>]; // Plot data, rename the graph window.
Go to Top of Page

ONeilll

33 Posts

Posted - 02/21/2012 :  04:20:10 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Drbobshepherd and thank you for your help!

quote:
Originally posted by Drbobshepherd

Is your plotxy command executed in your import filter? If so, then I believe you are in luck.

Yes it is.

quote:
Originally posted by Drbobshepherd


%A=page.info.user.variables.filename$; // Get filename.
plotxy iy:=((1,2)) plot:=200 ogl:=[<new template:= WAXSPublikation name:= %A>]; // Plot data, rename the graph window.


When I change my Importfilter (in the wizzard) with your changes, I just get the importet worksheet, but no automatic plot, aned even no warning that anything is wrong.
When I execute the command "plotxy iy:=((1,2)) plot:=200 ogl:=[<new template:= WAXSPublikation name:= %A>];" after the import than I get the plot that I want to get.
Is there any change to change the wizzar settings that this works automatically? Thank you very much.

Cheers Chris
Go to Top of Page

Drbobshepherd

USA
Posts

Posted - 02/21/2012 :  10:39:03 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Has your script been saved with your filter? Could you be using the wrong import filter (you might be using the default ascii-import filter)?

If you are using the correct filter(the one with your script), your script should be executing immediately after the import. Perhaps a short time-delay is needed. Try the following line before the plotxy command:

sec -p 0.5; // A 0.5 second pause.

Please let me know if this works.

DrBobShepherd
Go to Top of Page

ONeilll

33 Posts

Posted - 02/23/2012 :  11:30:42 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello DrBobShepherd, thanks again.

Now the script wothout time delay works perfect, I dont know the reason, thank you very much. :-)

Another filter I use is the following:
// Define two ranges from col 2 of the worksheet
range r1=2[1:32], r2=2[33:72];
// 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;


I would like to optimize it in the same way as described above. Can you tell me how?
Thanks,
chris
Go to Top of Page

Drbobshepherd

USA
Posts

Posted - 02/23/2012 :  6:53:01 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I suggest you divide the two ranges into separate columns (a.k.a. datasets). Label each with a unique long name or comment. Then plot.
Your labels should then show up in the legend.
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