Điều này sẽ hoạt động theo cách bạn muốn:
import pandas as pd
df = pd.DataFrame[dict[
A=[1, 2, 3, 4],
B=[2, 3, 4, 5],
C=[3, 4, 5, 6],
D=[4, 5, 6, 7]]]
import matplotlib.pyplot as plt
%matplotlib inline
fig = plt.figure[figsize=[20, 10]]
ab_bar_list = [plt.bar[[0, 1, 2, 3], df.B, align='edge', width= 0.2],
plt.bar[[0, 1, 2, 3], df.A, align='edge', width= 0.2]]
cd_bar_list = [plt.bar[[0, 1, 2, 3], df.D, align='edge',width= -0.2],
plt.bar[[0, 1, 2, 3], df.C, align='edge',width= -0.2]]
Chỉ cần ghi nhớ, giá trị width
cho một nhóm phải là tích cực và tiêu cực cho nhóm thứ hai. Sử dụng align
bằng edge
là tốt. Bạn phải đặt thanh với các giá trị lớn nhất trước thanh với các giá trị thấp nhất và nếu bạn muốn các thanh xuất hiện xếp chồng lên nhau chứ không phải là một giá trị khác, hãy thay đổi df.B
và df.D
thành df.B + df.A
và df.D + df.C
, tương ứng. Nếu không có mẫu rõ ràng hoặc bao gồm, hãy sử dụng phương thức align
bằng edge
và width
với phương pháp được đề xuất bởi @pirsquared. Một giải pháp khác là truy cập từng giá trị từ thanh màu xanh lá cây và so sánh nó với giá trị tương ứng từ thanh màu đỏ và vẽ đồ thị phù hợp [quá nhiều công việc không cần thiết trong cái này].
You have to place the bar with the biggest values before the bar with the lowest values, and if you want the bars
to appear stacked above one another rather than one in front of another, change df.B
and df.D
to df.B + df.A
and df.D + df.C
, respectively. If there's no apparent or consisting pattern, use the align
by edge
and width
method with the one suggested by @piRSquared.
Another alternative would be to access each value from a green bar and compare it to the corresponding value from the red bar, and plot accordingly [too much unnecessary work in this one].
# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
Xem thảo luận Cải thiện bài viết Lưu bài viết Xem thảo luận Cải thiện bài viết Lưu bài viết Đọc
- Bàn luận
- Trong bài viết này, chúng tôi sẽ học cách tạo ra một cốt truyện xếp chồng lên nhau trong matplotlib. Hãy để thảo luận về một số khái niệm:
- Matplotlib là một thư viện trực quan to lớn trong Python cho các lô 2D của mảng. Matplotlib có thể là một thư viện trực quan hóa dữ liệu đa nền tảng được xây dựng trên các mảng numpy và được thiết kế để tìm ra ngăn xếp Scipy rộng hơn.
Approach:
- Biểu đồ thanh hoặc biểu đồ thanh có thể là một biểu đồ đại diện cho danh mục kiến thức với các thanh hình chữ nhật có độ dài và độ cao mà tỷ lệ thuận với các giá trị mà chúng đại diện. Các ô thanh thường được vẽ theo chiều ngang hoặc chiều dọc.
- Các ô thanh xếp chồng lên nhau đại diện cho các nhóm khác nhau ở mức cao nhất trong số 1 người khác. Đỉnh của thanh phụ thuộc vào chiều cao kết quả của hỗn hợp kết quả của các nhóm. Nó đi từ đáy đá đến giá trị thay vì đi từ 0 đến giá trị.
- Thư viện nhập [Matplotlib]
Nhập / tạo dữ liệu.
Python3
Vẽ các thanh theo cách ngăn xếp.
Ví dụ 1: [lô thanh xếp chồng đơn giản]
# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
3 # libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
4# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
5# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
6 # libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
7# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
8# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
9Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 190
# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
9Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 19222
align
8
# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
6edge
0edge
1edge
2
# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
6edge
4# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
6edge
6edge
1edge
8
Đầu ra:
Team Round 1 Round 2 Round 3 Round 4
0 A 10 20 10 26
1 B 20 25 15 21
2 C 12 15 19 6
3 D 10 18 11 19
6
6 # libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
7# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
Team Round 1 Round 2 Round 3 Round 4
0 A 10 20 10 26
1 B 20 25 15 21
2 C 12 15 19 6
3 D 10 18 11 19
9
9# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
width
1
9# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
Team Round 1 Round 2 Round 3 Round 4
0 A 10 20 10 26
1 B 20 25 15 21
2 C 12 15 19 6
3 D 10 18 11 19
9
9# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
width
5 Team Round 1 Round 2 Round 3 Round 4
0 A 10 20 10 26
1 B 20 25 15 21
2 C 12 15 19 6
3 D 10 18 11 19
5
Python3
Vẽ các thanh theo cách ngăn xếp.
Ví dụ 1: [lô thanh xếp chồng đơn giản]
Ví dụ 1: [lô thanh xếp chồng đơn giản]
# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
3 # libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
4# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
5# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
6 # libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
7# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
8# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
9Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 190
# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
9Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 19222
Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 196
# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
6 # libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
7Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 199
# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
9width
1# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
9Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 199
# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
9width
5Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 195
width
7
# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
6 # libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
7width
1# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
9align
2# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
9align
4# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
9align
2align
8
# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
6edge
0edge
1edge
2
# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
6edge
4# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
6edge
6edge
1# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
28# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
6# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
30# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
31# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
32# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
6# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
34edge
1# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
36# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
6# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
30# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
31# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
40# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
31# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
42# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
6# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
44edge
1# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
46# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
47edge
1# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
49# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
50edge
1Ví dụ 2: [Biểu đồ thanh xếp chồng với hơn 2 dữ liệu]
# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
61# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
62edge
1edge
8
Đầu ra:
3 # libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
df.B
2dataframe plot]
Python3
Vẽ các thanh theo cách ngăn xếp.
Ví dụ 1: [lô thanh xếp chồng đơn giản]
# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
3 # libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
4# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
5# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
6 # libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
7# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
8# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
9Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 190
# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
9Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 19222
Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 1904
# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
7Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 194
# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
9Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 199
# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
9Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 1910
# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
9Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 1912
# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
9# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
03Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 1915
Các
Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 1930
Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 1931
Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 1932
# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
6Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 1920
Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 1935
# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
6Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 1937
Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 1938
# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
6Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 1940
Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 1941
Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 1942
Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 1943
# libraries
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import pandas as pd
# y-axis in bold
rc['font', weight='bold']
# Values of each group
bars1 = [12, 28, 1, 8, 22]
bars2 = [28, 7, 16, 4, 10]
bars3 = [25, 3, 23, 25, 17]
# Heights of bars1 + bars2
bars = np.add[bars1, bars2].tolist[]
# The position of the bars on the x-axis
r = [0,1,2,3,4]
# Names of group and bar width
names = ['A','B','C','D','E']
barWidth = 1
# Create brown bars
plt.bar[r, bars1, color='#7f6d5f', edgecolor='white', width=barWidth]
# Create green bars [middle], on top of the first ones
plt.bar[r, bars2, bottom=bars1, color='#557f2d', edgecolor='white', width=barWidth]
# Create green bars [top]
plt.bar[r, bars3, bottom=bars, color='#2d7f5e', edgecolor='white', width=barWidth]
# Custom X axis
plt.xticks[r, names, fontweight='bold']
plt.xlabel["group"]
# Show graphic
plt.show[]
6Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 1945
edge
1edge
8
Đầu ra:
Team Round 1 Round 2 Round 3 Round 4 0 A 10 20 10 26 1 B 20 25 15 21 2 C 12 15 19 6 3 D 10 18 11 19