简体   繁体   中英

Adding multiple vertical lines and scatterplot to cufflinks quantfig candlestick plot

I am trying to use cufflinks quantfigure to add more elements to the candlestick plot. I need guidance on 2 items.

  1. Add multiple horizontal lines, in different color, at once. I am able to add multiple lines of predefined color or single line of custom color but I am not able to add multiple lines of custom color
qf=cf.QuantFig(data,title='Apple Quant Figure',legend='top',name='GS')
qf.add_shapes(hline =[225,275]) # plots same red color lines at to locations 
qf.add_shapes(hline = dict(y=250,color='blue',width=3, dash='dashdot')) #plots single custom line at the location

qf.add_shapes(hline = [dict(y=300,color='blue',width=3, dash='dashdot'),
                       dict(y=250,color='blue',width=3, dash='dashdot')]) #does not work

qf.add_shapes(hline = dict(y=[200,300],color='blue',width=3, dash='dashdot')) #does not work

Trying to add multiple lines of custom type (color and line style) does not work enter image description here

  1. How add scatter plot on the candlestick plot. I am trying to plot something like this using cufflinks: enter image description here

This works for me, draws 2 horizontal and 2 vertical lines to get a rectangle:

qf.add_shapes(hline=[{'x0': '2021-02-17 00:00:00', 'x1': '2021-02-27 00:00:00', 'y': 40000, 'color': 'orange'}])
qf.add_shapes(hline=[{'x0': '2021-02-17 00:00:00', 'x1': '2021-02-27 00:00:00', 'y': 41000, 'color': 'blue'}])
qf.add_shapes(vline=[{'x': '2021-02-17 00:00:00', 'y0': 40000, 'y1': 41000, 'color': 'orange'}])
qf.add_shapes(vline=[{'x': '2021-02-27 00:00:00', 'y0': 40000, 'y1': 41000, 'color': 'blue'}])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM