mesa icon indicating copy to clipboard operation
mesa copied to clipboard

Refactor altair in line with matplotlib

Open quaquel opened this issue 1 year ago • 5 comments

#2430 cleans up matplotlib space plotting. It would be great if the resulting cleaner API also works for altair space plotting.

quaquel avatar Oct 30 '24 08:10 quaquel

Some quick updates of what needs doing:

  1. rename make_space_altair to something like make_altair_space_component
  2. add make_altair_plot_component
  3. Add support for all spaces. This means including the hexgrid and network transformation of the x and y coordinates.
  4. Have a generic get_agent_data method
  5. The current code does all visual encoding in a "matplotlib" style by adding "color" and "size" explicitly to the long-form data frame that is the basis of any Altair plot. This seems to be at odds with the philosophy behind Altair which cleanly separates the data to be visualized from the visual encoding given to this data. So, in my view, we should pass a dataframe with the relevant attributes to altair and handle 'marker', 'size', and 'color' explicitly via encoding.
  6. Create the altair plot only once and only update the underlying data frame, See also #2255 and e.g., this open altair issue. I have been able to make the discussed work arround work. It is not yet the fully streaming of data, but worth exploring.

quaquel avatar Oct 31 '24 08:10 quaquel

can i work on this?

nissu99 avatar Jan 23 '25 13:01 nissu99

@quaquel @EwoutH should i include an example using altair plot?

nissu99 avatar Jan 24 '25 05:01 nissu99

Hey @nissu99, did you fish the issue or can i work on it?

Edu92337 avatar Mar 09 '25 20:03 Edu92337

@Edu92337 ,It is in progress.

nissu99 avatar Mar 09 '25 21:03 nissu99