Python Forum
Setting Marker Edge Color In Plotting
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Setting Marker Edge Color In Plotting
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:-

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 ( 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.plot(x,y, label = "Test",linestyle="-", marker="o",color="red", linewidth=1.5)
pyplot.plot(x,y, label = "Test",linestyle="-", marker="o",color="red", linewidth=1.5, set_markeredgecolor("blue"))
pyplot.plot(x,y, label = "Test",linestyle="-", marker="o",color="red", linewidth=1.5, set_markeredgecolor="blue")
It 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.

        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

Messages In This Thread
Setting Marker Edge Color In Plotting - by JoeDainton123 - Oct-26-2020, 10:48 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How do I apply a Gaussian blur to a particular edge of geometry in Matplotlib? hbolandi 0 619 Feb-02-2020, 06:08 PM
Last Post: hbolandi
  rising edge of detection peter14 7 4,871 Dec-27-2018, 10:27 AM
Last Post: peter14
  Randomise network while maintaining topology of nodes using edge-swap approach Tom1988 3 2,470 May-25-2017, 10:59 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020