ollydbg23
ollydbg23

Reputation: 1230

matplotlib, why custom marker style is not allowed in scatter functions

I have such code

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.markers as mks


plt.close('all')
N = 50
x = np.random.rand(N)
y = np.random.rand(N)
colors = np.random.rand(N)
area = np.pi * (15 * np.random.rand(N))**2 # 0 to 15 point radiuses
mymkstyle = mks.MarkerStyle(marker=u'o', fillstyle=u'full')
plt.scatter(x, y,color = 'k',s = 100, marker = mymkstyle )
plt.show()

I try to create some custom MarkerStyle and use it for scatter functions, but this script failed in the scatter function.

Any ideas? Thanks. I'm using python 2.7.6 and mathplotlib 1.3.1 under WinXP.

Upvotes: 3

Views: 1572

Answers (1)

Alex Szatmary
Alex Szatmary

Reputation: 3571

Although the documentation states that MarkerStyle is the type to pass for marker=, this doesn't seem to be implemented correctly. This bug has been reported on GitHub.

plt.plot(x, y, marker='o', markersize=100, fillstyle='bottom')

seems to do pretty much what you're looking for; of course, this doesn't let you treat marker styles as objects.

Upvotes: 2

Related Questions