mplfinance
mplfinance copied to clipboard
How to push my marker subplot in front of the main plot wick? (problem with candles and wicks)
Hello.
when im adding a mark(I've used 'v') with mpf.make_addplot ,
my subplot is at a better visual priority from the candles, but not the wicks.
is that a bug? is there anything im doing wrong? I've used "inherit" in styling, and my make_addplot is pretty simple.
You are not doing anything wrong. This has to do with zorder
as you noted over here.
Until zorder
is implemented, you can try two things:
-
Plot your markers further away from the candles so that they don't overlap with the candles: Click here for example code for doing this.
-
Pass
alpha=0.5
in to yourmake_addplot()
call so that the markers are somewhat transparent.
Please also see my comment here if you have not already seen it.
In the meanwhile I can suggest a small hack.. In plotting.py file which is in the installation folder of mplfinance add zorder in the relevant line of code (I also added edgecolor as shown in the code below):
if aptype == 'scatter': size = apdict['markersize'] mark = apdict['marker'] color = apdict['color'] alpha = apdict['alpha']
if isinstance(mark,(list,tuple,np.ndarray)):
_mscatter(xdates,ydata,ax=ax,m=mark,s=size,color=color,alpha=alpha)
else:
ax.scatter(xdates,ydata,s=size,marker=mark,color=color,alpha=alpha,zorder=3,edgecolor='white')