xxxxxxxxxx
import numpy as np
import matplotlib.pyplot as plt
# Generating random data for demonstration
x = np.random.randn(100)
y = np.random.randn(100)
sizes = np.random.randint(10, 100, 100) # Random marker sizes between 10 and 100
# Creating the scatter plot
plt.scatter(x, y, s=sizes)
# Customizing the plot
plt.xlabel('X')
plt.ylabel('Y')
plt.title('Scatter Plot with Custom Marker Sizes')
# Displaying the plot
plt.show()
xxxxxxxxxx
plt.scatter(x, y, s=size)
# To match with markersize, the square of the markersize should be the
# same as the scatter size: s=markersize**2