Skip to content

Faceted plots #2

Description

@coroa

While trying to extract data from IRENA Renewable power generation costs, i am finding that faceted plots are not supported in an easy manner.

The example plot on page 76
image
uses linear axes for several facets.

It's possible to extract the x-axes and y-axes as a whole, so as to get non-monotonous pixel value mapping:
image

But then, the interpolation function for the Axis,

if (this._interpolation === Interpolation.LINEAR && this.ticks.length > 1) {
// Works because ticks are sorted by pixel position
var minTick = this.ticks[0];
var maxTick = this.ticks[this.ticks.length-1];
var minValue = parseFloat(minTick.value);
var maxValue = parseFloat(maxTick.value);
return MathUtils.project(pixelPos, minTick.pixel, maxTick.pixel, minValue, maxValue);
}

will determine the pixel value incorrectly, by combining the first and last facet.

I was wondering whether an easy fix for faceted plots might not be to change only the interpolation function to test for monoticity and if not given only interpolate between the two nearest tick values?

Can try implementing that, if you think that is a good approach.

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