Skip to content

Support for different projections? #2049

Answered by Fil
jaanli asked this question in Q&A
Apr 10, 2024 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Out of the box, Plot only supports a handful of projections (the same as d3-geo). But you can pass any projection (as long as it is defined as a D3 projection stream) as the projection option, which is a bit complex to use because it offers quite a few possibilities—in particular to adjust the projection to the chart's dimensions.

In particular all the projections from the d3-geo-projection and d3-geo-polygon modules can be included this way.

For example, to use the Imago projection in a notebook, define:

Plot.plot({
  width,
  height: width * 0.437,
  projection: {
    type: ({ width, height }) => d3.geoImago().fitSize([width, height], land),
    inset: 5
  },
  marks: [Plot.frame(), Pl…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jaanli
Comment options

@Fil
Comment options

Fil May 2, 2024
Collaborator

Answer selected by jaanli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2048 on April 10, 2024 13:00.