Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to show node states separately #38

Closed
jdasfd opened this issue Jun 14, 2024 · 4 comments
Closed

How to show node states separately #38

jdasfd opened this issue Jun 14, 2024 · 4 comments

Comments

@jdasfd
Copy link

jdasfd commented Jun 14, 2024

Dear Author,
Hi! I am using the TreeViewer and it is an amazing tool that really really helpful in showing my tree!
I am trying to use the excellent function of "Parse node states" and "Node states" to show all the result on my tree. Thanks to the very outstanding example by the way!

my_tree

I want to show node colors separately. I wonder if there is any way to only show a color on the tree, without showing other node states? Or I could pass more different attachment files so that I could make multiple layers? Maybe show or hide a layer?

Thanks again for the amazing tool! Really appreciate that.

@jdasfd jdasfd changed the title How to show node states separately. How to show node states separately Jun 14, 2024
@arklumpus
Copy link
Owner

Hi, I'm glad you're finding TreeViewer useful!

I think it should not be hard to achieve what you want, but I'm not sure I understand exactly what it is 😅

For example, would you like to only show the red circles, while hiding the green, yellow and blue ones? Like this:

image

@jdasfd
Copy link
Author

jdasfd commented Jun 14, 2024

Yes! That is exactly what I mean. I want to submit a file containing all information of different nodes, and I want to observe the distribution of node features on the tree by only showing one color at a time or showing different combinations of colors.

@arklumpus
Copy link
Owner

Great! You can try something like this:

  • Set up the plot "normally" so that all states are shown in the appropriate colour (like your first example).
  • Then, within the options of the Node states Plot action module, set the Width to 0. This will cause all the node states to disappear.
  • Add a new instance of the Replace attribute Further transformation module, and set the following options:
    • The Attribute to whatever you called your node state attribute.
    • The Value to the node states value you want to display, e.g. A.
    • The replacement Attribute to StateWidth.
    • The replacement Attribute type to Number.
    • The replacement Attribute value to 5 (or a different number, depending on how big you want your states).

This should cause only node states for nodes with state A to reappear.

This works because the Replace attribute module adds an attribute called StateWidth with value 5 to all nodes with the state A; the attribute is then used by the Node states module to determine the size of the node state circles (overriding the default value that we have set to 0). StateWidth is the default name for this attribute, but you can of course change this by clicking on the "wrench" icon next to the Width parameter of the Node states module.

If you want to show multiple states at the same time, make sure you enable the Regex checkbox in the Replace attribute module options, and then set the Value to something like A|B (to show states A and B) or A|B|C (to show A, B, and C).

I hope this makes sense, let me know if it works for you!

@jdasfd
Copy link
Author

jdasfd commented Jun 14, 2024

Yeah! It worked perfectly! Thanks very much for your helping.

@jdasfd jdasfd closed this as completed Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants