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

Adding a new mark for creating vornoi diagrams #9456

Open
1 task done
josephburkhart opened this issue Oct 16, 2024 · 0 comments
Open
1 task done

Adding a new mark for creating vornoi diagrams #9456

josephburkhart opened this issue Oct 16, 2024 · 0 comments

Comments

@josephburkhart
Copy link

Enhancement Description

I work in a materials science research group that is often interested in constructing phase diagrams from simulation results in multidimensional parameter-space. A common way for us to construct 2 (or 3) dimensional phase diagrams from points in parameter-space is by constructing a vornoi diagram from points that we have classified as belonging to specific phases. I would like to propose that we add a new vornoi mark that represents a collection of points in space as their vornoi diagram.

I'm somewhat new to collaborative open-source development, and I have never contributed to a Vega project, so please pardon any mistakes here. I think my proposal constitutes new syntax, so I will attempt to provide an example minimum spec below:

{
  "mark": {
    "type": "vornoi", 
    "filled": true
  },
  "encoding": {
    "x": {
      "field": "temperature",
      "type": "quantitative",
      "scale": {"zero": false}
    },
    "y": {
      "field": "pressure",
      "type": "quantitative",
      "scale": {"zero": false}
    },
    "color": {
      "field": "phase",
      "type": "nominal"
    }
  }
}

The full spec would look very similar to that of geoshape, except instead of the geometry being determined by projection of pre-defined coordinates, it would be calculated on the fly using a vornoi tessellation algorithm. In fact, there's already a discussion in the altair repo where someone uses the geoshape mark and scipy.spatial.Vornoi to provide a workaround for a vornoi diagram in an altair chart. The reason I'm proposing this enhancement here is that I would eventually like to see this functionality built into altair, so that people like me can use it to easily make interactive phase diagrams.

Here's what I'm not sure about:

  • What would the mark look like if the user zoomed-out, so that the input points only occupied a small part of the canvas? Would the outer vornoi cells just appear to extend outward infinitely, or would we force the user to specify an outer boundary as a property?
  • Would it be possible to re-use the existing implementation of the vornoi algorithm in vega-lite, where it is used to determine the nearest mark to the cursor?
  • Would we want to add any additional encodings or properties to the vornoi mark? For example, I could imagine that perhaps some users might want to construct a weighted vornoi diagram, which would warrant a weight encoding and perhaps a weight-type property.

Checklist

  • I checked for duplicate issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant