genres=pandas.DataFrame(all_by_week['BoxOffice'].mean()/norm1)
genres.columns=['All Genres']
genres=genres.join(fantasy_by_week['BoxOffice'].mean()/norm2)
genres.columns=['All Genres','Fantasy']
genres=genres.join(animation_by_week['BoxOffice'].mean()/norm3)
genres.columns=['All Genres','Fantasy','Animation']
genres=genres.join(romance_by_week['BoxOffice'].mean()/norm4)
genres.columns=['All Genres','Fantasy','Animation','Romance']

genres=genres.fillna(0)

columns_name = ['All Genres','Fantasy','Animation','Romance']
genres.columns = [ 0, 4, 8, 12]

x, y, z = genres.stack().reset_index().values.T
#print  genres.stack().reset_index().values.T  #debug
#print genres#debug

app = vv.use()
f = vv.clf()
a = vv.cla()
plot =vv.bar3(x, y, z)
plot.colors = ["b","g","y","r"] * 53
a.axis.xLabel = 'Week #'
a.axis.yTicks = dict(zip(genres.columns, columns_name))
a.axis.zLabel = 'Avg BoxOffice (Aribitrary Units)'
app.Run()



Пример #2
0
    if axes is None:
        axes = vv.gca()

    # Create Bars instance
    bars = Bars3D(axes)

    # Create boxes
    for x, y, h in zip(xx, yy, hh):
        pos = (x, y, h / 2.0)
        scale = (width, width, h)
        m = vv.solidBox(pos, scale, axesAdjust=False, axes=bars)
        m.specular = 0

# Adjust axes
    if axesAdjust:
        if axes.daspectAuto is None:
            axes.daspectAuto = False
        axes.cameraType = '3d'
        axes.SetLimits()

    # Done
    axes.Draw()
    return bars

if __name__ == '__main__':
    a = vv.gca()
    b = vv.bar3([1, 2, 3, 2, 4, 3], width=0.5)
    a.axis.showGrid = 1
    a.axis.xTicks = ['Januari', 'Februari', 'March', 'April', 'May', 'June']
    b.colors = 'rgbcmy'
norm3 = animation_by_week['BoxOffice'].mean().max() / 30
norm4 = romance_by_week['BoxOffice'].mean().max() / 30

genres = pandas.DataFrame(all_by_week['BoxOffice'].mean() / norm1)
genres.columns = ['All Genres']
genres = genres.join(fantasy_by_week['BoxOffice'].mean() / norm2)
genres.columns = ['All Genres', 'Fantasy']
genres = genres.join(animation_by_week['BoxOffice'].mean() / norm3)
genres.columns = ['All Genres', 'Fantasy', 'Animation']
genres = genres.join(romance_by_week['BoxOffice'].mean() / norm4)
genres.columns = ['All Genres', 'Fantasy', 'Animation', 'Romance']

genres = genres.fillna(0)

columns_name = ['All Genres', 'Fantasy', 'Animation', 'Romance']
genres.columns = [0, 4, 8, 12]

x, y, z = genres.stack().reset_index().values.T
#print  genres.stack().reset_index().values.T  #debug
#print genres#debug

app = vv.use()
f = vv.clf()
a = vv.cla()
plot = vv.bar3(x, y, z)
plot.colors = ["b", "g", "y", "r"] * 53
a.axis.xLabel = 'Week #'
a.axis.yTicks = dict(zip(genres.columns, columns_name))
a.axis.zLabel = 'Avg BoxOffice (Aribitrary Units)'
app.Run()
Пример #4
0
    
    # Create Bars instance
    bars = Bars3D(axes)
    
    # Create boxes    
    for x,y,h in zip(xx,yy, hh):
        pos = (x,y,h/2.0)
        scale = (width,width,h)
        m = vv.solidBox(pos, scale, axesAdjust=False, axes=bars)
        m.specular = 0
    
   # Adjust axes
    if axesAdjust:
        if axes.daspectAuto is None:
            axes.daspectAuto = False
        axes.cameraType = '3d'
        axes.SetLimits()
    
    # Done
    axes.Draw()
    return bars
    
    
    
if __name__ == '__main__':
    a = vv.gca()   
    b = vv.bar3([1,2,3,2,4,3], width=0.5)
    a.axis.showGrid = 1
    a.axis.xTicks = ['Januari', 'Februari', 'March', 'April', 'May', 'June']
    b.colors = 'rgbcmy'
Пример #5
0
# Calculate means
mean = lambda x: sum(x)/len(x)
mean_temps_per_month = [mean(tt) for tt in temps_per_month]

# Prepare figure
vv.figure(1); vv.clf()

# Show means in a normal bar chart
a1 = vv.subplot(221); 
b2 = vv.bar(mean_temps_per_month)
b2.color = 'r'

# Show means in a 3D bar chart
a2 = vv.subplot(222); 
b3 = vv.bar3(mean_temps_per_month)
b3.color = 'g'
a2.daspect = 1,1,0.3

# Show box plot
a3 = vv.subplot(223)
bp = vv.boxplot(temps_per_month)
bp.lc = 'b'
bp.lw = 2

# Show violin plot
a4 = vv.subplot(224)
vp = vv.boxplot(temps_per_month, whiskers='violin')
vp.lc = 'm'
vp.lw = 3
Пример #6
0
# Calculate means
mean = lambda x: sum(x) / len(x)
mean_temps_per_month = [mean(tt) for tt in temps_per_month]

# Prepare figure
vv.figure(1)
vv.clf()

# Show means in a normal bar chart
a1 = vv.subplot(221)
b2 = vv.bar(mean_temps_per_month)
b2.color = 'r'

# Show means in a 3D bar chart
a2 = vv.subplot(222)
b3 = vv.bar3(mean_temps_per_month)
b3.color = 'g'
a2.daspect = 1, 1, 0.3

# Show box plot
a3 = vv.subplot(223)
bp = vv.boxplot(temps_per_month)
bp.lc = 'b'
bp.lw = 2

# Show violin plot
a4 = vv.subplot(224)
vp = vv.boxplot(temps_per_month, whiskers='violin')
vp.lc = 'm'
vp.lw = 3