-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Annotated heatmaps: font colour blends with the colour of the square. #1300
Comments
Hello, @jonmmease ! I am using version 3.4.2. An example of the output: https://drive.google.com/file/d/1ISG1TQIqKS5Aj5tEWKlP9QzSuNvxAQK5/view?usp=sharing |
Thanks for the version info @PlatonB. Could you include a small example? The data itself isn't important, but the way you're specifying your colorscale may be. |
@jonmmease |
Hi @PlatonB, I don't think I'm able to reproduce what you're seeing. Here's what I tried: # Imports and data
from plotly.offline import iplot, init_notebook_mode
import plotly.figure_factory as ff
init_notebook_mode()
z = [[.1, .3, .5, .7, .9],
[1, .8, .6, .4, .2],
[.2, 0, .5, .7, .9],
[.9, .8, .4, .2, 0],
[.3, .4, .5, .7, 1]]
# Standard scale direction
fig = ff.create_annotated_heatmap(z, colorscale='Greens', showscale=True)
iplot(fig) # Reversed scale direction
fig = ff.create_annotated_heatmap(z, colorscale='Greens', reversescale=True, showscale=True)
iplot(fig) import plotly
print(plotly.__version__)
Could you try reproducing the issue by starting with this simple example? |
Hello, @jonmmease ! |
Hi @PlatonB, Sorry for not following up on this sooner. If you're still interested in working through this, what we need is an example of the input to the figure factory that causes the issue. Basically, can you start with my example above and then change the |
Hello, @jonmmease Also, in the previous post I attached an example of a complete Figure object, that contains 30x30 z. |
Hi @PlatonB, thanks for providing the dataset, here's what I see using the if I use you're dataset with # Imports and data
from plotly.offline import iplot, init_notebook_mode
import plotly.figure_factory as ff
import numpy as np
import json
init_notebook_mode()
with open('z.json', 'r') as f:
z = json.load(f)
# Standard scale direction
fig = ff.create_annotated_heatmap(z, colorscale='Greens', showscale=True, reversescale=True)
fig.layout.width = 1200
fig.layout.height = 1200
iplot(fig) Which has a lot of overlap, but I think I can make out some pixels with white text that should be black. Here are two subsets of z that show some interesting behavior.
# Imports and data
from plotly.offline import iplot, init_notebook_mode
import plotly.figure_factory as ff
import numpy as np
import json
init_notebook_mode()
with open('z.json', 'r') as f:
z = json.load(f)
import numpy as np
sub_z = np.array(z)[1:13, 0:8].tolist()
# Standard scale direction
fig = ff.create_annotated_heatmap(sub_z, colorscale='Greens', showscale=True, reversescale=True)
fig.layout.width = 800
fig.layout.height = 800
iplot(fig)
# Imports and data
from plotly.offline import iplot, init_notebook_mode
import plotly.figure_factory as ff
import numpy as np
import json
init_notebook_mode()
with open('z.json', 'r') as f:
z = json.load(f)
import numpy as np
sub_z = np.array(z)[1:13, 1:8].tolist()
# Standard scale direction
fig = ff.create_annotated_heatmap(sub_z, colorscale='Greens', showscale=True, reversescale=True)
fig.layout.width = 800
fig.layout.height = 800
iplot(fig) The So yeah, looks like a bug. Thanks again for the report! |
Hello, @jonmmease! Bug can be reproduced when using
|
When using the default color scheme, the font color contrasts normally with the fill of the each heatmap square. But if you try other standard color schemes with
reversescale=True
, when values are close to zero, the colors will merge. I think this is the wrong default behavior.The text was updated successfully, but these errors were encountered: