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
 create heatmap using labtalk

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
TitoK Posted - 04/12/2015 : 09:01:16 AM
Origin Ver. and Service Release (Select Help-->About Origin): Origin 2015
Operating System: Windows 7

I use LabView to acquire data and create Origin worksheets and line and bar plots from this data using plotxy.

Also I'm capable of creating matrix sheets. Now I'd like to create a heatmap from the data of a matrix using labtalk - how can I do this?
Which plotfunction (plotxy, plotxyz,...) do I need?
7   L A T E S T    R E P L I E S    (Newest First)
SeanMao Posted - 05/03/2015 : 10:39:32 PM
Hi,

The LabTalk control for flipping the color scale and to set the title for it are not supported yet.

It is an known issue that we are already considering implementing. Right now you can only manually set it.

Regards!

Sean
TitoK Posted - 04/29/2015 : 07:01:43 AM
Hello Sean,

Thank you very much! I figured out, the problem with the scale was that I didn't set the matrix dimension correctly. Now I do and it works perfectly.

Is it possible to reverse to the scale color - so to go from white (lowest value) to black? I found the option in Origin itself, but I cannot figure out so far how to change it using labtalk - I took a look at the set command and layer.cmap but I didn't find it.

Also so far I had no luck changing the color scale title - I'd like it to be 'Counts' for all graphs. I think it cannot be to hard, but I'm rather new to Origin/ Labtalk, so sorry for all the questions. ;-)



SeanMao Posted - 04/28/2015 : 11:03:18 PM
Hi,

The code would be following:


doc -e M{
doc -e LW{
matrix -ps Y 1 $(wks.nRows); // Set Y from 1 to Y dimension
matrix -ps X 1 $(wks.nCols); // Set X from 1 to X dimension
string msname$ = wks.name$; // Current Matrix Sheet Name
run.section(Plot3D,HeatMap); // Make HeatMap plot
page.title = 1; // Use Long Name as window title
page.longname$ = msname$; // Set Graph Window Name as Matrix Sheet Name
layer.x.minorticks=0; // No minor ticks on X axis
layer.y.minorticks=0; // No minor ticks on Y axis
layer.x.inc=1; // Major tick increment is 1 on X axis
layer.y.inc=1; // Major tick increment is 1 on Y axis
set %C -cpal grayscale; // Set Color Palette to be GrayScale
}
}


This code will loop through all matrix sheets in all matrix books and make a grayscale heatmap with matrix sheet name as graph window name.

A sample image is shown below:



Regards!

Sean
TitoK Posted - 04/24/2015 : 10:08:53 AM
Hello Shirley_GZ,

Thanks for the help. The script is basicaly doing what it should. Now I'd only need to adjust the graphs. So far I managed to change the x and y axis labels, what I'd still need to figure out is:

The heatmap should be in grey scales, not in color.

Each graph should have the same name as the corresponding matrix sheet it is created from (all are from the same matrix book).

The x and y scales should correspond to the data of the matrix. For example I just created a heatmap from a matrix with 2 columns and 5 rows. In the heatmap I get a grid with 2x5 squares with the color representing the values in the cells of the matrix - so far so good. But the x and y scale are going from 1 to 10. Moreover on the x axis the two columns are only located from the scale value 0,9 to 1,4. On the y axis the rows are aligned from 0,9 to 2,3. I'd like every square to be represented as 1 unit on the scale - so the first square of the first column should correspond to 1 on the x scale and 1 on y, the second square in the first column should be 2 on x and still 1 on the y scale and so on.

Is there a way to do this using Labtalk?

Thanks,
Tito
Shirley_GZ Posted - 04/16/2015 : 04:10:08 AM
Hi,

I suppose that you want to plot all matrixsheets in all matrixbooks in current project. Please try the below script lines:

doc -e M{
doc -e LW{
run.section(Plot3D,HeatMap);
}
}


Any problem, please let me know.

Originlab Technical Service Team
TitoK Posted - 04/15/2015 : 10:24:28 AM
Hello,

Thanks for the reply - this almost seems to be what I'm looking for.

I tried the command and ended up with an empty heat map.

So far what I do is the following: I create a matrix book with several sheets (for now I tried this using just one sheet). I'd like to create a heatmap from every matrix sheet.

Currently from LabView I first create all the sheets, then my idea was to activate the first sheet and use the 'run.section...' command just like it is written in the last post (I do similar - create workbooksheets and then within a loop I create a graph page, activate a sheet and create a bar graph from that in another program).

Just this time activating the sheet is not enough it seems. Do I have to pass the sheetname or something as an argument maybe, if so how do I do this? I took a look into the Plot3D.OGS but I couldn't figure out how it really works so far.

When I create the heat map manually it works without problems.
Shirley_GZ Posted - 04/13/2015 : 06:53:28 AM
Hi Titok,

Origin don't have a X-Function (such as plotxy) which can be used to plot heatmap graph, But you can try to use the below script to execute the script in the [HeatMap] section of the Plot3D.OGS.

run.section(Plot3D,HeatMap);


http://www.originlab.com/doc/LabTalk/ref/Run-obj

Thanks,

Originlab Technical Service Team

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