Hello all
I was hoping someone could help me fill in my gaps in my understanding regarding Python Plotting via matplotlib and the Python documentation.
I am plotting some x&y data and customizing the plot using the key word arguments, the code i am using is:-
I was hoping someone could help me fill in my gaps in my understanding regarding Python Plotting via matplotlib and the Python documentation.
I am plotting some x&y data and customizing the plot using the key word arguments, the code i am using is:-
pyplot.plot(x,y, label = "Test",linestyle="-", marker="o",color="red", linewidth=1.5)I wanted to change the edge color of the marker so i went to the matplotlib documentation (https://matplotlib.org/api/_as_gen/matpl...set_marker) and found the following function:-
set_markeredgecolor(self, ec)I am trying to understand how I would incorporate this code, i have tried several different options:-
pyplot.set_markeredgecolor("blue")
pyplot.plot(x,y, label = "Test",linestyle="-", marker="o",color="red", linewidth=1.5)
#THIS GIVE ME AN ERRORpyplot.plot(x,y, label = "Test",linestyle="-", marker="o",color="red", linewidth=1.5, set_markeredgecolor("blue"))
#THIS GIVE ME AN ERRORpyplot.plot(x,y, label = "Test",linestyle="-", marker="o",color="red", linewidth=1.5, set_markeredgecolor="blue") #THIS GIVE ME AN ERRORIt is only when I remove the letters "set_" & brackets from the name of the function that it works i.e.:-
set_markeredgecolor("blue") to markeredgecolor = "blue" So the code that I use to change the marker edge color is:-pyplot.plot(x,y, label = "Test",linestyle="-", marker="o",color="red", linewidth=1.5, markeredgecolor = "blue")My question is why does this work because the source code for this function (shown below) states that the name of the function is set_markeredgecolor NOT markeredgecolor - i thought that in order to call a function you have to call it by the name it was defined as?
def set_markeredgecolor(self, ec):
"""
Set the marker edge color.
Parameters
----------
ec : color
"""
if ec is None:
ec = 'auto'
if (self._markeredgecolor is None
or np.any(self._markeredgecolor != ec)):
self.stale = True
self._markeredgecolor = ec
