Mamed
Mamed

Reputation: 772

Add edge to matplotlib plot and give a edgecolor (no scatter)

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
df = pd.DataFrame(np.random.randint(0,100,size=(5, 2)), columns=list('AB'))


plt.plot(df.A,df.B,color='black',marker='o',linestyle='', markersize=5)

Insted of putting black dots, I want to put white dots with black circle/edge and adjust edge size

Upvotes: 3

Views: 9819

Answers (1)

compuphys
compuphys

Reputation: 1377

Just add markerfacecolor='white' to your keyword arguments:

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
df = pd.DataFrame(np.random.randint(0,100,size=(5, 2)), columns=list('AB'))


plt.plot(df.A,df.B,color='black',marker='o',markerfacecolor='white',linestyle='',markersize=5)
# or use mfc='white' instead

From the documentation:

kwargsLine2D properties, optional kwargs are used to specify properties like a line label (for auto legends), linewidth, antialiasing, marker face color.

markerfacecolor or mfc        color

where color is one of these colors.

Upvotes: 1

Related Questions