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
 LabTalk Forum
 Labels in a Graph
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

eprlab

USA
5 Posts

Posted - 05/05/2003 :  5:39:29 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,

I want to display labels on a graph, the way the built-in functions display the "fit" values. My program generates some values and I want to be able to display them next to the graph.

I have tried a number of things without success.

EPR

Mike Buess

USA
3037 Posts

Posted - 05/05/2003 :  7:40:57 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Use the "label" command. Say your program generates the peak parameters "offset" and "fwhm", both of which are in units of Hz. To make your label you need the convert offset and fwhm to strings using $(offset) and $(fwhm) like this...

%S="peak position: $(offset) Hz
peak width: $(fwhm) Hz"; // this defines a 2-line string variable
label -s -n MyLabel %S; // create a label called MyLabel and fill it with the string

If offset=2.5 and fwhm=0.125 your label will look like this...

peak position: 2.5 Hz
peak width: 0.125 Hz

There are also a number of "label" command arguments for positioning the label. See LabTalk help for details.

Mike Buess
Origin WebRing Member
Go to Top of Page

eprlab

USA
5 Posts

Posted - 05/06/2003 :  3:29:47 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you for your response, but I am still not able to get correct the result. Here is what I am doing:


string ltm;
int init;
init = 5;

ltm = "%S=peak position: $(init);"
"label -s -n MyLabel %S;";
LT_execute(ltm);

The label is displayed on the graph as follows:

peak position: --

i.e. The value is not substituted, but instead 2 dashes are shown.

What am I doing wrong?
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 05/06/2003 :  4:44:29 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I didn't realize you were doing this in Origin C. Try this...

int init=5;
string ltm;
ltm.Format("label -s -n MyLabel \"peak position: $(%d)\";",init);

Notice that two of the quotes are preceded by backslashes (\") to keep the string from ending prematurely.

...In fact you don't need the $() notation in Origin C. This should also work.

int init=5;
string ltm;
ltm.Format("label -s -n MyLabel \"peak position: %d\";",init);
Mike Buess

Origin WebRing Member

Edited by - Mike Buess on 05/06/2003 4:49:46 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