Replies: 1 comment 1 reply
-
Hi @fl-hat, for now, the ipysimulate package doesn't support this. i think it is a more promising route to improve the JS scatterplot rather than using matplotlib. you can find the source of scatterplot in https://github.com/JoelForamitti/ipysimulate/blob/main/js/lib/scatter.js and https://github.com/JoelForamitti/ipysimulate/blob/main/ipysimulate/charts.py. contributions are very welcome, if you are interested to extend this class we can also discuss it in more detail! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi! I've been using an ipysimulate scatterplot (similar to the example here) to visualize my agentpy model. It's important for me to see the state of each agent, but unfortunately there are about ten different states. I've been color-coding them, following the example. However, each time the model runs, the colors are re-assigned in the order the states appeared. As a result, the color-coding is different each run. I was wondering what the easiest way to add a legend to the interactive scatterplot would be?
I've tried looking at the docs and source for the ipysimulate
Scatterplot
class but I was having trouble identifying exactly where the plot was being constructed, or more specifically, where it would make sense to add code for a legend.I've also considered trying to use the ipysimulate
Matplot
class to rewrite the scatterplot, but it isn't clear to me exactly what theupdate
parameter is. The source says it's a "function that takes(model, fig, ax)
as input," but I don't know what the output ofupdate
should be. If usingMatplot
is the best route for me to take, do you have an example of what anupdate
function might look like?Once again, thank you so much for all your help!
Beta Was this translation helpful? Give feedback.
All reactions