LinePlotterIndicator: plot y-axis in log scale
-
Dear Community,
I succeeded in plotting a custom-built indicator with bt.LinePlotterIndicator, but I just couldn't figure out how to convert the y-axis to log-scale.
This is my first attempt:
signalplotter = bt.LinePlotterIndicator(self.inds['signal1'], plotlog=True)
And I also tried:
signalplotter = bt.LinePlotterIndicator(self.inds['signal1']) signalplotter.plotinfo.plotlog = True
... but this also did not work.
It would be fantastic if someone could point me into the right direction!
Thanks a lot,
J -
i think
plotlog
should be set on the indicator level, not forLinePLotterIndicator
. -
@ab_trader Thanks for your quick reply, this is highly appreciated!
I tried to do this, but it did not work. I guess the issue is that the indicator that I plan to plot is not a plain-vanilla indicator, but rather an indicator that I divided by a value.
import numpy as np
... (blabla)...
self.inds['signal1'] = self.inds['signalA']/np.log(23) #just taking 23 to make things understandable, this is not what I am actually doing :-)... self.inds['signal1'].plotinfo.plotlog = True signalplotter = bt.LinePlotterIndicator(self.inds['signal1'])
Without the "self.inds['signal1'].plotinfo.plotlog = True" the line is plotted nicely, just not in log scale. When I add the ".plotinfo.plotlog" then I receive the following Error:
AttributeError: 'LinesOperation' object has no attribute 'plotinfo'
I also tried to define the logplot for "self.inds['signalA']". While I don't get an error message there (which makes sense because it is an indicator and not a "LinesOperation"), the information seems to get lost on the way down to the LinePlotterIndicator...
Would be amazing if you have an idea how to solve this puzzle :-)!
Best,
J -
Based on one old comment from the 'bt' author (search forum for 'lineplotterindicator') 'lineplotterindicator' was made to quickly show a line. So you may need to make an indicator from 'self.inds['signal1']' to be able to customize it's plotting.