Matlab clustergram: add color markers by column label - matlab

I'm using clustergram in the Matlab bioinformatics toolbox. I want to add color markers to certain columns, similarly to this, but I want to mark specific ColumnLabels (IDs) rather than specific clusters.
Anyone know of a way to do that?

Found it. Based on Kevin's excellent suggestion, I passed a structure with colors for ColumnLabelsColor, then set LabelsWithMarkers as true:
clustergram(mat,'Colormap', redbluecmap,'ColumnLabelsColor',s,'LabelsWithMarkers',true)
mat is my DataMatrix. s is a structure of 2 cell arrays, each with length of the number of columns: first array is ColumnLabels, second array is my defined colors.
By default, setting ColumnLabelsColor changes the color of the text of the labels. Setting LabelsWithMarkers to true adds a color marker between the label and the clustergram:

Thank you for the suggestion. I have just figured out this problem.
First step: construct a structure with 'Labels' and 'Colors'. These two cell array should in the same length.
Second step: set the clustergram object, parameter 'ColumnLabelsColor' with this structure.
Also, set 'LabelsWithMarkers' as true.
[This is my original code for your reference ]
https://i.stack.imgur.com/ZTQ1h.png

Related

Change Shape Fill based on Shape Data in Visio

Wondering if someone can help me with what I thought was a simple Shapesheet issue.
I'd like the fill colour of a shape to change based on one of the shape data values. I thought I could do this easily:
FillForeground: If(Prop.Colour="Blue",XXX,YYY)
But this doesn't work? (Visio 2021)
I've 5 list values for the data and would like a different fill colour for each? Weirdly, I can see that the value does change based on the data selection, but the actual colour seen in on the page doesn't.
Obviously, I'm not much of a coder, just an enthusiastic meddler.
I've stuck at:
=IF(Sheet.3780!Prop.StringSection="Firsts",THEMEGUARD(MSOTINT(THEME("LineColor"),40)),THEMEGUARD(MSOTINT(THEME("AccentColor"),40)))
(The shapes to colour are within a group)
Thanks
Steve
Steve !
FillForeground: If(Prop.Colour="Blue",XXX,YYY)
But this doesn't work? (Visio 2021)
For compare strings in ShapeSheet you must use STRSAME function
Use syntax like this:
IF(STRSAME(Prop.color,"blue"),4,3)

How to get nodal values in OpenFOAM?

I would appreciate knowing how I can convert the cell values given after the OpenFOAM solution into the ones on the grid points. Is there any direct command for such a thing or I should work with the sampling option?
Thanks a lot for your help.
When you open your case using Paraview/paraFoam, then the interpolated fields at the points (nodes) are already computed by Paraview:
Fields with an orange small circle are the point data, while the fields that have an orange cube icon are the data at the cell centers, i.e:
You can also see the values of the fields (points or cell) using the Spreadsheet view and export them as CSV:

Labelling a plotmap of self organizing map in Matlab(edited)

I want to label the plothitmap plotsomhits(net,inputs) of the iris dataset found in the neural network toolbox. How would I do that. I want the class labels to be superimposed on the plothitmap. Any ideas?It would look something like this:
Is it possible?Thanks.
If the built-in function to display the label not available for plotsom... function, you may want to consider using manual annotation on each cell using annotationtextbox function as described in this link
If you have the coordinates that each class label corresponds to you can just do:
plotsomhits(net,inputs);
text(x1,y1,label1); //this will put a text label superimposed on the current plot
Of course if you have lots of lablels, then you can iterate over a for loop to add the labels.
Here is a link to documentation on how to use text here.

Controlling the color of text in an array based on a predefined condition

I am trying to display a matrix M of size 50x8 with a plot using text([x,y],M). All the entries in matrix are at present of the same color. I would like more control on the display, and would like that all matrix entries satisfying a particular condition should be of different color.
One of the possible ways to do is to specify the position for each of the elements of the matrix M individually in text(x,y,M_ij). But I am only specifying the position for the first element, and other positions are being assigned automatically. How can I get those positions, or control them? This will allow me to control the colors as well.
The resulting text graphics object is only one object, so you can't adjust the color through handle graphics without affecting all of the rows. But if it's possible for you, you can specify the color directly in the strings. To do this, you'll probably need to represent your strings as a cell array instead, so they can have different colors.
M = {'\color{red}Line 1';'\color{blue}Line 2';'\color[rgb]{.6 .8 .2}Line 3'};
text(1, 1, M);
The reference for other inline string markup is found on this doc page, in the 'String' property: http://www.mathworks.com/help/matlab/ref/text_props.html

Change label of data tips on bode nichols diagram

When we plot a bode/nichols locus, the name of workspace variable is used
tmp=ss(1,1,1,0);
nichols(tmp);
will use 'tmp' as label.
When using more complex data, matlab is using 'untitled1','untitled2',...
tmp={ss(1,1,1,0) , ss(1.2,1,1,0)};
nichols(tmp{:});
How can I change this label programmatically?
Ideally, I'd like a solution working with Matlab 6.5.1, but I'm also interested in solutions restricted to newer versions.
You can modify the labels programmatically via their graphics handles. It looks like the values you want to change are the DisplayName property of some of the children of the current axis. So in your first example, I can change the display name like this:
ch = get(gca,'Children');
set(ch(1),'DisplayName','Fred');
In general, I'm not sure how to predict which children of the current axis are the ones you need to change. For the second example you give, the two curves appear to be the second and third children when I run your code.