Comments (2)
The behavior of the link coloring is very similar to MATLAB's behavior, which
is what
I intended. Are you trying to specify the color for each link? Just to be clear
--
that's not the expected behavior of the link coloring code in hcluster. The
feature
could be added to do that if you want to do that. Is that what you're trying to
do?
I don't know if you looked at the colorthreshold parameter documentation:
Colors all the descendent links below a cluster node k the same color
if k is the first node below the cut threshold t. All links connecting
nodes with distances greater than or equal to the threshold are
colored blue. If t is less than or equal to zero, all nodes
are colored blue. If t is None or 'default', corresponding with
MATLAB(TM) behavior, the threshold is set to 0.7*max(Z[:,2]).
If you *do* intend to have this behavior, but you just want to use different
colors,
use the set_link_color_palette feature, which I've just added.
Thanks a bunch!
Damian Eads
Original comment by [email protected]
on 25 Feb 2008 at 2:47
from scipy-cluster.
(reposted from personal e-mail message to issue creator)
When I designed scipy-cluster (hcluster), I wasn't expecting the user to mess
with
the color_list variable. Given my busy schedule, I put less priority on
commenting
the private functions whose names are usually prefixed with an underscore.
You'll see several lists two sets of lists being appended
_dendrogram_calculate_info,
which calculates the coordinates and attributes of the shapes to plot in the
plotting
window. One set corresponds to leaf-node clusters (singletons and truncated
non-singletons) and the other, non-singleton clusters.
leaf clusters: ivl
non-singleton clusters: icoord_list, dcoord_list, color_list,
The order of the color_list elements represents the order links are painted in
the
plot, not the order clusters are joined. The reason why the orders don't
correspond
to one another is dendrogram supports options for changing the way the
hierarchy is
plotted (see count_sort and distance_sort for examples).
I added a link_color_func parameter to the dendrogram function you can use to
set the
color of a links. This is a better solution than mucking with the color_list
data
structure because the order does not correspond to anything that would be
intuitive
to the user--just the order in which shapes are painted to the window.
Here's the help documentation for it:
R = dendrogram(..., link_color_func)
When a link is painted, the function link_color_function is
called with the non-singleton id. The function is
expected to returns a matplotlib color string representing
the color to paint the link.
For example:
dendrogram(Z, link_color_func=lambda k: colors[k])
colors the links of every untruncated non-singleton node k
with colors[k].
This feature appears in the 0.1.4 release. Let me know if this helps.
Damian
Original comment by [email protected]
on 25 Feb 2008 at 5:08
- Changed state: Fixed
from scipy-cluster.
Related Issues (20)
- Feature request HOT 1
- upper triangular and squareform of same distance matrix yield different linkage solutions HOT 2
- Snow Leopard breaks hcluster? HOT 4
- Incremental clustering HOT 2
- easy_install broken on Snow Leopard HOT 3
- colothreshold not working HOT 1
- TypeError when running pdist HOT 6
- pre_order for subtrees fails HOT 1
- Precision and Recall HOT 1
- support for opencv C matrix HOT 1
- Need python-dev for Ubuntu 10.10 HOT 1
- "built-in" functions don't work with pdist()
- Broken Links to Tutorial and API Documentation HOT 2
- Mention on the front page that scipy-cluster is part of scipy HOT 2
- fclusterdata segfault HOT 3
- Windows python 2.7 version availability?
- Can you build Windows installer for Python 2.6 & 2.7 HOT 1
- Installing on Ubuntu 13.10 pip install hangs
- Issues/Fixes for building on Python 2.7 amd64 on Windows
- Segmentation fault python 2.6.5 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scipy-cluster.