- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to set the border color of the dots in matplotlib's scatterplots?
To set the border color of the dots in matplotlib scatterplots, we can take the following steps −
- Set the figure size and adjust the padding between and around the subplots.
- Initialize a variable "N" to store the number of sample data.
- Create x and y data points using numpy.
- Plot the x and y data points using scatter() method. To set the border color of the dots, use the edgecolors parameter in the scatter() method. Here, we have used "red" as the border color of the dots by using edgecolors='red'.
- To display the figure, use show() method.
Example
import numpy as np from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True N = 10 x = np.random.rand(N) y = np.random.rand(N) plt.scatter(x, y, s=500, c=np.random.rand(N), edgecolors='red', linewidth=3) plt.show()
Output
It will produce the following output
- Related Articles
- How to set the color of the bottom border in JavaScript DOM?
- How to set the border color of certain Tkinter widgets?
- How to set the color of the top border with JavaScript?
- How to set the color of the right border with JavaScript?
- How to set the color of the left border with JavaScript?
- Set the color of the border with CSS
- How to set the color of an elements border with JavaScript?
- Set the color of the right border using CSS
- How to set border color for SoftBevelBorder in Java?
- Using Colormaps to set the color of line in Matplotlib
- How to set border width, border style, and border color in one declaration with JavaScript?
- How to set the background color of a column in a matplotlib table?
- How to set raised and lowered SoftBevelBorder for components in Java. Also set the border color.
- How to set the width of an element's border with JavaScript?
- How to set the style of an element's border with JavaScript?

Advertisements