본문 바로가기
1. SW 개발 & IT 트렌드

Python - matplotlib.pyplot.plot(*args, **kwargs)

by soosun 2020. 7. 22.

Plot lines and/or markers to the Axes. args is a variable length argument, allowing for multiple x, y pairs with an optional format string. For example, each of the following is legal:

plot(x, y)        # plot x and y using default line style and color
plot(x, y, 'bo')  # plot x and y using blue circle markers
plot(y)           # plot y using x as index array 0..N-1
plot(y, 'r+')     # ditto, but with red plusses

 

https://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.plot

 

pyplot — Matplotlib 2.0.2 documentation

Parameters:X : array_like, shape (n, m) or (n, m, 3) or (n, m, 4) Display the image in X to current axes. X may be an array or a PIL image. If X is an array, it can have the following shapes and types: MxN – values to be mapped (float or int) MxNx3 – R

matplotlib.org

 

로또 번호 자동 생성기 함수

import numpy as np
# np.random.choice(np.arange(1, 46), size=6)
# np.random.choice(np.arange(1, 46), size=6, replace=False)

def generate_lotto_nums():
    return np.random.choice(np.arange(1, 46), size=6, replace=False)
    
generate_lotto_nums()

#array([33, 20, 14, 19, 10,  4])

 

댓글