Skip to content

matplotlib.pyplot.plot() named parameter c sometimes ignored (but color seems to always work) #4386

@tlvb

Description

@tlvb

Description

The documentation for matplotlib.pyplot.plot() (http://matplotlib.org/api/pyplot_api.html?highlight=plot#module-matplotlib.pyplot) states that either c=... or color=... can be used to specify line color in a plot command. For brevity's sake when autogenerating a lot of plot code I have used c without trouble, but today (120427) I have started getting inconstent results, where the color specification is sometimes—but not always—ignored if c=... is used. It does not seem to depend on wether the color is specified as a color name, hex string, or an rgb or rgba tuple.
I can't remember having this problem previously, yet when rerunning some old generated plots the error now shows up there as well (which is not surprising, as the plot generation code is still the same).

Example

import numpy as np
import matplotlib.pyplot as p
p.figure()
x =  np.array([0,1])
y0 = np.array([0,1])
y1 = np.array([1,0])
p.plot(x,y0,c='red') # sometimes plots blue
p.plot(x,y1,color='red') # always plots red
p.show()

Environment information

uname -a:
Linux blackbird 3.19.2-1-ARCH #1 SMP PREEMPT Wed Mar 18 16:36:01 CET 2015 i686 GNU/Linux
pacman -Qi python-matplotlib (excerpt):
Version : 1.4.3-2
Build Date : Sat Mar 28 15:34:07 2015
pacman -Qi python (excerpt):
Version : 3.4.3-2
Build Date : Thu Mar 26 08:52:32 2015

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions