hi.
i get this error when i use base mpl style:
s = mpl.make_mpf_style(base_mpl_style='yahoo', marketcolors=mc)
error:
OSError: 'yahoo' not found in the style library and input is not a valid URL or path; see style.available for list of available styles
when i use mpl.style.available() i get this:
['binance',
'blueskies',
'brasil',
'charles',
'checkers',
'classic',
'default',
'mike',
'nightclouds',
'sas',
'starsandstripes',
'yahoo']
before changing interpreter to anaconda in pycharm i didn't get this error but for using talib i'm forced to use anaconda...
idon't know it is a bug or there is something to do.
@mlmrtz ,
It looks like, somewhere in your code, matplotlib and mplfinance are being confused one with the other. I'm not sure where, because I can't see all the code. Regarding the code that I _can_ see:
There are two base-styles that you can set: base_mpl_style (matplotlib) and base_mpf_style (mplfinance).
In the code you have posted mpl.make_mpf_style(base_mpl_style='yahoo', marketcolors=mc) you are attempting to set a matplotlib style to the name of one of the mplfinance styles.
Furthermore, your use of mpl.style.available() does not make sense; perhaps there is a typo??
If mpl is indeed from import matplotlib as mpl then .style.available is not callable (available()) because in matplotlib .style.available it is a list object.
On the other hand, if what you have done import mplfinance as mpl (as I have seen sometimes, instead of mpf) then you should be getting AttributeError: module 'mplfinance' has no attribute 'style'.
The styles you have listed there are definitely mplfinance styles and not matplotlib styles (although the syntax, mpl.style.available(), (except for the function call ( ) part) is _almost_ what you would use to see matplotlib styles.
That's all I can say about the code you have posted. Hopefully it's enough to find the error. If not, please provide more information.
Just as a side note, for clarification, the conventional imports are as mpl and mpf:
import matplotlib as mpl
import mplfinance as mpf
Of course you can always import however you choose.
And, given the above conventional imports, the way to find available styles for each is:
mpl.style.available # list available styles for `matplotlib`
mpf.available_styles() # list available styles for `mplfinance`
hth
thank you Daniel for your explanation.
i used "import mplfinance as mpl" and because of that i had some mistakes!
i have changed "base_mpl_style" to "base_mpf_style" and fixed the error.
Most helpful comment
@mlmrtz ,
It looks like, somewhere in your code, matplotlib and mplfinance are being confused one with the other. I'm not sure where, because I can't see all the code. Regarding the code that I _can_ see:
There are two base-styles that you can set:
base_mpl_style(matplotlib) andbase_mpf_style(mplfinance).In the code you have posted
mpl.make_mpf_style(base_mpl_style='yahoo', marketcolors=mc)you are attempting to set amatplotlibstyle to the name of one of themplfinancestyles.Furthermore, your use of
mpl.style.available()does not make sense; perhaps there is a typo??If
mplis indeed fromimport matplotlib as mplthen.style.availableis not callable (available()) because in matplotlib.style.availableit is a list object.On the other hand, if what you have done
import mplfinance as mpl(as I have seen sometimes, instead ofmpf) then you should be gettingAttributeError: module 'mplfinance' has no attribute 'style'.The styles you have listed there are definitely mplfinance styles and not matplotlib styles (although the syntax,
mpl.style.available(), (except for the function call( )part) is _almost_ what you would use to see matplotlib styles.That's all I can say about the code you have posted. Hopefully it's enough to find the error. If not, please provide more information.
Just as a side note, for clarification, the conventional imports are
asmpl and mpf:Of course you can always import however you choose.
And, given the above conventional imports, the way to find available styles for each is:
hth