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 âm mưu thanh được nhóm 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. Nó đã được giới thiệu bởi John Hunter trong năm 2002.
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.
- Biểu đồ thanh là một cách tuyệt vời để so sánh dữ liệu phân loại trên một hoặc hai chiều. Thường xuyên hơn không, nó thú vị hơn khi so sánh các giá trị giữa hai chiều và đối với điều đó, một biểu đồ thanh được nhóm là cần thiết.
- Thư viện nhập [Matplotlib]
Nhập / tạo dữ liệu.
Python3
Vẽ các thanh theo cách nhóm.
Ví dụ 1: [lô thanh đơn giản]
import
matplotlib.pyplot as plt
import
numpy as np
x
=
np.arange[
______7
y1
=
matplotlib.pyplot as plt
1matplotlib.pyplot as plt
2matplotlib.pyplot as plt
3matplotlib.pyplot as plt
4matplotlib.pyplot as plt
3matplotlib.pyplot as plt
6matplotlib.pyplot as plt
3matplotlib.pyplot as plt
8matplotlib.pyplot as plt
3__
numpy as np
8numpy as np
9x
0x
1
numpy as np
8x
3x
0x
5
Các
numpy as np
5=
numpy as np
7
Python3
Vẽ các thanh theo cách nhóm.
Ví dụ 1: [lô thanh đơn giản]
import
matplotlib.pyplot as plt
import
numpy as np
x
=
np.arange[
______7
y1
=
matplotlib.pyplot as plt
1matplotlib.pyplot as plt
2matplotlib.pyplot as plt
3matplotlib.pyplot as plt
4matplotlib.pyplot as plt
3matplotlib.pyplot as plt
6matplotlib.pyplot as plt
3matplotlib.pyplot as plt
8matplotlib.pyplot as plt
3__
Các
numpy as np
5=
numpy as np
7
matplotlib.pyplot as plt
04=
matplotlib.pyplot as plt
06]
numpy as np
8x
3x
0matplotlib.pyplot as plt
11=
matplotlib.pyplot as plt
13]
matplotlib.pyplot as plt
15matplotlib.pyplot as plt
16matplotlib.pyplot as plt
3matplotlib.pyplot as plt
18matplotlib.pyplot as plt
3matplotlib.pyplot as plt
20matplotlib.pyplot as plt
3matplotlib.pyplot as plt
22matplotlib.pyplot as plt
3matplotlib.pyplot as plt
24matplotlib.pyplot as plt
25
matplotlib.pyplot as plt
26matplotlib.pyplot as plt
27]
matplotlib.pyplot as plt
29matplotlib.pyplot as plt
30]
matplotlib.pyplot as plt
32matplotlib.pyplot as plt
33matplotlib.pyplot as plt
3matplotlib.pyplot as plt
35matplotlib.pyplot as plt
3matplotlib.pyplot as plt
37matplotlib.pyplot as plt
25
matplotlib.pyplot as plt
39
Các
numpy as np
5=
numpy as np
7dataframe plot]
Python3
Vẽ các thanh theo cách nhóm.
Ví dụ 1: [lô thanh đơn giản]
import
matplotlib.pyplot as plt
import
numpy as np
matplotlib.pyplot as plt
89matplotlib.pyplot as plt
90=
matplotlib.pyplot as plt
1matplotlib.pyplot as plt
93matplotlib.pyplot as plt
3matplotlib.pyplot as plt
95matplotlib.pyplot as plt
3matplotlib.pyplot as plt
97matplotlib.pyplot as plt
3matplotlib.pyplot as plt
99matplotlib.pyplot as plt
3import
01matplotlib.pyplot as plt
25
import
03import
04
import
05=
matplotlib.pyplot as plt
93import
08
import
09import
10=
import
12import
08
import
09import
15=
import
17import
08
import
09import
20=
import
22]
Các