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
 Automation of error bars with fill areas

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
dougmarshall Posted - 12/18/2015 : 5:35:54 PM
OriginPro 8.5.1 SR2
Win 7

Hi,

There is a nice tutorial on generating plots with error bars with fill areas: http://wiki.originlab.com/~originla/howto/index.php?title=Tutorial:Error_Bars_with_Fill_Area br /

I'd like to produce many many plots like this either using a template or LabTalk but have been struggling. I have some 48 Y col.s with 48 Yerror col.s - I'd like to plot them all initially then hide the ones I don't wont.

Can anyone tell me if it is possible and if so, give me some clues to help me find the way.

Thanks!
4   L A T E S T    R E P L I E S    (Newest First)
dougmarshall Posted - 12/22/2015 : 03:36:23 AM
Hi Sean,

Thank you for all this information - it is going to be really useful for me. It will take me a little while to work it all through but I wanted to say thanks straight away.

Best regards,

Doug
SeanMao Posted - 12/21/2015 : 10:17:27 PM
Hi,

Q1:

You need to use $((wks.ncols-1)/2) to evaluate the expression.

Q2:

ii=1;
doc -e LW
{
string str = wks.name$;
type %(str$);
page.active=$(ii);
ii++;
}

doc -e LW will loop over all sheets in current workbook. wks.name$ can be used rename worksheets.
To loop over all workbooks in project, you can use command:
doc -e W{}
To loop over all workbooks in current folder:
doc -ef w{}

Q3:
With the graph active, run command below to group all plots:
layer -g; // Group all plots
layer -gu; // Ungroup all plots

There is no LabTalk command other than GUI to further edit the increment list for grouped data plots. Best way is to loop over all plots in layer and color each of them individually using:
doc -e d{};

Q4;
Since the label plot is separated from line plot, so I think you will need to get the color of line first and use it to fill color of error bar.

get %C -c linecolor; // get line color
layer.plot = 2; // switch to error plot
set %C -cf linecolor; // set fill color same as line color

Regards!

Sean
dougmarshall Posted - 12/21/2015 : 09:27:24 AM
Hi Sean,

Many thanks for the code it works really well. Please may I ask for a little extra help?

I am trying to automate importing and plotting of big CSV files. I have written the following for the import:

doc -n;
dlgfile gr:=CSV;
impCSV;
wtranspose select:=0 exchange:=1 type:=long col:= first;
// The transpose creates a blank column A so we delete it
delete col(A);
// Set all odd numbered columns as Y-error bars
for( ii = 1 ; ii <= wks.ncols ; ii+=2)
{
wks.col$(ii).type = 3;
}
wks.col.type = 3;
// Go to column 1 and set it as X-axis
wks.col=1;
wks.col.type = 4;

It works well for me. I would like to add your code to the end but I need some help:
1. Instead of the value 48 in your code I would like to use (wks.ncols-1)/2 but I can't make this work - I am not sure why.
2. How do I carry through the workbook and worksheet names? At the moment Origin generates them automatically from the input filename.
3. Could I group the data in the plot so that I can increment the colours?
4. Could I make the shading colour of the error regions match the line colour automatically?

Sorry, this has turned into a great many questions! Any help which you could provide would be greatly appreciated.

Best regards, Doug
SeanMao Posted - 12/19/2015 : 04:31:38 AM
Hi,

First create one plot: filling area with error bars and save it a graph template with name MYTEMPLATE.

Then create one graph first and add all the rest to it:

plotxy iy:=[Book1]Sheet1!(1,2,3) plot:=200 ogl:=[<new template:=MYTEMPLATE name:=MyGraph>]; // Create first plot with saved graph template
for (ii=2; ii<=48; ii++)
{
plotxy iy:=([Book1]Sheet1!1,[Book1]Sheet1!$(2*ii),[Book1]Sheet1!$(2*ii+1)) plot:=200 ogl:=[MyGraph]1!;
}
// Loop the rest of cols to plot into active graph page



Assuming the workbook named Book1 and sheet named Sheet1 and data is arranged as XYYErrYErrYErr...

Give it a try and see how it goes.

Regards!

Sean

OriginLab Tech. Service

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