-
Notifications
You must be signed in to change notification settings - Fork 916
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
feat: Implement Altair version of grid visualization #1991
Conversation
Performance benchmarks:
|
The animation jitter could be fixed with a |
dd64173
to
bad03b0
Compare
Nice and simple solution, but the obvious question is how this relates to #1902 This PR has a agent_portrayal function, but I don't see how it is used. Since altair uses a declarative approach vs an imperative in matplotlib, I think its confusing to have different agent_portrayal functions. But would have to see the agent_portrayal. Otherwise drawing agents on the edge itself looks strange to me, but this shouldn't be a deciding factor. |
I need to say that there is no modification needed in https://github.com/projectmesa/mesa-examples/blob/21624513c6ad94faabbb1cb4b97d73b897f9afae/examples/boltzmann_wealth_model_experimental/app.py#L5-L11, i.e. the |
# https://github.com/Princeton-CDH/simulating-risk/blob/907c290e12c97b28aa9ce9c80ea7fc52a4f280ae/simulatingrisk/hawkdove/server.py#L114-L171 | ||
# Copyright 2023 The Center for Digital Humanities of Princeton | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this line requires a review from @jackiekazil @tpike3 @Corvince and maybe even a dev meeting with a vote. I’m totally fine with attribution, but now we’re changing our license to a mixed one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's technically a compatible license, with Mesa being Apache 2.0 as well, instead of GPLv3. This is how proper attribution of a code snippet should be, according to ChatGPT 3.5. I have only seen examples of attributing an entire file(s) in the past, so I haven't looked up for any precedence (for a subset of a file) yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about when we update the code. After how much code change does that contribution still make sense? Would we get Ship of Theseus situations?
@rlskoeser I think attribution for your work is very important (@rht can confirm that, we recently discussed it). However, I think you should be credited for the current state of the code - the code that you actually wrote. The right place for that would be the commit message, and maybe the PR. The code is a living document, I don't think attribution there makes sense.
If you want full authorship it might be best to open a PR yourself, or make a clean nice commit we can cherry pick, giving you first authorship.
What we maybe could do additionally, is throw in a note in the next release notes. Release notes will remain static for eternity, and have (I think) way more exposure than the source code. You would be mentioned both on the GitHub Release pages as in the History, which is (or should be) also available on our official documentation (in Readthedocs). What would you think about that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, all, for being so thoughtful about this.
I don't think I have capacity right now for a PR (unless there's something tightly scoped I can easily provide), and I think maybe the development has already moved beyond that anyway. (Apologies for the hidden axis thing in my code that tripped you up!)
An acknowledgement in the release notes sounds like a good solution to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am switching to co-authorship in this PR for now.
Not exactly. For size this works as you described, but for color in matplotlib you set the actual colors (in your example tab:red and tab:blue ). In altair/vega you set the color encoding. So you are just saying give the value "tab:red" one color and the value "tab:blue" another one. The actual colors that are used are just the default categorical ones (lightblue and orange) |
d5f0cb9
to
bb34a7d
Compare
I was about to switch the Altair viz color behavior to match Matplotlib (i.e. color means color, instead of category encoded in color), but decided against it, because the underlying code will look more opaque for the users to modify (edit: as it deviates from idiomatic Altair). As such, I'm leaving the code in this PR as is, to limit its scope. The scope is to have a feature parity with Matplotlib JupyterViz's We need something like the 2nd point in #1988 (comment) that @quaquel raised. This can be in the form of abstracting out the chart definition https://github.com/projectmesa/mesa/pull/1991/files#diff-681727772982fb0400d413fc9253bbc5e1af9b51d5a9d8581f2ab9d39a3cd516R39-R51 to a function that can be specified by the user. |
cedbaaa
to
5e3900d
Compare
I fixed this by converting the data from DF to |
_draw_grid is derived from https://github.com/Princeton-CDH/simulating-risk/blob/907c290e12c97b28aa9ce9c80ea7fc52a4f280ae/simulatingrisk/hawkdove/server.py#L114-L171 Co-authored-by: rlskoeser <[email protected]>
for more information, see https://pre-commit.ci
New version of the video, with no more jitter. output.mp4The only concern in this PR is that the Are there any other concerns? |
I don't know why, but I can't view the movie. |
Can we move forward with this PR ASAP? I want to implement #2049 but for Altair and many other things. |
I understand your frustration, but for me the main question is still and you haven't commented on this yet, how this relates to #1902 and how to deal with this situation, as I asked on Matrix. I think this is very controversial |
There have been various requests for modifications to the code in #1902. The last response from the author of that PR is from 2 weeks ago and in no way acknowledges the requested changes. I am sympathetic to therefore moving forward with this one instead. |
@Corvince I already replied almost immediately on your question on Matrix, on Matrix, more than a week ago. |
I guess this is @Corvince's question. I looked through your responses @rht, but I don't see a clear answer to this specific question. You did write
So, are you saying that your answer to @Corvince is to just merge this PR and close the other without any acknowledgement to the author of #1902? |
Yes, mesa-interactive already exists in a separate repo, https://github.com/Corvince/mesa-interactive. |
I don't know the backstory to any of this. At face value, merging this PR without any acknowledgement to the author of #1902 seems a s bit harsh even though the author has not replied to various reasonable modifications to the code. What is wrong with a simple mention in the PR message itself of the work done in #1902? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think through the discussion here and on matrix it should hopefully be clear that we do value the other PR as well. But I think this PR is very clean and uncontroversial, so I am going to merge. Some ideas of#1902 can still be added later in a new pr
Thank you for moving this forward. Finally. |
Demo for Boltzmann wealth model:
output.mp4