dendrograms / astrodendro

Generate a dendrogram from a dataset
https://dendrograms.readthedocs.io/
Other
37 stars 38 forks source link

Update plot.py to pass subtree to get_lines #168

Closed tonywong94 closed 2 years ago

tonywong94 commented 4 years ago

This change seems needed to allow custom coloring of the dendrogram subtrees. My main use case is using different colors for trunks, branches, and leaves, but I also use subtree=False to color the structures according to a property like line width or virial parameter.

    p = d.plotter()
    branch = [s for s in d.all_structures if s not in d.leaves and s not in d.trunk]
    tronly = [s for s in d.trunk if s not in d.leaves]
    for st in tronly:
        p.plot_tree(ax, structure=[st], color='brown', subtree=False)
    for st in branch:
        p.plot_tree(ax, structure=[st], color='black', subtree=False)
    for st in d.leaves:
        p.plot_tree(ax, structure=[st], color='green')

The later commit (2020 Dec) deals with deprecation issues (h5py 3.1 does not allow dataset.value), issue #143 with Python 3, and changes to u.brightness_temperature.

tonywong94 commented 3 years ago

Oops I'm sorry this was a tentative fix on my fork. I didn't realize it would be incorporated into the older pull request. I'll try to drop it since I'm not sure yet that it works. ~Tony

astrofrog commented 2 years ago

@tonywong94 - I think a lot of the changes here are now no longer needed as they are done in the master branch. Could you rebase this on the latest master?

astrofrog commented 2 years ago

(this contains two genuine bug fixes that we should definitely get in)

keflavich commented 2 years ago

@tonywong94 it looks like you erased all the changes - but @astrofrog's last comment suggested that there were some real changes that should be incorporated.

tonywong94 commented 2 years ago

Yeah, there are only two small changes, so I will make them again and create a new PR. Sorry for the clumsiness.