Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

A changing color in an autocovariance graph

All elements of the following function works outside the function but the function return an error

def histoautocorr(v,a):
    def conds(x,a) :
        if x > a : 
            return x
        else :  
            return 0
    def condi(x,a) :
        if x <= a : 
            return x
        else :  
            return 0 
    vs=[conds(x,a) for x in v]
    vs=[condi(x,a) for x in v]
    histoa=bar_chart(conds,rgbcolor=(0.15,0.5,0.5))
    histoa.axes_labels([r'$o$',r'$v(o)$'])
    histoa.fontsize(7)
    histob=bar_chart(condi,rgbcolor=(0, 1, 0.45))
    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). Also, by curiosity, I would appreciate to know if it is possible to redefine this fonction using two intermediate lambda functions. Last but not least, is there a way to have a label which show the color associated with a bar < a and the opposite?

A changing color in an autocovariance graph

All elements of the following function works outside the function but the function return an error

def histoautocorr(v,a):
    def conds(x,a) :
        if x > a : 
            return x
        else :  
            return 0
    def condi(x,a) :
        if x <= a : 
            return x
        else :  
            return 0 
    vs=[conds(x,a) for x in v]
    vs=[condi(x,a) vi=[condi(x,a) for x in v]
    histoa=bar_chart(conds,rgbcolor=(0.15,0.5,0.5))
    histoa.axes_labels([r'$o$',r'$v(o)$'])
    histoa.fontsize(7)
    histob=bar_chart(condi,rgbcolor=(0, 1, 0.45))
    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). Also, by curiosity, I would appreciate to know if it is possible to redefine this fonction using two intermediate lambda functions. Last but not least, is there a way to have a label which show the color associated with a bar < a and the opposite?

A changing color in an autocovariance graph

All elements of the following function works outside the function but the function return an error

def histoautocorr(v,a):
    def conds(x,a) :
        if x > a : 
            return x
        else :  
            return 0
    def condi(x,a) :
        if x <= a : 
            return x
        else :  
            return 0 
    vs=[conds(x,a) for x in v]
    vi=[condi(x,a) for x in v]
    histoa=bar_chart(conds,rgbcolor=(0.15,0.5,0.5))
    histoa.axes_labels([r'$o$',r'$v(o)$'])
    histoa.fontsize(7)
    histob=bar_chart(condi,rgbcolor=(0, 1, 0.45))
    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). Also, by curiosity, I would appreciate to know if it is possible to redefine this fonction using two intermediate lambda functions. Last but not least, is there a way to have a label which show showS the color associated with a bar < a and the opposite?

A changing color in an autocovariance graph

All elements of the following function works outside the function but the function return an error

def histoautocorr(v,a):
    def conds(x,a) :
        if x abs(x) > a : 
            return x
        else :  
            return 0
    def condi(x,a) :
        if x abs(x) <= a : 
            return x
0
        else :  
            return 0 x 
    vs=[conds(x,a) for x in v]
    vi=[condi(x,a) for x in v]
    histoa=bar_chart(conds,rgbcolor=(0.15,0.5,0.5))
    histoa.axes_labels([r'$o$',r'$v(o)$'])
    histoa.fontsize(7)
    histob=bar_chart(condi,rgbcolor=(0, 1, 0.45))
    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). Also, by curiosity, I would appreciate to know if it is possible to redefine this fonction using two intermediate lambda functions. Last but not least, is there a way to have a label which showS the color associated with a bar < a and the opposite?

A changing color in an autocovariance graph

All elements of the following function works outside the function but the function return an error

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(conds,rgbcolor=(0.15,0.5,0.5))
histoa=bar_chart(conds(x,a),rgbcolor=(0.15,0.5,0.5))
    histoa.axes_labels([r'$o$',r'$v(o)$'])
    histoa.fontsize(7)
    histob=bar_chart(condi,rgbcolor=(0, histob=bar_chart(condi(x,a),rgbcolor=(0, 1, 0.45))
    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). Also, by curiosity, I would appreciate to know if it is possible to redefine this fonction using two intermediate lambda functions. Last but not least, is there a way to have a label which showS the color associated with a bar < a and the opposite?

A changing color in an autocovariance graph

All elements of the following function works outside the function but the function return an errorcorrectly (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(conds(x,a),rgbcolor=(0.15,0.5,0.5))
histoa=bar_chart(vs,rgbcolor=(0.15,0.5,0.5))
    histoa.axes_labels([r'$o$',r'$v(o)$'])
    histoa.fontsize(7)
    histob=bar_chart(condi(x,a),rgbcolor=(0, histob=bar_chart(vi,rgbcolor=(0, 1, 0.45))
    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). Also, by curiosity, but I would appreciate to know if it is possible to redefine like a colored label saying "a" < a for the value of a used in the simulation. How can I do this fonction using two intermediate lambda functions. Last but not least, is there a way to have a label which showS the color associated with a bar < a and the opposite??

A changing color in an autocovariance graph

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))
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))
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.