plotly / plotly/plotly.js

Constraint-type contour plot cannot shade entire area

Open
#6,284 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3
Dominant language
JavaScript
Stars
18.3k
Forks
2k
Avg merge
2d 12h
Merged PRs (30d)
28

Description

Steps to reproduce

Create plotly.js data object with the following:

var data = [ {
  z: [[10, 10.625, 12.5, 15.625, 20],
       [5.625, 6.25, 8.125, 11.25, 15.625],
       [2.5, 3.125, 5., 8.125, 12.5],
       [0.625, 1.25, 3.125, 6.25, 10.625],
       [0, 0.625, 2.5, 5.625, 10]],
  type: 'contour',
  colorscale: 'Jet',
    "contours": {
        "coloring": "lines",
        "operation": "][",
        "showlabels": true,
        "type": "constraint",
        "value": [0,20]
    },
}];

Here is a link to a CodePen that shows the problem. https://codepen.io/kfd182/pen/yLKvNLJ

Current behaviour (bug)

Empty plot

Expected behaviour (correct)

Plot that is entirely shaded in

Other comment

When making a contour plot that uses type=‘constraint’ and operation = ‘][’ , setting value = [data-min, data-max] creates an empty plot, instead of a completed shaded plot. If you adjust data-min to be slightly larger or adjust data-max to be slightly smaller, then you get a nearly completely shaded plot.

I think one workaround could be using {operation: '<', and value: data-min}. This will shade the entire plot area.

Reported by

kdaquila-questek

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied CodePen reproduction and trace contour handling for operation ][ with value [data-min, data-max]. Done means the full data range renders as a shaded plot instead of an empty plot, while the nearby boundary cases continue to behave correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.