python使用cufflinks时画图为什么会出现错误?
代码为
import pandas as pd
import cufflinks as cf
import plotly.offline as plyo
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import plotly.offline as pyo
import plotly.io as pio
cf.set_config_file(offline=True)
plyo.init_notebook_mode(connected=True)
a=np.random.standard_normal((250,5)).cumsum(axis=0)
index=pd.date_range('2019-1-1',freq='B',periods=len(a))
df=pd.DataFrame(100+5*a,columns=list('abcde'),index=index)
print(df.head())
df.iplot(kind = 'bar',title= '示例', xTitle = 'X轴', yTitle = 'Y轴',color='aliceblue')
pyo.init_notebook_mode()
运行完出现一堆错误:
ValueError:
Invalid value of type 'builtins.str' received for the 'color' property of bar.marker.line
Received value: 'rgba(240, 248, 255, np.float64(1.0))'
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
- A number that will be interpreted as a color
according to bar.marker.line.colorscale
- A list or array of any of the above
这个到底怎么才能画出图,网上没人说