-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
bugsomething brokensomething broken
Milestone
Description
Currently, color scale attributes have a kinda weird behavior:
import plotly.graph_objs as go
go.scatter.Marker(colorscale="Viridis").colorscale
(('V',), ('i',), ('r',), ('i',), ('d',), ('i',), ('s',))
This is unlike the behavior (to the best of my knowledge) for other attributes specified as strings:
go.scatter.Marker(color="red").color
'red'
And this is pretty unintuitive behavior when doing stuff like:
marker1 = go.scatter.Marker(colorscale="Viridis")
go.scatter.Marker(colorscale=marker1.colorscale)
ValueError:
Invalid value of type 'builtins.tuple' received for the 'colorscale' property of scatter.marker
Received value: (('V',), ('i',), ('r',), ('i',), ('d',), ('i',), ('s',))
Though .update(marker1)
does work for some reason.
My guess is all that needs to happen is to add an elif isinstance(v, str): return v
to this function, since you won't be breaking that immutability requirement.
plotly.py/_plotly_utils/basevalidators.py
Lines 1276 to 1281 in d670bb0
def present(self, v): | |
# Return tuple of tuples so that colorscale is immutable | |
if v is None: | |
return None | |
else: | |
return tuple([tuple(e) for e in v]) |
Metadata
Metadata
Assignees
Labels
bugsomething brokensomething broken