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
 Line plots : Highlighting certain regions of line
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

SamuelsGrp

USA
2 Posts

Posted - 09/30/2003 :  2:13:27 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,

In a line plot, I need to plot a single line in different colors. For example, if X axis is from 1-1000, I want a plot such that line between 300-500 is red and the rest of it is green. Can anyone suggest a technique how to accomplish this ?

Thanks in advance.

Hideo Fujii

USA
1582 Posts

Posted - 09/30/2003 :  5:19:17 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
How about using (XYXY-)Vector Plot?
You need to create 3 columns. Second column copied from the first shifted one cell down, and you can set color# in the third column. Then, you can make a vector plot, with color indexed by the third column, and the size=0 for the arrow head.

Go to Top of Page

greg

USA
1379 Posts

Posted - 10/15/2003 :  10:28:21 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The more general solution suggested by Hideo can be accomplished with this script:

// BEGIN SCRIPT
wks.col=3;
wks.insert(EndX EndY);
wks.col3.type=4;
wo -s 1 0 2 0;
DoMenu 57634;
wo -s;
wo -s 3 0 4 0;
DoMenu 57637;
get wcol(1) -e end;
wo -s;
wo -s 3 1 4 1;
DoMenu 36442;
wo -s;
wo -s 0 end 0 end;
DoMenu 36442;
wo -s;
wo -s 1 0 4 0;
wo -p 218 ColoredLineSegments;
// END SCRIPT

which assumes your worksheet with columns A(X), B(Y) and C(Y) is active and that you have saved a Template named ColoredLineSegments.
In your particular case, that C column should contain 2 where X is 300 to 500 and 3 elsewhere. This script does just that:

// BEGIN SCRIPT
col(C)=((col(A)<300)||(col(A)>500))?3:2;
// END SCRIPT

TO MAKE THE ColoredLineSegments TEMPLATE:
Setup a worksheet as A(X) B(Y) C(X) D(Y) E(Y)
Fill a few rows of A(X) with row numbers
Fill a few rows of C(X) with row numbers plus 1
Fill a few rows of B(Y) and D(Y) with any values
Fill a few rows of E(Y) with integers from 1 to 24
Select columns A(X) to D(Y) and plot as a Vector XYXY plot
Double-click on the plot to open Plot Details
Set the Arrowhead Length to 0
Click the Color button and choose Indexing : Col(E)
Click OK out of Plot Details and File : Save Template As and enter ColoredLineSegments as the template name.


Go to Top of Page

SamuelsGrp

USA
2 Posts

Posted - 10/16/2003 :  11:31:53 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks a lot Greg. Your technique works like a charm.
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