Skip to content

Histogram with colorscale non working properly #895

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

Closed
ghtmtt opened this issue Dec 11, 2017 · 2 comments
Closed

Histogram with colorscale non working properly #895

ghtmtt opened this issue Dec 11, 2017 · 2 comments

Comments

@ghtmtt
Copy link

ghtmtt commented Dec 11, 2017

Hi all,

if this isn't the right place where to open this issue, sorry.

The problem rises when I try to use a default numerical array as colorscale for Histograms. Super simple example:


import plotly
import plotly.graph_objs as go

f1 = [4,5,6,2]
f2 = [10,20,30,40]
trace1 = go.Histogram(
x = f1,
marker = dict(
    color = f2
    )
)

data = [trace1]
fig = go.Figure(data=data)
plotly.offline.plot(fig) 

in this case the color array is not taken into account while the same settings work perfectly with Bar and other plots:


import plotly
import plotly.graph_objs as go

f1 = [4,5,6,2]
f2 = [10,20,30,40]
trace1 = go.Bar(
x = f1,
marker = dict(
    color = f2
    )
)

data = [trace1]
fig = go.Figure(data=data)
plotly.offline.plot(fig) 

It seems that for Histogram I have to define manually rgb color values, without having all the nice colorscale colors defined, e.g.:

import plotly
import plotly.graph_objs as go

f1 = [4,5,6,2]
c = ['rgb(0,12,255)', 'rgb(100,0,20)',  'rgb(20,250,30)', 'rgb(20,250,30)']

trace1 = go.Histogram(
x = f1,
y = f2,
mode = 'markers',
marker = dict(
    color = c,
)
)

data = [trace1]
fig = go.Figure(data=data, layout = layout)
plotly.offline.plot(fig)
@cldougl
Copy link
Member

cldougl commented Dec 11, 2017

Hi there,
You can follow this issue for more information: plotly/plotly.js#1984

@cldougl cldougl closed this as completed Dec 11, 2017
@ghtmtt
Copy link
Author

ghtmtt commented Dec 12, 2017

Thanks! I was not aware of this discussion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants