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

Agent inspection on mouse hover #538

Closed
fbanning opened this issue Aug 3, 2021 · 10 comments · Fixed by JuliaDynamics/InteractiveDynamics.jl#72
Closed

Agent inspection on mouse hover #538

fbanning opened this issue Aug 3, 2021 · 10 comments · Fixed by JuliaDynamics/InteractiveDynamics.jl#72
Labels
enhancement New feature or request plotting

Comments

@fbanning
Copy link
Member

fbanning commented Aug 3, 2021

I'd like to add a simple way to inspect single agents on mouse hover. I'd just like to see a simple tooltip with the agent variables and their current values.
What do you think about this? Have there already been some plans to implement such a thing?

Makie already provides DataInspector and the ability to customise the shown tooltip. From what I've just tested, the basics of this seem easy enough to add but the customised tooltip may need a bit more time to understand how it should be done.

@Datseris
Copy link
Member

Datseris commented Aug 3, 2021

This seems like a really cool feature to me!

@Datseris Datseris transferred this issue from JuliaDynamics/InteractiveDynamics.jl Aug 3, 2021
@Datseris
Copy link
Member

Datseris commented Aug 3, 2021

(I transferred this to Agents.jl, because it will be more visible to the Agents.jl users here)

@Datseris Datseris added enhancement New feature or request plotting labels Aug 3, 2021
@fbanning
Copy link
Member Author

fbanning commented Aug 9, 2021

Quick update, I'm currently working on this and got the basics down:

grafik

I think this is very much doable in the foreseeable future, although I'm still a bit confused about a few things. Need some more time to wrap my head around those. I will create a PR at InteractiveDynamics.jl at some point and we can look at any persisting problems together then. :)

@fbanning
Copy link
Member Author

Here's something I'm currently thinking about and would like your feedback on:

If we have one agent at a position it currently looks like this
grafik

Having multiple agents will just list them below each other
grafik

But having a lot of agents might break the formatting and make parts of the tooltip useless
grafik

This problem of course get worse when agents have a lot of variables to display.

I can think of two ways to go about this:

  1. Leave it as it is. This is pretty flexible, although it has its natural limits as can be seen above.
  2. Format the tooltip as a table with one row per agent variable and one column per agent. This might look pretty nice but we will need to account for displaying tooltips for models with multiple agent types. Definitely doable but would require a bit more work.

I would favour the second option which is more work but should hopefully look better in the end. What are your thoughts on this? Maybe you've got some more ideas how to display the agent data?

@Datseris
Copy link
Member

How would the version 2 make this problem dissapear? Instead of being too large in the vertical direction the tooltip would be come too large in the horizontal... I think it isn't really worth the dev effort right now and would go with 1. One thing worth changing is to display only the final type instead of Agents.Models.Sche..... How do you obtain the type name? I think you have to use the nameof function.

@fbanning
Copy link
Member Author

Modern displays normally have more horizontal than vertical space which is why a table (option 2) instead of a list (option 1) might make use of that as well as saving a bit of space for listing the agent type for each agent.

But I think you're right and we can just stick to the list view for now. Maybe at a later time I'll revise this if I find the time.

One thing worth changing is to display only the final type instead of Agents.Models.Sche..... How do you obtain the type name? I think you have to use the nameof function.

Done, thanks. :)

@Datseris
Copy link
Member

(perhaps it's time for a PR on this, so I can give more feedback on code? It looks pretty close to finished already)

@fbanning
Copy link
Member Author

Sadly it isn't. The core is there but I'm still trying to figure out how to create an own recipe for our ABM plot (fig[1,1] in the interactive apps). This needs to be done because otherwise the tooltips for the scatter points in abm_data_exploration will error. Our new ABMPlot recipe would just need to wrap the respective functions (meshscatter!, poly! or scatter!) such that we can dispatch on that for the tooltip functionality. Do you have any experience with creating Makie recipes?

@Datseris
Copy link
Member

None whatsoever, and I'm not even sure how stable and complete the interface is :(

@fbanning
Copy link
Member Author

OK, that's no problem. I'm currently chipping away at it and am making progress, albeit a bit slower than I'd like to. Will keep you updated about this. Once I got a basic recipe working with a custom plot type for simple 2D non-poly models, I will create a PR for you to look at. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request plotting
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants