@empet Thanks for your reply. I figured out point 1. About point 2, I get an error when trying to modify the xaxis
and yaxis
. One of the data
points (there are 42 of them in my figure, data[0]
through data[41]
) looks like this:
>>> plotly_fig['data'][1]
Scatter({
'hoverinfo': 'text',
'marker': {'color': [rgba(173,71,134,1.0), rgba(173,71,134,1.0),
rgba(101,103,181,1.0), ..., rgba(245,39,87,1.0),
rgba(173,71,134,1.0), rgba(173,71,134,1.0)],
'line': {'color': [rgba(173,71,134,1.0), rgba(173,71,134,1.0),
rgba(101,103,181,1.0), ..., rgba(245,39,87,1.0),
rgba(173,71,134,1.0), rgba(173,71,134,1.0)],
'width': 0},
'size': 4.0,
'symbol': 'circle'},
'mode': 'markers',
'name': '',
'text': 'Some text',
'uid': '3c00562c-5200-11e9-83b6-a0d37adb4cf4',
'x': [0.006995890289545059, 0.00341446022503078, -0.003829206805676222, ...,
-0.008903387933969498, 0.004270920529961586, 0.00910072959959507],
'xaxis': 'x',
'y': [0.16, -0.13, 0.18, ..., 0.02, 0.0, 0.09],
'yaxis': 'y'
})
Then when I try do the following:
plotly_fig['data'][1]['xaxis'] = dict(zeroline=False, showline=True, ticklen=4, showgrid=False)
I get the following error:
ValueError:
Invalid value of type 'builtins.dict' received for the 'xaxis' property of scatter
Received value: {'ticklen': 4, 'showgrid': False, 'zeroline': False, 'showline': True}
The 'xaxis' property is an identifier of a particular
subplot, of type 'x', that may be specified as the string 'x'
optionally followed by an integer >= 1
(e.g. 'x', 'x1', 'x2', 'x3', etc.)
The complete stacktrace is as follows:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-30-b62b69100e98> in <module>()
----> 1 plotly_fig['data'][1]['xaxis'] = dict(zeroline=False, showline=True, ticklen=4, showgrid=False)
c:\users\h473\appdata\local\programs\python\python35\lib\site-packages\plotly\basedatatypes.py in __setitem__(self, prop, value)
2773 # ### Handle simple property ###
2774 else:
-> 2775 self._set_prop(prop, value)
2776
2777 # Handle non-scalar case
c:\users\h473\appdata\local\programs\python\python35\lib\site-packages\plotly\basedatatypes.py in _set_prop(self, prop, val)
3009 return
3010 else:
-> 3011 raise err
3012
3013 # val is None
c:\users\h473\appdata\local\programs\python\python35\lib\site-packages\plotly\basedatatypes.py in _set_prop(self, prop, val)
3004 validator = self._validators.get(prop)
3005 try:
-> 3006 val = validator.validate_coerce(val)
3007 except ValueError as err:
3008 if self._skip_invalid:
c:\users\h473\appdata\local\programs\python\python35\lib\site-packages\_plotly_utils\basevalidators.py in validate_coerce(self, v)
1423 pass
1424 elif not isinstance(v, string_types):
-> 1425 self.raise_invalid_val(v)
1426 else:
1427 # match = re.fullmatch(self.regex, v)
c:\users\h473\appdata\local\programs\python\python35\lib\site-packages\_plotly_utils\basevalidators.py in raise_invalid_val(self, v)
242 typ=type_str(v),
243 v=repr(v),
--> 244 valid_clr_desc=self.description()))
245
246 def raise_invalid_elements(self, invalid_els):
ValueError:
Invalid value of type 'builtins.dict' received for the 'xaxis' property of scatter
Received value: {'ticklen': 4, 'showgrid': False, 'zeroline': False, 'showline': True}
The 'xaxis' property is an identifier of a particular
subplot, of type 'x', that may be specified as the string 'x'
optionally followed by an integer >= 1
(e.g. 'x', 'x1', 'x2', 'x3', etc.)