Hướng dẫn how to plot multiple data in python - cách vẽ nhiều dữ liệu trong python

Tôi muốn vẽ nhiều tập dữ liệu trên cùng một biểu đồ phân tán:

cases = scatter(x[:4], y[:4], s=10, c='b', marker="s")
controls = scatter(x[4:], y[4:], s=10, c='r', marker="o")

show()

Ở trên chỉ cho thấy scatter() gần đây nhất

Tôi cũng đã thử:

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()

Âm mưu trong cùng một cốt truyện: Matplotlib

Bây giờ chúng ta đã tìm hiểu về việc vẽ nhiều biểu đồ bằng cách sử dụng hàm Subplot và subplot2Grid của thư viện matplotlib. Như đã đề cập trước đó, bây giờ chúng ta sẽ xem xét âm mưu nhiều đường cong bằng cách chồng chất chúng. Trong phương pháp này, chúng tôi không sử dụng bất kỳ chức năng đặc biệt nào thay vì chúng tôi trực tiếp vẽ các đường cong trên nhau và cố gắng đặt tỷ lệ.

X plt = subplot(111) plt.scatter(x[:4], y[:4], s=10, c='b', marker="s") plt.scatter(x[4:], y[4:], s=10, c='r', marker="o") show() 0 plt = subplot(111) plt.scatter(x[:4], y[:4], s=10, c='b', marker="s") plt.scatter(x[4:], y[4:], s=10, c='r', marker="o") show() 1plt = subplot(111) plt.scatter(x[:4], y[:4], s=10, c='b', marker="s") plt.scatter(x[4:], y[4:], s=10, c='r', marker="o") show() 2plt = subplot(111) plt.scatter(x[:4], y[:4], s=10, c='b', marker="s") plt.scatter(x[4:], y[4:], s=10, c='r', marker="o") show() 3plt = subplot(111) plt.scatter(x[:4], y[:4], s=10, c='b', marker="s") plt.scatter(x[4:], y[4:], s=10, c='r', marker="o") show() 4plt = subplot(111) plt.scatter(x[:4], y[:4], s=10, c='b', marker="s") plt.scatter(x[4:], y[4:], s=10, c='r', marker="o") show() 5plt = subplot(111) plt.scatter(x[:4], y[:4], s=10, c='b', marker="s") plt.scatter(x[4:], y[4:], s=10, c='r', marker="o") show() 6plt = subplot(111) plt.scatter(x[:4], y[:4], s=10, c='b', marker="s") plt.scatter(x[4:], y[4:], s=10, c='r', marker="o") show() 7plt = subplot(111) plt.scatter(x[:4], y[:4], s=10, c='b', marker="s") plt.scatter(x[4:], y[4:], s=10, c='r', marker="o") show() 8

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
81
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
0 scatter()1

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
84
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
0 scatter()4
matplotlib.pyplot.subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True, subplot_kw=None, gridspec_kw=None, **fig_kw)

Parameters:

  1. plt = subplot(111)
    plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
    plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
    show()
    
    87
    plt = subplot(111)
    plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
    plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
    show()
    
    0
    plt = subplot(111)
    plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
    plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
    show()
    
    89__19019019
    These gives the number of rows and columns  respectively. Also, it must be noted that both these parameters are optional and the default value is 1.
  2. đường cong chức năng sin và cosine trong một biểu đồ These parameters specify about the properties that are shared among a and y axis.Possible values for them can be, row, col, none or default value which is False.
  3. Điều kiện tiên quyết: matplotlibThis parameter is a boolean value specified, which asks the programmer whether to squeeze out, meaning remove the extra dimension from the array. It has a default value False.
  4. Trong matplotlib, chúng ta có thể vẽ nhiều biểu đồ trong một lô theo hai cách. Một là bằng cách sử dụng hàm Subplot () và các hàm khác bằng cách chồng chất của biểu đồ thứ hai trên i.e đầu tiên, tất cả các biểu đồ sẽ xuất hiện trên cùng một lô. Chúng tôi sẽ xem xét cả hai cách từng người một.This parameters allow us to add keywords to each subplot and its default value is None.
  5. Nhiều sơ đồ sử dụng hàm Subplot ()This allows us to add grids on each subplot and has a default value of None.
  6. Hàm Subplot () là hàm trình bao bọc cho phép lập trình viên vẽ nhiều hơn một biểu đồ trong một hình bằng cách gọi nó một lần.This allows us to pass any other additional keyword argument to the function call and has a default value of None.

Thí dụ :

Python3

import matplotlib.pyplot as plt

import numpy as np

import math

X 3

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
0 X 5X 6
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
6X 6____999__12

Is

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
24
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
0 X 5X 6
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
6X 6X 9import3
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
6__12

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
38
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
0
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
1import3
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
6
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
43
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
8

scatter()8

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
0 import0

import1

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
0 import3
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
5
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
6
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
5
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
8

