-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
reversescale doesn't reverse colorbar on contour plot with coloring='heatmap' #4430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
bug
something broken
Comments
Without Codevar 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]],
x: [-9, -6, -5 , -3, -1],
y: [0, 1, 4, 5, 7],
type: 'contour',
reversescale: true,
}];
var layout = {
title: 'Setting the X and Y Coordinates in a Contour Plot'
};
Plotly.newPlot('myDiv', data, layout); Codepen |
plotly.js/src/traces/contour/colorbar.js Lines 22 to 28 in adf9bee
Do we need to flip the colorscale here like below? if(coloring === 'heatmap') {
var cOpts = extractOpts(trace);
opts._fillgradient = cOpts.reversescale ?
Colorscale.flipScale(cOpts.colorscale) :
cOpts.colorscale;
opts._zrange = [cOpts.min, cOpts.max];
} else if(coloring === 'fill') {
opts._fillcolor = colorMap;
} It seems to be working. the json to produce the plot above: {
"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]
],
"x": [-9, -6, -5, -3, -1],
"y": [0, 1, 4, 5, 7],
"type": "contour",
"contours": {
"coloring": "heatmap"
},
"reversescale": true
}
]
} |
Thanks for reporting! |
@etpinard Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug
reversescale: True
doesn't reverse the colorbar on a contour plot with{contours: {coloring: 'heatmap'}}
.In the plot below, the colorbar indicates the red region has larger values, but it actually has smaller values.
Code
Codepen
https://codepen.io/harupy/pen/bGNgBOz
The text was updated successfully, but these errors were encountered: