matplotlib axes set color code example

Example 1: matplotlib color

Alias	Color
'b'	    blue
'g'	    green
'r'	    red
'c'	    cyan
'm'	    magenta
'y'	    yellow
'k'	    black
'w'	    white

Example 2: how to change the colour of axes in matplotlin

import matplotlib.pyplot as plt
with plt.rc_context({'axes.edgecolor':'orange', 'xtick.color':'red', 'ytick.color':'green', 'figure.facecolor':'white'}):
    # Temporary rc parameters in effect
    fig, (ax1, ax2) = plt.subplots(1,2)
    ax1.plot(range(10))
    ax2.plot(range(10))
# Back to default rc parameters
fig, ax = plt.subplots()
ax.plot(range(10))

Tags:

C Example