本文的文字及圖片來源于網路,僅供學習、交流使用,不具有任何商業用途,著作權歸原作者所有,如有問題請及時聯系我們以作處理,
以下文章來源于Python小例子 ,作者 Emily
今天教大如何完整繪制出下面的圖形了:
原圖如下,與上圖相比,缺少一條曲線,x、y軸的線條顏色不清楚,今天我們添加這些功能,
添加曲線
在add_yaxis一條曲線,代碼如下,原理與上一篇add_yaxis極為相似:
.add_yaxis( series_name="訂單量", y_axis=y2_data, symbol="circle", symbol_size = 10, is_symbol_show=True, label_opts=opts.LabelOpts(is_show=False), itemstyle_opts=opts.ItemStyleOpts( color = "#c257F6" ), markpoint_opts=opts.MarkPointOpts( label_opts=opts.LabelOpts( color = '#fff' ), data = [opts.MarkPointItem( type_ = 'max', name = '最大值' ),opts.MarkPointItem( type_ = 'min', name = '最小值' )] ) )
x、y軸的線條顏色修改
這些屬性都已被封裝為單獨物件,opts.AxisOpts物件里的opts.AxisLineOpts里的opts.LineStyleOpts
opts.SplitLineOpts控制x軸的網格線 is_show false 不顯示:
opts.AxisTickOpts控制刻度不顯示 is_show false :
xaxis_opts=opts.AxisOpts( type_="category", axisline_opts=opts.AxisLineOpts( linestyle_opts=opts.LineStyleOpts( color="rgba(204,187,225,0.5)" ) ), splitline_opts=opts.SplitLineOpts( is_show = False ), axistick_opts=opts.AxisTickOpts( is_show = False ) )
y 軸線條顏色修改與之相似,代碼不再粘貼,
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/401.html
標籤:Python
