def makebarsvert(magnitudebenefit,saliencebenefit,magnitudecost,saliencecost): if c.swapsaliencemagnitude: tm = saliencebenefit[:] saliencebenefit = magnitudebenefit[:] magnitudebenefit = tm tm = saliencecost[:] saliencecost = magnitudecost[:] magnitudecost = tm #general variables t = 0 if c.centerlabel is not None: t = 50 out = svg.svg(width = 1000, height = 2250+t, viewbox='0 0 1000 2150') barwidth = 2050/(21+c.spacebars*2) chart = svg.g('transform="translate(0 %s)"' % t) out.add(chart) for cb in range(0,2): if c.centerlabel is not None: out.add(svg.text(c.centerlabel[1-cb], 250+(cb)*500, 25, fontsize=c.font, p='style="text-anchor: middle; dominant-baseline: middle"')) if(cb==1): colors=c.colorsbenefit magnitude=magnitudebenefit salience=saliencebenefit else: magnitude=magnitudecost salience=saliencecost colors=c.colorscost #draw bars for i in range(0,21): h = barheight(magnitude[i]+c.includezeromagnitude) if(c.saliencebywidth==1): w = barwidth/(3+c.includezerosalience)*(salience[i]+c.includezerosalience) elif(c.saliencebywidth>1): w = barwidth/(c.saliencebywidth**3)*(c.saliencebywidth**salience[i]) else: w = barwidth if(c.saliencebycolor): s = ((salience[i]+c.includezerosalience)**c.saliencebycolor)/((3.0+c.includezerosalience)**c.saliencebycolor) else: s = 1 red,green,blue = colors[i//7] if(salience[i]>0 or c.includezerosalience): barlinecolor=(int(red*c.barlineshade),int(green*c.barlineshade),int(blue*c.barlineshade)) chart.add(svg.rect(500+(cb-1)*h,(i+(i//7)*c.spacebars)*barwidth+(barwidth-w)/2,h,w, fill='rgb(%s,%s,%s)' % (red,green,blue), stroke='rgb(%s,%s,%s)' % (barlinecolor[0],barlinecolor[1],barlinecolor[2]), strokewidth=c.barline, p='fill-opacity="%s"' % s)) #invisible link and tooltip box newrect = svg.rect(500+(cb-1)*c.textradius,(i+(i//7)*c.spacebars)*barwidth,c.textradius,barwidth, fill='white', p='fill-opacity="0.0"') newrect.add(svg.title(' %s: %s\n Magnitude %s\tSalience %s' % (c.indicatornames[i], c.indicatorfullnames[i], magnitude[i], salience[i]))) chart.add(newrect) #draw ygrid for i in range(0,c.maxvalue+c.includezeromagnitude+1): if(i==c.includezeromagnitude): w=5 else: w=1 if (c.ygrid or i==0): x2 = 0 else: x2 = 2050-c.ticksize chart.add(svg.line(500+barheight(i)*(cb-.5)*2,2050+c.ticksize,500+barheight(i)*(cb-.5)*2,x2,'black',w)) #draw xgrid dividers chart.add(svg.line(500-c.edgeradius,2050,500+c.edgeradius,2050,'black',5)) for i in range(0,21+c.spacebars*2): if (c.xgrid or (c.saliencebywidth and c.drawsaliencedividers)): chart.add(svg.line(500-c.edgeradius,barwidth*i,500+c.edgeradius,barwidth*i, 'black', 1)) elif(ticksize): chart.add(svg.line(500-c.ticksize,barwidth*i,500+c.ticksize,barwidth*i, 'black', 1)) #draw salience dividers and column headings for i in range(0,21): if(c.saliencebywidth and c.drawsaliencedividers): for j in range(1-c.includezerosalience,3): if(c.saliencebywidth>1): w = barwidth/2/(c.saliencebywidth**3)*(c.saliencebywidth**j) else: w = barwidth/2/(3+c.includezerosalience)*(j+c.includezerosalience) for k in [1,-1]: chart.add(svg.line(500-c.edgeradius,barwidth*(i+(i//7)+.5)+k*w,500+c.edgeradius,barwidth*(i+(i//7)+.5)+k*w, 'black', .5)) x = (500 - c.textradius) y = ((i+(i//7)*c.spacebars+.5)*barwidth) chart.add(svg.text(c.indicatornames[i], x, y, fontsize=c.font, p='style="text-anchor: middle; dominant-baseline: middle"')) #draw magnitude legend if c.magnitudelegend: if c.swapsaliencemagnitude: te = 'Salience' else: te = 'Magnitude' mag=svg.g(p='transform="translate(0 2050)"') mag.add(svg.text(te, 500, 100, fontsize=c.font, p='style="text-anchor: middle; dominant-baseline: middle"')) lastnumber=1 for i in range(0,c.maxvalue+c.includezeromagnitude+1): if (i-c.includezeromagnitude==0): mag.add(svg.text(i-c.includezeromagnitude,502-barheight(i),40, fontsize=c.font, p='style="text-anchor: middle; dominant-baseline: middle"')) if (barheight(i)*2>c.font): mag.add(svg.text(i-c.includezeromagnitude,502+barheight(i), 40, fontsize=c.font, p='style="text-anchor: middle; dominant-baseline: middle"')) elif (i-c.includezeromagnitude>0): # alternate top and bottom if axis lables too close mag.add(svg.text(i-c.includezeromagnitude, 502+barheight(i)*lastnumber,40, fontsize=c.font, p='style="text-anchor: middle; dominant-baseline: middle"')) if (barheight(i)-barheight(i-1)>c.font): mag.add(svg.text(i-c.includezeromagnitude, 502-barheight(i)*lastnumber,40, fontsize=c.font, p='style="text-anchor: middle; dominant-baseline: middle"')) else: lastnumber = lastnumber * -1 chart.add(mag) return out
def makebarsvert(magnitudebenefit, saliencebenefit, magnitudecost, saliencecost): if c.swapsaliencemagnitude: tm = saliencebenefit[:] saliencebenefit = magnitudebenefit[:] magnitudebenefit = tm tm = saliencecost[:] saliencecost = magnitudecost[:] magnitudecost = tm #general variables t = 0 if c.centerlabel is not None: t = 50 out = svg.svg(width=1000, height=2250 + t, viewbox='0 0 1000 2150') barwidth = 2050 / (21 + c.spacebars * 2) chart = svg.g('transform="translate(0 %s)"' % t) out.add(chart) for cb in range(0, 2): if c.centerlabel is not None: out.add( svg.text( c.centerlabel[1 - cb], 250 + (cb) * 500, 25, fontsize=c.font, p='style="text-anchor: middle; dominant-baseline: middle"') ) if (cb == 1): colors = c.colorsbenefit magnitude = magnitudebenefit salience = saliencebenefit else: magnitude = magnitudecost salience = saliencecost colors = c.colorscost #draw bars for i in range(0, 21): h = barheight(magnitude[i] + c.includezeromagnitude) if (c.saliencebywidth == 1): w = barwidth / (3 + c.includezerosalience) * ( salience[i] + c.includezerosalience) elif (c.saliencebywidth > 1): w = barwidth / (c.saliencebywidth**3) * (c.saliencebywidth** salience[i]) else: w = barwidth if (c.saliencebycolor): s = ((salience[i] + c.includezerosalience)** c.saliencebycolor) / ( (3.0 + c.includezerosalience)**c.saliencebycolor) else: s = 1 red, green, blue = colors[i // 7] if (salience[i] > 0 or c.includezerosalience): barlinecolor = (int(red * c.barlineshade), int(green * c.barlineshade), int(blue * c.barlineshade)) chart.add( svg.rect( 500 + (cb - 1) * h, (i + (i // 7) * c.spacebars) * barwidth + (barwidth - w) / 2, h, w, fill='rgb(%s,%s,%s)' % (red, green, blue), stroke='rgb(%s,%s,%s)' % (barlinecolor[0], barlinecolor[1], barlinecolor[2]), strokewidth=c.barline, p='fill-opacity="%s"' % s)) #invisible link and tooltip box newrect = svg.rect(500 + (cb - 1) * c.textradius, (i + (i // 7) * c.spacebars) * barwidth, c.textradius, barwidth, fill='white', p='fill-opacity="0.0"') newrect.add( svg.title(' %s: %s\n Magnitude %s\tSalience %s' % (c.indicatornames[i], c.indicatorfullnames[i], magnitude[i], salience[i]))) chart.add(newrect) #draw ygrid for i in range(0, c.maxvalue + c.includezeromagnitude + 1): if (i == c.includezeromagnitude): w = 5 else: w = 1 if (c.ygrid or i == 0): x2 = 0 else: x2 = 2050 - c.ticksize chart.add( svg.line(500 + barheight(i) * (cb - .5) * 2, 2050 + c.ticksize, 500 + barheight(i) * (cb - .5) * 2, x2, 'black', w)) #draw xgrid dividers chart.add( svg.line(500 - c.edgeradius, 2050, 500 + c.edgeradius, 2050, 'black', 5)) for i in range(0, 21 + c.spacebars * 2): if (c.xgrid or (c.saliencebywidth and c.drawsaliencedividers)): chart.add( svg.line(500 - c.edgeradius, barwidth * i, 500 + c.edgeradius, barwidth * i, 'black', 1)) elif (ticksize): chart.add( svg.line(500 - c.ticksize, barwidth * i, 500 + c.ticksize, barwidth * i, 'black', 1)) #draw salience dividers and column headings for i in range(0, 21): if (c.saliencebywidth and c.drawsaliencedividers): for j in range(1 - c.includezerosalience, 3): if (c.saliencebywidth > 1): w = barwidth / 2 / (c.saliencebywidth** 3) * (c.saliencebywidth**j) else: w = barwidth / 2 / (3 + c.includezerosalience) * ( j + c.includezerosalience) for k in [1, -1]: chart.add( svg.line(500 - c.edgeradius, barwidth * (i + (i // 7) + .5) + k * w, 500 + c.edgeradius, barwidth * (i + (i // 7) + .5) + k * w, 'black', .5)) x = (500 - c.textradius) y = ((i + (i // 7) * c.spacebars + .5) * barwidth) chart.add( svg.text( c.indicatornames[i], x, y, fontsize=c.font, p='style="text-anchor: middle; dominant-baseline: middle"')) #draw magnitude legend if c.magnitudelegend: if c.swapsaliencemagnitude: te = 'Salience' else: te = 'Magnitude' mag = svg.g(p='transform="translate(0 2050)"') mag.add( svg.text( te, 500, 100, fontsize=c.font, p='style="text-anchor: middle; dominant-baseline: middle"')) lastnumber = 1 for i in range(0, c.maxvalue + c.includezeromagnitude + 1): if (i - c.includezeromagnitude == 0): mag.add( svg.text( i - c.includezeromagnitude, 502 - barheight(i), 40, fontsize=c.font, p='style="text-anchor: middle; dominant-baseline: middle"' )) if (barheight(i) * 2 > c.font): mag.add( svg.text( i - c.includezeromagnitude, 502 + barheight(i), 40, fontsize=c.font, p='style="text-anchor: middle; dominant-baseline: middle"' )) elif (i - c.includezeromagnitude > 0): # alternate top and bottom if axis lables too close mag.add( svg.text( i - c.includezeromagnitude, 502 + barheight(i) * lastnumber, 40, fontsize=c.font, p='style="text-anchor: middle; dominant-baseline: middle"' )) if (barheight(i) - barheight(i - 1) > c.font): mag.add( svg.text( i - c.includezeromagnitude, 502 - barheight(i) * lastnumber, 40, fontsize=c.font, p='style="text-anchor: middle; dominant-baseline: middle"' )) else: lastnumber = lastnumber * -1 chart.add(mag) return out
def makecircle(magnitude, salience, benefit=1): if c.swapsaliencemagnitude: tm = salience[:] salience = magnitude[:] magnitude = tm #general variables indicatorseparatorangles = [-math.pi*2/21*i + math.pi/21 for i in range(0,22)] indicatorcenterangles = [-math.pi*2/21*i for i in range(0,21)] wedgeangle = math.pi*2/21 out = svg.svg(width=1000, height=1000+100*c.saliencelegend, viewbox='0 0 1000 1%d00' % (1*c.saliencelegend==True)) if(benefit): colors=c.colorsbenefit else: colors=c.colorscost if c.centerlabel is not None: out.add(svg.text(c.centerlabel[1-benefit], 500, 500, fontsize=c.font, p='style="text-anchor: middle; dominant-baseline: middle"')) #draw wedges for i in range(0,21): r = ringradii(magnitude[i]+c.includezeromagnitude) if(c.saliencebywidth==1): wedgewidth = wedgeangle/2/(3+c.includezerosalience)*(salience[i]+c.includezerosalience) elif(c.saliencebywidth>1): wedgewidth = wedgeangle/2/(saliencebywidth**3)*(c.saliencebywidth**salience[i]) else: wedgewidth = wedgeangle/2 x1 = (500 + math.cos(indicatorcenterangles[i]+wedgewidth)*c.centerradius) y1 = (500 + math.sin(indicatorcenterangles[i]+wedgewidth)*c.centerradius) x2 = (500 + math.cos(indicatorcenterangles[i]+wedgewidth)*r) y2 = (500 + math.sin(indicatorcenterangles[i]+wedgewidth)*r) x3 = (500 + math.cos(indicatorcenterangles[i]-wedgewidth)*r) y3 = (500 + math.sin(indicatorcenterangles[i]-wedgewidth)*r) x4 = (500 + math.cos(indicatorcenterangles[i]-wedgewidth)*c.centerradius) y4 = (500 + math.sin(indicatorcenterangles[i]-wedgewidth)*c.centerradius) if(c.saliencebycolor): s = ((salience[i]+c.includezerosalience)**c.saliencebycolor)/((3.0+c.includezerosalience)**c.saliencebycolor) else: s = 1 red,green,blue = colors[i//7] d = 'M %s,%s L %s,%s A %s,%s 0 0,0 %s,%s L %s,%s A %s,%s 0 0,1 %s,%s' % (x1,y1,x2,y2,r,r,x3,y3,x4,y4,c.centerradius,c.centerradius,x1,y1) if(salience[i]>0 or c.includezerosalience): out.add(svg.path(d, fill='rgb(%s,%s,%s)' % (red,green,blue), p='fill-opacity="%s"' % s)) #draw dividers and text for i in range(0,21): if(c.saliencebywidth and c.drawsaliencedividers): x1 = (500 + math.cos(indicatorcenterangles[i])*c.centerradius) y1 = (500 + math.sin(indicatorcenterangles[i])*c.centerradius) x2 = (500 + math.cos(indicatorcenterangles[i])*c.edgeradius) y2 = (500 + math.sin(indicatorcenterangles[i])*c.edgeradius) out.add(svg.line(x1, y1, x2, y2, 'black', .5)) for j in range(1-c.includezerosalience,3): if(c.saliencebywidth>1): wedgewidth = wedgeangle/2/(c.saliencebywidth**3)*(c.saliencebywidth**j) else: wedgewidth = wedgeangle/2/(3+c.includezerosalience)*(j+c.includezerosalience) for k in [1,-1]: x1 = (500 + math.cos(indicatorcenterangles[i]+wedgewidth*k)*c.centerradius) y1 = (500 + math.sin(indicatorcenterangles[i]+wedgewidth*k)*c.centerradius) x2 = (500 + math.cos(indicatorcenterangles[i]+wedgewidth*k)*c.edgeradius) y2 = (500 + math.sin(indicatorcenterangles[i]+wedgewidth*k)*c.edgeradius) out.add(svg.line(x1, y1, x2, y2, 'black', .5)) #invisible link and tooltip box x1 = (500 + math.cos(indicatorcenterangles[i]+wedgeangle/2)*c.centerradius) y1 = (500 + math.sin(indicatorcenterangles[i]+wedgeangle/2)*c.centerradius) x2 = (500 + math.cos(indicatorcenterangles[i]+wedgeangle/2)*c.textradius+25) y2 = (500 + math.sin(indicatorcenterangles[i]+wedgeangle/2)*c.textradius+25) x3 = (500 + math.cos(indicatorcenterangles[i]-wedgeangle/2)*c.textradius+25) y3 = (500 + math.sin(indicatorcenterangles[i]-wedgeangle/2)*c.textradius+25) x4 = (500 + math.cos(indicatorcenterangles[i]-wedgeangle/2)*c.centerradius) y4 = (500 + math.sin(indicatorcenterangles[i]-wedgeangle/2)*c.centerradius) d = 'M %s,%s L %s,%s L %s,%s L %s,%s z' % (x1,y1,x2,y2,x3,y3,x4,y4) newpath = svg.path(d, fill='white', p='fill-opacity="0.0"') newpath.add(svg.title(' %s: %s\n Magnitude %s\tSalience %s' % (c.indicatornames[i], c.indicatorfullnames[i], magnitude[i], salience[i]))) out.add(newpath) x = (500 + math.cos(indicatorcenterangles[i])*c.textradius) y = (500 + math.sin(indicatorcenterangles[i])*c.textradius) out.add(svg.text(c.indicatornames[i], x, y, fontsize=c.font, p='style="text-anchor: middle; dominant-baseline: middle"')) # draw dividers x1 = 500 + math.cos(indicatorseparatorangles[i])*c.centerradius y1 = 500 + math.sin(indicatorseparatorangles[i])*c.centerradius if(i % 7 == 0): x2 = 500 + math.cos(indicatorseparatorangles[i])*(c.textradius+25) y2 = 500 + math.sin(indicatorseparatorangles[i])*(c.textradius+25) out.add(svg.line(x1, y1, x2, y2, 'black', 10)) elif (c.xgrid or (c.saliencebywidth and c.drawsaliencedividers)): x2 = 500 + math.cos(indicatorseparatorangles[i])*(c.textradius) y2 = 500 + math.sin(indicatorseparatorangles[i])*(c.textradius) out.add(svg.line(x1, y1, x2, y2, 'black', 2)) #draw rings for i in range(0,c.maxvalue+c.includezeromagnitude+1): if(i==c.includezeromagnitude): w=5 out.add(svg.circle('500','500',ringradii(i),'black',w,'none')) elif (c.ygrid or i==0): w=1 out.add(svg.circle('500','500',ringradii(i),'black',w,'none')) return out
def makecircle(magnitude, salience, benefit=1): if c.swapsaliencemagnitude: tm = salience[:] salience = magnitude[:] magnitude = tm #general variables indicatorseparatorangles = [ -math.pi * 2 / 21 * i + math.pi / 21 for i in range(0, 22) ] indicatorcenterangles = [-math.pi * 2 / 21 * i for i in range(0, 21)] wedgeangle = math.pi * 2 / 21 out = svg.svg(width=1000, height=1000 + 100 * c.saliencelegend, viewbox='0 0 1000 1%d00' % (1 * c.saliencelegend == True)) if (benefit): colors = c.colorsbenefit else: colors = c.colorscost if c.centerlabel is not None: out.add( svg.text( c.centerlabel[1 - benefit], 500, 500, fontsize=c.font, p='style="text-anchor: middle; dominant-baseline: middle"')) #draw wedges for i in range(0, 21): r = ringradii(magnitude[i] + c.includezeromagnitude) if (c.saliencebywidth == 1): wedgewidth = wedgeangle / 2 / (3 + c.includezerosalience) * ( salience[i] + c.includezerosalience) elif (c.saliencebywidth > 1): wedgewidth = wedgeangle / 2 / (saliencebywidth**3) * ( c.saliencebywidth**salience[i]) else: wedgewidth = wedgeangle / 2 x1 = (500 + math.cos(indicatorcenterangles[i] + wedgewidth) * c.centerradius) y1 = (500 + math.sin(indicatorcenterangles[i] + wedgewidth) * c.centerradius) x2 = (500 + math.cos(indicatorcenterangles[i] + wedgewidth) * r) y2 = (500 + math.sin(indicatorcenterangles[i] + wedgewidth) * r) x3 = (500 + math.cos(indicatorcenterangles[i] - wedgewidth) * r) y3 = (500 + math.sin(indicatorcenterangles[i] - wedgewidth) * r) x4 = (500 + math.cos(indicatorcenterangles[i] - wedgewidth) * c.centerradius) y4 = (500 + math.sin(indicatorcenterangles[i] - wedgewidth) * c.centerradius) if (c.saliencebycolor): s = ((salience[i] + c.includezerosalience)**c.saliencebycolor) / ( (3.0 + c.includezerosalience)**c.saliencebycolor) else: s = 1 red, green, blue = colors[i // 7] d = 'M %s,%s L %s,%s A %s,%s 0 0,0 %s,%s L %s,%s A %s,%s 0 0,1 %s,%s' % ( x1, y1, x2, y2, r, r, x3, y3, x4, y4, c.centerradius, c.centerradius, x1, y1) if (salience[i] > 0 or c.includezerosalience): out.add( svg.path(d, fill='rgb(%s,%s,%s)' % (red, green, blue), p='fill-opacity="%s"' % s)) #draw dividers and text for i in range(0, 21): if (c.saliencebywidth and c.drawsaliencedividers): x1 = (500 + math.cos(indicatorcenterangles[i]) * c.centerradius) y1 = (500 + math.sin(indicatorcenterangles[i]) * c.centerradius) x2 = (500 + math.cos(indicatorcenterangles[i]) * c.edgeradius) y2 = (500 + math.sin(indicatorcenterangles[i]) * c.edgeradius) out.add(svg.line(x1, y1, x2, y2, 'black', .5)) for j in range(1 - c.includezerosalience, 3): if (c.saliencebywidth > 1): wedgewidth = wedgeangle / 2 / (c.saliencebywidth** 3) * (c.saliencebywidth**j) else: wedgewidth = wedgeangle / 2 / ( 3 + c.includezerosalience) * (j + c.includezerosalience) for k in [1, -1]: x1 = (500 + math.cos(indicatorcenterangles[i] + wedgewidth * k) * c.centerradius) y1 = (500 + math.sin(indicatorcenterangles[i] + wedgewidth * k) * c.centerradius) x2 = (500 + math.cos(indicatorcenterangles[i] + wedgewidth * k) * c.edgeradius) y2 = (500 + math.sin(indicatorcenterangles[i] + wedgewidth * k) * c.edgeradius) out.add(svg.line(x1, y1, x2, y2, 'black', .5)) #invisible link and tooltip box x1 = (500 + math.cos(indicatorcenterangles[i] + wedgeangle / 2) * c.centerradius) y1 = (500 + math.sin(indicatorcenterangles[i] + wedgeangle / 2) * c.centerradius) x2 = (500 + math.cos(indicatorcenterangles[i] + wedgeangle / 2) * c.textradius + 25) y2 = (500 + math.sin(indicatorcenterangles[i] + wedgeangle / 2) * c.textradius + 25) x3 = (500 + math.cos(indicatorcenterangles[i] - wedgeangle / 2) * c.textradius + 25) y3 = (500 + math.sin(indicatorcenterangles[i] - wedgeangle / 2) * c.textradius + 25) x4 = (500 + math.cos(indicatorcenterangles[i] - wedgeangle / 2) * c.centerradius) y4 = (500 + math.sin(indicatorcenterangles[i] - wedgeangle / 2) * c.centerradius) d = 'M %s,%s L %s,%s L %s,%s L %s,%s z' % (x1, y1, x2, y2, x3, y3, x4, y4) newpath = svg.path(d, fill='white', p='fill-opacity="0.0"') newpath.add( svg.title(' %s: %s\n Magnitude %s\tSalience %s' % (c.indicatornames[i], c.indicatorfullnames[i], magnitude[i], salience[i]))) out.add(newpath) x = (500 + math.cos(indicatorcenterangles[i]) * c.textradius) y = (500 + math.sin(indicatorcenterangles[i]) * c.textradius) out.add( svg.text( c.indicatornames[i], x, y, fontsize=c.font, p='style="text-anchor: middle; dominant-baseline: middle"')) # draw dividers x1 = 500 + math.cos(indicatorseparatorangles[i]) * c.centerradius y1 = 500 + math.sin(indicatorseparatorangles[i]) * c.centerradius if (i % 7 == 0): x2 = 500 + math.cos( indicatorseparatorangles[i]) * (c.textradius + 25) y2 = 500 + math.sin( indicatorseparatorangles[i]) * (c.textradius + 25) out.add(svg.line(x1, y1, x2, y2, 'black', 10)) elif (c.xgrid or (c.saliencebywidth and c.drawsaliencedividers)): x2 = 500 + math.cos(indicatorseparatorangles[i]) * (c.textradius) y2 = 500 + math.sin(indicatorseparatorangles[i]) * (c.textradius) out.add(svg.line(x1, y1, x2, y2, 'black', 2)) #draw rings for i in range(0, c.maxvalue + c.includezeromagnitude + 1): if (i == c.includezeromagnitude): w = 5 out.add(svg.circle('500', '500', ringradii(i), 'black', w, 'none')) elif (c.ygrid or i == 0): w = 1 out.add(svg.circle('500', '500', ringradii(i), 'black', w, 'none')) return out