Skip to content

Add optional polar coordinate grid and axes for polar plots #371

Closed

Description

@wwwaker

Problem

Function Plot supports polar functions through fnType: 'polar', but the
result is currently displayed with Cartesian x/y axes.

For polar equations, users often need a polar coordinate grid with concentric
circles, radial lines, and angle labels. This is especially useful for
visualizing polar curves in mathematics education.

Proposed feature

Add an opt-in polar coordinate system for polar plots, including:

  • concentric circles for radius values;
  • radial lines for angle values;
  • radius and angle tick labels;
  • grid updates when the chart is zoomed or resized.

The existing Cartesian rendering should remain the default for backward
compatibility. A possible API could be:

functionPlot({
  coordinateSystem: 'polar',
  polar: {
    grid: true
  },
  data: [{
    r: '2 * sin(4 * theta)',
    fnType: 'polar',
    graphType: 'polyline'
  }]
})

I would be happy to help implement this feature

Activity

  1. mauriciopoppe commented on Sep 27, 2026

    @mauriciopoppe
    Owner

    Thanks for looking at the project, the current state of the project wrt branches is:

    • main: unfinished 2.0 API and architecture line.
    • release-1.25: compatibility/stability branch for existing 1.x consumers.

    Depending on where you'd like to add it it could be in the 1.x version (easier to release but needs to be backwards compatible) or in the main branch (where we can do breaking changes in the API).

    For the main branch, the vision is at https://github.com/mauriciopoppe/function-plot/blob/main/design/vision.md which leads to a WIP API redesign at https://github.com/mauriciopoppe/function-plot/blob/main/design/api-refactor.md. Following these I think we could do:

    const plot = Plot.plot({
      coordinateSystem: {
        type: 'polar',
        grid: true,
        radius: { domain: [0, 2] },
        angle: { labels: true }
      },
      marks: [
        Plot.polar({ r: '2 * sin(4 * theta)' })
      ]
    })
    
    container.replaceChildren(plot)

    However the API redesign isn't implemented yet so the main branch isn't in a good position to add a coordinateSystem.

  2. wwwaker commented on Sep 28, 2026

    @wwwaker
    Author

    Thanks for clarifying the branch situation.

    I would like to target release-1.25. I plan to create a feature branch from it and implement polar plotting and polar grids using the existing 1.x API, while preserving backward compatibility and keeping Cartesian plotting as the default.

    I will include tests and documentation, and target the pull request at release-1.25.

    Does this direction fit the project’s current plans?

  3. mauriciopoppe commented on Oct 11, 2026

    @mauriciopoppe
    Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions