Какова необходимость plt.figure () в matplotlib?Python

Программы на Python
Ответить
Anonymous
 Какова необходимость plt.figure () в matplotlib?

Сообщение Anonymous »

plt.figure(figsize=(10,8))

plt.scatter(df['attacker_size'][df['year'] == 298],
# attacker size in year 298 as the y axis
df['defender_size'][df['year'] == 298],
# the marker as
marker='x',
# the color
color='b',
# the alpha
alpha=0.7,
# with size
s = 124,
# labelled this
label='Year 298')

В приведенном выше фрагменте кода, собранном из Scatterplot в Matplotlib, какова необходимость plt.figure()?
< Strong>ссылка выше не работает, самостоятельный пример:
import matplotlib.pyplot as plt

import pandas as pd

data = {
"attacker_size": [420, 380, 390],
"defender_size": [50, 40, 45]
}

df = pd.DataFrame(data, index = ["day1", "day2", "day3"])

print(df)

plt.figure(figsize=(10,8))

plt.scatter(df['attacker_size'],
# attacker size in year 298 as the y axis
df['defender_size'],
# the marker as
marker='x',
# the color
color='b',
# the alpha
alpha=0.7,
# width size
s = 150,
# labelled this
label='Test')


Подробнее здесь: https://stackoverflow.com/questions/386 ... matplotlib
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Python»