Skip to content

Issues with traces types that accepts matrices as inputs #12

Closed
@disberd

Description

@disberd

Some plotly trace types accepts input data in matrix format and the behavior of the trace changes whether the data is specified as a matrix or as a play 1D vector.

The issue comes from the serialization of JSON3 that by defaults serializes any ND-Array as its 1D content.

This can create issues that are different depending on the specific trace affected. I could identify the following problems in these traces, with some details in the examples below:

  • heatmap
  • surface
  • contour

Heatmap Example

The heatmap trace can accept the z values as a matrix, in which case the x and y values can be provided as the vectors generating the underlying grid.
If z is provided as a vector, x and y also has to be provided as 1D vectors containing the x/y values of each single point in z.
This creates an issue when trying to provide z as matrix and x,y as generating vectors in PlolyLight:

image

Surface Example

A different problem happens in surface still when trying to provide x and y as generating vectors, where no Plot is produced with PlotlyLight:

image

Contour Example

Finally, something very weird that I don't understand happens with contour. The plot is rendered but the resulting contour is not the correct one:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions