Author |
Topic |
|
jenskjensk
Germany
4 Posts |
Posted - 06/15/2016 : 10:01:48 AM
|
Origin Ver. 8pro Release SR3 Hi there,
I have a workbook with mapping data. Fist two rows are the X and Y coordinates and in the other columns (around 15) are the different mapped elements as Z coordinates. I can produce easily maps via XYZ-Contour maps. However, I don´t want to have an interpolation between individual points. I would like to have only the "true" measured resolution with a color scale.
I there an easy way to do it? I think I could dit once but can´t remember how to do
Thanks a lot, Jens |
|
Hideo Fujii
USA
1582 Posts |
Posted - 06/15/2016 : 6:51:25 PM
|
Hi Jens,
Probably you are talking the "heat map" plot(http://www.originlab.com/doc/Origin-Help/Heat_map). If so, you need to organize your data as a matrix or a virtual matrix. When your data point's XY coordinates are at a random position (rather than in a regular dataset), you need a virtual matrix. Here is a sample script to convert a XYZ dataset to a virtual matrix, then draw a heat map://///////////////////////////////////
iWks$=%H; //bookname
worksheet -i 0 Index; //insert index column
nr=wks.maxRows;
col(Index)=data(1,nr); //fill indices
wsort bycol:=2; //sort by X
worksheet -i 1 xIndex; //insert xIndex column
col(xIndex)=data(1,nr);
wsort bycol:=4; //sort by Y
worksheet -i 2 yIndex; //insert yIndex column
col(yIndex)=data(1,nr); //fill yIndex
wrcopy iw:=1! c1:=5 c2:=5 ow:=<new> transpose:=1; //copy transposed yIndex to new sheet
worksheet -i 0 xIndex;
page.active=1;
wsort bycol:=4;
wrcopy iw:=1! c1:=4 c2:=4 ow:=2! transpose:=0; //copy xIndex
page.active=2;
for(ii=nr;ii>=1;ii--) col(1)[ii+1]=col(1)[ii]; //shift down
page.active=1;
wsort bycol:=1;
page.active=2;
range ixIndex=[iWks$]1!col(2); //x positions
range iyIndex=[iWks$]1!col(3); //y positions
range iz=[iWks$]1!col(6); //z values
for(ii=1;ii<=nr;ii++) wcol(iyIndex[ii]+1)[ixIndex[ii]+1]=iz[ii]; //fill z values
worksheet -s 0 0 0 0; //highlight the vm
plotvm rowpos:=selrow1 colpos:=selcol1 ogl:=<new template:=heatmap>; //plot a heatmap
/////////////////////////////////////
Hope this helps.
--Hideo Fujii OriginLab |
|
|
jenskjensk
Germany
4 Posts |
Posted - 06/16/2016 : 05:54:53 AM
|
Hi Hideo,
my data are all regular spaced and all in the same way. It is a mapping of elemets with the same resulution. I do not have the option Heatmap as i have a very old version of Origin 8 pro.
However, I found a work around with "convert to matrx/XYZ-gridding" for me but it is time consuming with may data. For this I have to do it for each element individualy.
Is there a simple code to do it automaticaly?
My data in the workbook are always arraged like this:
x,y,z,z,z,z,z,z,z (each Z stands for one Elemen ).
I would like to transform the XYZ for each element into a Matrix (regular) and if possible it would be nice if these different matrices from the workbook could be arranged as Matrix object into a matrix sheet, because i want to do some calculations with the matrices.
Is there are simple way to put different matrices as object into a matrix sheet?
thanks again for your help, jens
|
|
|
Hideo Fujii
USA
1582 Posts |
Posted - 06/16/2016 : 4:26:53 PM
|
Hi jens,
Okay, so if your data is regular, everything should go much easier. Here is a sample script to convert {xyzz...z} data to {xyz},...{xyz}; then grid to make each matrix by "xyz_regular" x-function:////////////////////////////////////////
ibook$=%H;
nz=wks.ncols-2;
for(ii=1; ii<=nz; ii++) {
wrcopy iw:=[ibook$]1! c1:=1 c2:=2 label:=1 ow:=<new>; //copy xy
layer.name$=Z$(ii);
colcopy irng:=[ibook$]1!wcol(ii+2) orng:=[ibook$]$(ii+1)!col(3); //copy z
wks.col1.type=4; //set as X
wks.col2.type=1; //set as Y
wks.col3.type=6; //set as Z
xyz_regular col(3); //Regular gridding, or try another like xyz_tps(...)
window -r %H Z$(ii); //rename the matrix window
window -a %(ibook$);
}
////////////////////////////////////////
Hope this helps.
--Hideo Fujii OriginLab |
Edited by - Hideo Fujii on 06/16/2016 4:37:20 PM |
|
|
|
Topic |
|
|
|