Was ist die Notwendigkeit von plt.figure() in matplotlib?

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Was ist die Notwendigkeit von plt.figure() in matplotlib?

by Guest » 25 Jan 2025, 16:48

Code: Select all

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')
In dem obigen Snippet von Code, der in Matplotlib aus ScatterPlot gesammelt wird, wie ist die Notwendigkeit von pt.Figure () ? Strong> Link über AIS TOT, SELBST STRAGSBEISE:

Code: Select all

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')

Top