运行从plot.ly网站生成的python代码时出现问题

时间:2019-05-16 22:07:18

标签: python plotly plotly-python

我在运行plot.ly网站上生成的python代码时遇到问题。我不确定这是否是已知问题,或者我的系统有问题或做错了什么。 例如,我尝试在https://plot.ly/~cimar/114#code

上运行为可公开获得的地块(不是我的地块)生成的代码

在尝试使用python 2运行它时,出现以下错误:

python test4.py 
/usr/local/lib/python2.7/dist-packages/plotly/graph_objs/_deprecations.py:39: DeprecationWarning:

plotly.graph_objs.Data is deprecated.
Please replace it with a list or tuple of instances of the following types
    - plotly.graph_objs.Scatter
    - plotly.graph_objs.Bar
    - plotly.graph_objs.Area
    - plotly.graph_objs.Histogram
    - etc.


Traceback (most recent call last):
File "test4.py", line 269, in <module>
fig = Figure(data=data, layout=layout)
File "/usr/local/lib/python2.7/dist-packages/plotly/graph_objs/_figure.py", line 510, in __init__
self).__init__(data, layout, frames, skip_invalid, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/plotly/basedatatypes.py", line 194, in __init__
layout, skip_invalid=skip_invalid)
File "/usr/local/lib/python2.7/dist-packages/_plotly_utils/basevalidators.py", line 2136, in validate_coerce
v = self.data_class(v, skip_invalid=skip_invalid)
File "/usr/local/lib/python2.7/dist-packages/plotly/graph_objs/__init__.py", line 5009, in __init__
self['legend'] = legend if legend is not None else _v
File "/usr/local/lib/python2.7/dist-packages/plotly/basedatatypes.py", line 4070, in __setitem__
super(BaseLayoutHierarchyType, self).__setitem__(prop, value)
File "/usr/local/lib/python2.7/dist-packages/plotly/basedatatypes.py", line 3157, in __setitem__
self._set_compound_prop(prop, value)
File "/usr/local/lib/python2.7/dist-packages/plotly/basedatatypes.py", line 3466, in _set_compound_prop
val = validator.validate_coerce(val, skip_invalid=self._skip_invalid)
File "/usr/local/lib/python2.7/dist-packages/_plotly_utils/basevalidators.py", line 2136, in validate_coerce
v = self.data_class(v, skip_invalid=skip_invalid)
File "/usr/local/lib/python2.7/dist-packages/plotly/graph_objs/layout/__init__.py", line 16164, in __init__
self['font'] = font if font is not None else _v
File "/usr/local/lib/python2.7/dist-packages/plotly/basedatatypes.py", line 3157, in __setitem__
self._set_compound_prop(prop, value)
File "/usr/local/lib/python2.7/dist-packages/plotly/basedatatypes.py", line 3466, in _set_compound_prop
val = validator.validate_coerce(val, skip_invalid=self._skip_invalid)
File "/usr/local/lib/python2.7/dist-packages/_plotly_utils/basevalidators.py", line 2136, in validate_coerce
v = self.data_class(v, skip_invalid=skip_invalid)
File "/usr/local/lib/python2.7/dist-packages/plotly/graph_objs/layout/legend/__init__.py", line 215, in __init__
self['color'] = color if color is not None else _v
File "/usr/local/lib/python2.7/dist-packages/plotly/basedatatypes.py", line 3166, in __setitem__
self._set_prop(prop, value)
File "/usr/local/lib/python2.7/dist-packages/plotly/basedatatypes.py", line 3407, in _set_prop
raise err
ValueError: 
    Invalid value of type '__builtin__.str' received for the 'color' property of layout.legend.font
    Received value: ''

The 'color' property is a color and may be specified as:
  - A hex string (e.g. '#ff0000')
  - An rgb/rgba string (e.g. 'rgb(255,0,0)')
  - An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
  - An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
  - A named CSS color:
        aliceblue, antiquewhite, aqua, aquamarine, azure,
        beige, bisque, black, blanchedalmond, blue,
        blueviolet, brown, burlywood, cadetblue,
        chartreuse, chocolate, coral, cornflowerblue,
        cornsilk, crimson, cyan, darkblue, darkcyan,
        darkgoldenrod, darkgray, darkgrey, darkgreen,
        darkkhaki, darkmagenta, darkolivegreen, darkorange,
        darkorchid, darkred, darksalmon, darkseagreen,
        darkslateblue, darkslategray, darkslategrey,
        darkturquoise, darkviolet, deeppink, deepskyblue,
        dimgray, dimgrey, dodgerblue, firebrick,
        floralwhite, forestgreen, fuchsia, gainsboro,
        ghostwhite, gold, goldenrod, gray, grey, green,
        greenyellow, honeydew, hotpink, indianred, indigo,
        ivory, khaki, lavender, lavenderblush, lawngreen,
        lemonchiffon, lightblue, lightcoral, lightcyan,
        lightgoldenrodyellow, lightgray, lightgrey,
        lightgreen, lightpink, lightsalmon, lightseagreen,
        lightskyblue, lightslategray, lightslategrey,
        lightsteelblue, lightyellow, lime, limegreen,
        linen, magenta, maroon, mediumaquamarine,
        mediumblue, mediumorchid, mediumpurple,
        mediumseagreen, mediumslateblue, mediumspringgreen,
        mediumturquoise, mediumvioletred, midnightblue,
        mintcream, mistyrose, moccasin, navajowhite, navy,
        oldlace, olive, olivedrab, orange, orangered,
        orchid, palegoldenrod, palegreen, paleturquoise,
        palevioletred, papayawhip, peachpuff, peru, pink,
        plum, powderblue, purple, red, rosybrown,
        royalblue, saddlebrown, salmon, sandybrown,
        seagreen, seashell, sienna, silver, skyblue,
        slateblue, slategray, slategrey, snow, springgreen,
        steelblue, tan, teal, thistle, tomato, turquoise,
        violet, wheat, white, whitesmoke, yellow,
        yellowgreen

操作系统是Ubuntu16。通过pip安装了Plotly,并将其更新为最新版本

0 个答案:

没有答案