您可以通过直接更改site-packages/matplotlib/pyplot.py中的代码来做到这一点:
# This function was autogenerated by boilerplate.py. Do not edit as
# changes will be lost
@_autogen_docstring(Axes.scatter)
def scatter(x, y, s=20, c=None, marker='+', cmap=None, norm=None, vmin=None,
vmax=None, alpha=None, linewidths=None, verts=None, edgecolors=None,
hold=None, data=None, **kwargs):
ax = gca()
# allow callers to override the hold state by passing hold=True|False
washold = ax.ishold()
请注意评论中的警告,因为我不确定何时调用boilerplate.py。(您只需要尝试一下即可)但是在实际更改源之前,请考虑重叠@ 987654324@您自己的电话:
import matplotlib.pyplot as plt
import numpy as np
class scatter():
def __init__(self,x,y):
self.marker = '+'
plt.scatter(x,y,marker=self.marker)
x,y = np.random.randint(0,100,30),np.random.randint(0,100,30)
scatter(x,y)
plt.show()