Skip to content

Commit 18fbd17

Browse files
authoredDec 14, 2021
Merge pull request #405 from fxhuhn/master
Adding edgecolors and linewidths **for `type=scatter`**
2 parents b400b06 + f17324b commit 18fbd17

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed
 

‎src/mplfinance/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
version_info = (0, 12, 8, 'beta', 4)
2+
version_info = (0, 12, 8, 'beta', 5)
33

44
_specifier_ = {'alpha': 'a','beta': 'b','candidate': 'rc','final': ''}
55

‎src/mplfinance/plotting.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -915,10 +915,13 @@ def _addplot_columns(panid,panels,ydata,apdict,xdates,config):
915915
mark = apdict['marker']
916916
color = apdict['color']
917917
alpha = apdict['alpha']
918+
edgecolors = apdict['edgecolors']
919+
linewidths = apdict['linewidths']
920+
918921
if isinstance(mark,(list,tuple,np.ndarray)):
919-
_mscatter(xdates,ydata,ax=ax,m=mark,s=size,color=color,alpha=alpha)
922+
_mscatter(xdates, ydata, ax=ax, m=mark, s=size, color=color, alpha=alpha, edgecolors=edgecolors, linewidths=linewidths)
920923
else:
921-
ax.scatter(xdates,ydata,s=size,marker=mark,color=color,alpha=alpha)
924+
ax.scatter(xdates, ydata, s=size, marker=mark, color=color, alpha=alpha, edgecolors=edgecolors, linewidths=linewidths)
922925
elif aptype == 'bar':
923926
width = 0.8 if apdict['width'] is None else apdict['width']
924927
bottom = apdict['bottom']
@@ -1033,6 +1036,7 @@ def _valid_addplot_kwargs():
10331036
valid_linestyles = ('-','solid','--','dashed','-.','dashdot','.','dotted',None,' ','')
10341037
valid_types = ('line','scatter','bar', 'ohlc', 'candle','step')
10351038
valid_stepwheres = ('pre','post','mid')
1039+
valid_edgecolors = ('face', 'none', None)
10361040

10371041
vkwargs = {
10381042
'scatter' : { 'Default' : False,
@@ -1060,7 +1064,13 @@ def _valid_addplot_kwargs():
10601064
'linestyle' : { 'Default' : None,
10611065
'Validator' : lambda value: value in valid_linestyles },
10621066

1063-
'width' : { 'Default' : None, # width of `bar` or `line`
1067+
'linewidths': {'Default': None,
1068+
'Validator' : lambda value: isinstance(value,(int,float)) },
1069+
1070+
'edgecolors': {'Default': None,
1071+
'Validator': lambda value: mcolors.is_color_like(value) or value in valid_edgecolors},
1072+
1073+
'width' : { 'Default' : None, # width of `bar` or `line`
10641074
'Validator' : lambda value: isinstance(value,(int,float)) or
10651075
all([isinstance(v,(int,float)) for v in value]) },
10661076

0 commit comments

Comments
 (0)
Please sign in to comment.