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
 Origin Forum
 plot fraction of timetable

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
Mane07 Posted - 10/29/2005 : 07:58:44 AM
Origin Version (7.5 pro):
Operating System: XP

Hello
Being a newbie to OriginLap I’m wondering if someone could give me an advice.

I have a data pair Price(y) against Time (x) and a second pair StartTime (x) and EndTime(x).
What I’m trying to do is the following:
I like to plot fractions of the Price vs. Time table, divined by StartTime and EndTime on top of each other.
Any advise how I can do that and where I can find useful information regarding this task?

Thanks

To make things easier to understand...

My Data

What I like to achieve:
2   L A T E S T    R E P L I E S    (Newest First)
Mane07 Posted - 10/31/2005 : 06:58:01 AM
Thanks a lot

It's probably going to take me a while to understand all this in detail

Greetings mane
Mike Buess Posted - 10/29/2005 : 3:01:38 PM
Looks to me like your graphs plot price change since Start Time versus number of days since Start Time. If that's the case then the following procedure might work...

1. Select Tools > Options > Miscellaneous tab and enter the following for one of the Custom Date Formats...

dd'.'MM'.'yyyy

2. Delete the first row in your price worksheet. (I transferred that row to the corresponding column labels in Data22 below. Prices in Data22 are random numbers between 1 and 2.)

3. Double-click on each of the time columns (A, D and E in Data22) and set Format to Date and Display to the custom format you created.

4. Copy the following labtalk script, paste it to your script window and execute by selecting all lines of script and pressing Enter. Alternatively, you can run the script from the Custom Routine button as described here...
http://www.originlab.com/www/support/resultstech.aspx?ID=769&language=English

The script copies the prices in each time range to separate Y columns in a new worksheet (Data25 below), subtracts the first price in each column from all values in that column and creates an X column for days elapsed. (I have ignored the weekend gaps which therefore count as zero days.) Finally, all Y columns are plotted as in Graph4 at the bottom. If the graph legend is too large you can delete it by replacing the last line of the script with label -r legend; If you want the fractional, rather than absolute, price changes insert the command %(%H,wks.ncols)/=xx; after %(%H,wks.ncols)-=xx; in the loop.

# Script starts here
%W=%H; // save name of starting wks
get col(4) -e nn; // how many date ranges?
win -t D; // create new wks
del col(2); // delete Y column
loop (ii,1,nn)
{
xx1=%W!cell(ii,4); // Start time
xx2=%W!cell(ii,5); // End time
ii1=xindex(xx1,%(%W,2)); // Start index
ii2=xindex(xx2,%(%W,2)); // End index
ii3=ii2-ii1+1; // days in range
%A=$(xx1,D0);
%A=%[%A,#2,/].%[%A,#1,/].%[%A,#3,/];
%B=$(xx2,D0);
%B=%[%B,#2,/].%[%B,#1,/].%[%B,#3,/];
%Z=%A - %B; // this will be column label
wks.addCol(); // add Y column
wks.col$(wks.ncols).label$=%Z; // label it
copy -b ii1 %(%W,2) %(%H,wks.ncols) -b 1 -e ii3; // copy prices
xx=%H!cell(1,wks.ncols);
%(%H,wks.ncols)-=xx; // subtract initial price
};
wks.labels(); // show labels
wks.col1.label$=Days; // X axis label
col(1)=data(1,wks.maxrows); // X axis values
wo -s 0 0 0 0; // select entire wks
wo -p 200; // plot in new graph
lay -a; // rescale
layer.x.atzero=1; // create line at Y=0
xb.text$=Days; // X axis title
yl.text$=Price Change; // Y axis title
legend; // create legend

Starting worksheet:


Sorted worksheet:


Graph of sorted worksheet:


Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 10/29/2005 3:41:42 PM

Edited by - Mike Buess on 10/29/2005 4:26:38 PM

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