smaller dots in scatter plot in python

To make the dots smaller in a scatter plot in Python, you can adjust the size of the marker using the s parameter in the scatter() method of matplotlib.

Here's an example:

main.py
import matplotlib.pyplot as plt

# Sample data
x = [1, 2, 3, 4, 5]
y = [1, 4, 9, 16, 25]

# Plotting scatter plot with smaller dots
plt.scatter(x, y, s=10)  # Adjust the value of "s" to make the dots smaller or larger

# Display the plot
plt.show()
249 chars
12 lines

In this example, the s parameter is set to 10, which makes the dots smaller. You can adjust the value of s to make the dots smaller or larger according to your need.

Remember to import the matplotlib.pyplot module at the beginning of your code in order to use the scatter plot functionality.

gistlibby LogSnag