Để vẽ một điểm dữ liệu đơn lẻ:
- Khởi tạo danh sách x, y với giá trị đơn.
- Giới hạn trục X, Y từ 0 đến 5.
- Vẽ lưới kiểu đường hiện tại.
- Vẽ x, y bằng plot() với marker="o", markeredgecolor="red", markerfacecolor="green".
- Hiển thị bằng show().
Ví dụ
from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True x = [4] y = [3] plt.xlim(0, 5) plt.ylim(0, 5) plt.grid() plt.plot(x, y, marker="o", markersize=20, markeredgecolor="red", markerfacecolor="green") plt.show()
Kết quả
