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
 How do I make odd shaped contour plots?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

prime

USA
18 Posts

Posted - 09/08/2000 :  5:58:00 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
The Origin web page shows several sample contour plots that do not fill up the whole (rectangular) plot area:
http://www.originlab.com/www/graph_gallery/subjectindextemplate.asp?TypeID=Contour

I have XYZ data that I would like to plot like this. My data covers an odd-shaped central region and I would like to white out the outside area. What's the best way?

greg

USA
1379 Posts

Posted - 09/14/2000 :  1:14:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You can use a new feature of 6.0 to mask out any shaped region you like. Drawing on some high school trigonometry I was able to come up with the following LabTalkTM script that works on an existing Contour Plot:

%M=%H;
win -a m248x248;
matrix -pg DIM ncol nrow;
matrix -pg X XMin XMax;
matrix -pg Y YMin YMax;
win -a %M;
win -t data origin;
%N=%H;
// Do the math for an Ellipse
a=(XMax-XMin)/2;
b=(YMax-YMin)/2;
px0=XMin+a;
py0=YMin+b;
stepsize=int(sqrt(ncol^2+nrow^2));
for(px=XMin,row=1;px<=XMax;px+=((XMax-XMin)/stepsize),row+=1) {
py=sqrt(b^2*(a^2-(px-px0)^2)/a^2)+py0;
%H_A[row]=px;
%H_B[row]=py;
};
row--;
for(px=XMax;px>=XMin;px-=((XMax-XMin)/stepsize),row+=1) {
py=-sqrt(b^2*(a^2-(px-px0)^2)/a^2)+py0;
%H_A[row]=px;
%H_B[row]=py;
}
// and add the data to the contour
win -a %M;
layer -i %N_B;
label -r legend;

(Warning! no checks are performed to verify that you have a contour plot as the active window. Also, if the contour contains other datasets, you must substitute the matrix name for %C.)

Once the script completes, you should open Plot Details for the added dataset and check the Fill Area Under Curve box and select Exclusive broken by missing values from the drop-down list. Then select the Pattern Tab and set the Fill Color to White (or whatever).


You can change the math to create any region you like or just use the Draw Data tool to create any arbitrary shape.


Users of previous versions must create four datasets which are grouped in pairs (top mask and bottom mask) and set with fill color and drop lines.

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