I am reaching out due to an error message rendered while running a file on command prompt with Python. When typing this:
"C:\Users\ibrah\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.12\Waterfall Plot.py"
the following error message is rendered:
Traceback (most recent call last):
File "C:\Users\ibrah\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.12\Waterfall Plot.py", line 3, in <module>
fig = go.Figure(go.Waterfall(
^^^^^^^^^^^^^
File "C:\Users\ibrah\AppData\Local\Programs\Python\Python312\Lib\site-packages\plotly\graph_objs\_waterfall.py", line 2913, in __init__
self["connector"] = _v
~~~~^^^^^^^^^^^^^
File "C:\Users\ibrah\AppData\Local\Programs\Python\Python312\Lib\site-packages\plotly\basedatatypes.py", line 4866, in __setitem__
self._set_compound_prop(prop, value)
File "C:\Users\ibrah\AppData\Local\Programs\Python\Python312\Lib\site-packages\plotly\basedatatypes.py", line 5277, in _set_compound_prop
val = validator.validate_coerce(val, skip_invalid=self._skip_invalid)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ibrah\AppData\Local\Programs\Python\Python312\Lib\site-packages\_plotly_utils\basevalidators.py", line 2484, in validate_coerce
v = self.data_class(v, skip_invalid=skip_invalid, _validate=_validate)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ibrah\AppData\Local\Programs\Python\Python312\Lib\site-packages\plotly\graph_objs\waterfall\_connector.py", line 155, in __init__
self["line"] = _v
~~~~^^^^^^^^
File "C:\Users\ibrah\AppData\Local\Programs\Python\Python312\Lib\site-packages\plotly\basedatatypes.py", line 4866, in __setitem__
self._set_compound_prop(prop, value)
File "C:\Users\ibrah\AppData\Local\Programs\Python\Python312\Lib\site-packages\plotly\basedatatypes.py", line 5277, in _set_compound_prop
val = validator.validate_coerce(val, skip_invalid=self._skip_invalid)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ibrah\AppData\Local\Programs\Python\Python312\Lib\site-packages\_plotly_utils\basevalidators.py", line 2484, in validate_coerce
v = self.data_class(v, skip_invalid=skip_invalid, _validate=_validate)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ibrah\AppData\Local\Programs\Python\Python312\Lib\site-packages\plotly\graph_objs\waterfall\connector\_line.py", line 190, in __init__
self["color"] = _v
~~~~^^^^^^^^^
File "C:\Users\ibrah\AppData\Local\Programs\Python\Python312\Lib\site-packages\plotly\basedatatypes.py", line 4874, in __setitem__
self._set_prop(prop, value)
File "C:\Users\ibrah\AppData\Local\Programs\Python\Python312\Lib\site-packages\plotly\basedatatypes.py", line 5218, in _set_prop
raise err
File "C:\Users\ibrah\AppData\Local\Programs\Python\Python312\Lib\site-packages\plotly\basedatatypes.py", line 5213, in _set_prop
val = validator.validate_coerce(val)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ibrah\AppData\Local\Programs\Python\Python312\Lib\site-packages\_plotly_utils\basevalidators.py", line 1383, in validate_coerce
self.raise_invalid_val(v)
File "C:\Users\ibrah\AppData\Local\Programs\Python\Python312\Lib\site-packages\_plotly_utils\basevalidators.py", line 296, in raise_invalid_val
raise ValueError(
ValueError:
Invalid value of type 'builtins.str' received for the 'color' property of waterfall.connector.line
Received value: 'rgb(63, 63, 63))'
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, rebeccapurple, 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,
This has a link with an invalid value of type 'builtins.str' received for the 'color' property of waterfall.connector.line.
Here is the code contained in the file executed:
import plotly.graph_objects as go
fig = go.Figure(go.Waterfall(
name = "20", orientation = "v",
measure = ["relative", "relative", "total", "relative", "relative", "total"],
x = ["Sales", "Consulting", "Net revenue", "Purchases", "Other Expenses", "Profit Before Tax"],
textposition = "outside",
text = ["+60", "+80", "" "-40", "-20", "Total"],
y = [60, 80, 0, -40, -20, 0],
connector = {"line":{"color":"rgb(63, 63, 63))"}},))
fig.update_layout(
title = "Profit and loss statement 2018",
showlegend = True
)
fig.show()
Does anyone know how can I execute this without getting through this error message?
Greetings.