Skip to content

Line should use the projection by default, if available #1165

Closed
@Fil

Description

@Fil

The way we implemented Plot.line with a projection had us skip the x and y scales if the curve was "projected" (see https://github.com/observablehq/plot/pull/1156/files#r1041916802). This works in practice, but the underlying reason for this branching is that the projected curve needs the raw (unprojected) coordinates, not that it wants to hides the channels from the scales (which in this case is the projection).

This need seems generic enough that we should try and consider systematically passing both the scaled and the unscaled channels to render(); so marks that need the unscaled values could have them without hiding these channels from the scale initializers?

In the particular case of Plot.line, skipping x and y is not a problem, since the projection doesn't set its domain from the channels; one might even argue that the current code is faster, since with this proposal we would compute projected coordinates "for nothing". But still I find this branching inelegant, and it doesn't allow us to set curve=projected as a default for when the mark is used with a projection—which would be my preference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgeoMaps and projectionsquestionFurther information is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions