A changing color in an autocovariance graph

asked 2020-06-08 09:02:38 +0200

Cyrille gravatar image

updated 2020-06-08 15:48:04 +0200

All elements of the following function works correctly (in my first time I made a so stupid error I am ashamed).

def histoautocorr(v,a):
    def conds(x,a) :
        if abs(x) > a : 
            return x
        else :  
            return 0
    def condi(x,a) :
        if abs(x) <= a : 
            return 0
        else :  
            return x 
    vs=[conds(x,a) for x in v]
    vi=[condi(x,a) for x in v]
    histoa=bar_chart(vs,rgbcolor=(0.15,0.5,0.5), legend_label='$a < given value$')
    histoa.axes_labels([r'$o$',r'$v(o)$'])
    histoa.fontsize(7)
    histob=bar_chart(vi,rgbcolor=(0, 1, 0.45),, legend_label=r'$a \leq< given value$')
    histob.axes_labels([r'$o$',r'$v(o)$'])
    histob.fontsize(7)
    return show(histoa+histob)

when applied to

ts=finance.TimeSeries([random() for _ in range(100)])
v=[ts.autocovariance(j) for j in range(1,30)]

that is histoautocorr(v,0.005). but I would like a colored label saying "a" < a for the value of a used in the simulation. How can I do this , knowing that given vlaue is the one used for th plot and if possible the text must be in the corresponding color. I know that mathjax accept now colors and I knoiw th syntax, but it doesn't work undeer Firefox. Miss certainly something.

edit retag flag offensive close merge delete

Comments

From errors to errors in my code I have changed the nature of the question.

Cyrille gravatar imageCyrille ( 2020-06-08 11:23:17 +0200 )edit