Answers for ".plot.scatter"

2

plot matplotlib scatter

import numpy as np
import matplotlib.pyplot as plt

# Fixing random state for reproducibility
np.random.seed(19680801)


N = 50
x = np.random.rand(N)
y = np.random.rand(N)
colors = np.random.rand(N)
area = (30 * np.random.rand(N))**2  # 0 to 15 point radii

plt.scatter(x, y, s=area, c=colors, alpha=0.5)
plt.show()
Posted by: Guest on April-21-2022
0

scatter plot

# Convert cyl column from a numeric to a factor variable
mtcars$cyl <- as.factor(mtcars$cyl)
head(mtcars)
Posted by: Guest on November-21-2021

Python Answers by Framework

Browse Popular Code Answers by Language