import8

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
2
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
6
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
2matplotlib.pyplot as plt2

import8

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
2
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
6
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
2matplotlib.pyplot as plt7matplotlib.pyplot as plt8
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
8

import8

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
2
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
6import3import4

import8

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
2
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
6import3matplotlib.pyplot as plt7__60

import8import3

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
6
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
2numpy as np6

import8import3

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
6
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
2matplotlib.pyplot as plt7import2
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
8

import8import3

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
6import3import8

import8import3

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
6import3matplotlib.pyplot as plt7math4
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
8

math6

Đầu ra

Hướng dẫn how to plot multiple data in python - cách vẽ nhiều dữ liệu trong python

Nhiều sơ đồ sử dụng hàm Subplot ()

Trong matplotlib, có một hàm khác rất giống với subplot là subplot2grid (). Nó gần giống như hàm Subplot nhưng cung cấp sự linh hoạt hơn để sắp xếp các đối tượng cốt truyện theo nhu cầu của lập trình viên.

Hàm này được viết như sau:

Cú pháp: matplotlib.pyplot.subplot2grid (hình dạng, loc, rowspan = 1, colspan = 1, fig = none, ** kwargs)matplotlib.pyplot.subplot2grid(shape, loc, rowspan=1, colspan=1, fig=None, **kwargs)

Parameter:

  1. Tham số Shapethis là một chuỗi gồm hai giá trị số nguyên cho biết hình dạng của lưới mà chúng ta cần đặt các trục. Mục đầu tiên là cho hàng, trong khi mục thứ hai là dành cho cột.
    This parameter is a sequence of two integer values which tells the shape of the grid for which we need to place the axes. The first entry is for row, whereas the second entry is for column.
  2. Tham số hình dạng locus, thậm chí IOC là một chuỗi gồm 2 giá trị số nguyên, trong đó mục đầu tiên vẫn còn cho hàng và thứ hai là để cột đặt trục trong lưới.
    Like shape parameter, even Ioc is a sequence of 2 integer values, where first entry remains for the row and the second is for column to place axis within grid.
  3. Tham số Rowspanthis lấy giá trị nguyên và số cho biết số lượng hàng cho trục kéo dài hoặc tăng về phía bên phải.
    This parameter takes integer value and the number which indicates the number of rows for the axis to span to or increase towards right side.
  4. Tham số colspanthis lấy giá trị số nguyên và số cho biết số lượng cột cho trục kéo dài hoặc tăng độ dài xuống.
    This parameter takes integer value and the number which indicates the number of columns for the axis to span to or increase the length downwards.
  5. Figthis là một tham số tùy chọn và đưa hình để đặt trục vào. Nó mặc định là hình hiện tại.
    This is an optional parameter and takes Figure to place axis in. It defaults to current figure.
  6. ** kwargsthis cho phép chúng tôi chuyển bất kỳ đối số từ khóa bổ sung nào khác cho cuộc gọi hàm và có giá trị mặc định là không có.
    This allows us to pass any other additional keyword argument to the function call and has a default value of None.

Thí dụ :

Python3

import matplotlib.pyplot as plt

import numpy as np

import math

X 3

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
0 X 5X 6
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
6X 6____999__12

Is

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
24
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
0 X 5X 6
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
6X 6X 9import3
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
6__12

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
38
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
0
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
1import3
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
6
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
43
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
8

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
45
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
4
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
4
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
48
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
8

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
50
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
51
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
8

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
53

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
54
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
55
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
8

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
57
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
4
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
59

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
60
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
61
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
8

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
63

math6

Đầu ra

Hướng dẫn how to plot multiple data in python - cách vẽ nhiều dữ liệu trong python

Nhiều sơ đồ sử dụng hàm Subplot ()

Trong matplotlib, có một hàm khác rất giống với subplot là subplot2grid (). Nó gần giống như hàm Subplot nhưng cung cấp sự linh hoạt hơn để sắp xếp các đối tượng cốt truyện theo nhu cầu của lập trình viên.

Hàm này được viết như sau:

Thí dụ :

Python3

import matplotlib.pyplot as plt

import numpy as np

import math

X 3

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
0 X 5X 6
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
6X 6____999__12

Is

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
24
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
0 X 5X 6
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
6X 6X 9import3
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
6__12

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
38
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
0
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
1import3
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
6
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
43
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
8

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
94
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
0
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
96
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
90
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
0
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
99
plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
8

scatter()01scatter()02

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
8

scatter()04scatter()05

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
8

scatter()07scatter()08

plt = subplot(111)
plt.scatter(x[:4], y[:4], s=10, c='b', marker="s")
plt.scatter(x[4:], y[4:], s=10, c='r', marker="o")
show()
8

scatter()10

math6

Đầu ra

Hướng dẫn how to plot multiple data in python - cách vẽ nhiều dữ liệu trong python

Nhiều sơ đồ sử dụng hàm subplot2Grid ()