Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: coloring leaves of a dendrogram

  • To: mathgroup at smc.vnet.net
  • Subject: [mg91548] Re: [mg91538] coloring leaves of a dendrogram
  • From: Curtis Osterhoudt <cfo at lanl.gov>
  • Date: Wed, 27 Aug 2008 06:40:58 -0400 (EDT)
  • Organization: LANL
  • References: <200808260728.DAA23695@smc.vnet.net>
  • Reply-to: cfo at lanl.gov

Hi, Paul, 

  Here's a version of how I handled that thing on my dendrograms. Basically, 
it involves replacing the leaf labels with Styles, and then making the plot. 

   For example, my "formattedTogetherLabels" below takes the original labels 
("togetherLabels" here), turns the ones which are numbers to small, black 
labels, and those which are strings starting with "Ishi" to have blue text, 
and light-blue, slightly transparent backgrounds. Of course, you can 
generalize to any number of different styles. Once that expression is done, 
just issue the usual DendrogramPlot command, with the option of: 
LeafLabels -> formattedTogetherLabels


formattedTogetherLabels = Text[
     Which[
      NumberQ[ToExpression[StringTake[ToString[#], 2]]], 
      Style[#, Black, Smaller],
      StringMatchQ[#, "Ishi*"], 
      Style[#, Darker@ Blue, 
       Background -> Directive[Darker@Blue, Opacity[0.2]], Smaller],
      True, Style[#, Black, Smaller]]
     ] & /@ togetherLabels;

           Eventually, I'll post how I make a dendrogram and have Mathematica 
pull the graphics apart, and then you can apply styles (coloring, line 
styles, etc.) to the different branches.

              Hope that helps!
                        C.O.

On Tuesday 26 August 2008 01:28:51 Paul Slater wrote:
> In my hierarchical clustering of 3,000+ US counties,
> I'd like to be able to distinguish the counties
> (all of which cluster together) of certain states.
>
> I  have the dendrogram I want. I would further
> now like to highlight the five counties of Hawaii
> (which form a cluster) by the same color, and so on
> for a few other states, regions...
>
> Paul B. Slater



-- 
==========================================================
Curtis Osterhoudt
cfo at remove_this.lanl.and_this.gov
PGP Key ID: 0x4DCA2A10
Please avoid sending me Word or PowerPoint attachments
See http://www.gnu.org/philosophy/no-word-attachments.html
==========================================================


  • Prev by Date: "cannot find the required native library named JLinkNativeLibrary"
  • Next by Date: problem with using external functions
  • Previous by thread: coloring leaves of a dendrogram
  • Next by thread: Problem with NMinimize