Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matplotlib: how to plot with a specific hex color and a specific marker?

I need to produce a plot in which a line is plotted in Pigment Blue (hex= #333399) and with the o marker.

I know I can plot the line in Blue with the o marker by just calling:

line1 = ax1.plot(x, myvalues,'bo-', label='My Blue values')

Question: how should the line be changed if I wanted to still keep the marker and change the color from b to #333399?

like image 402
FaCoffee Avatar asked Nov 13 '15 14:11

FaCoffee


1 Answers

You can change lots of things if you use the kwargs to plot (which get passed to Line2D) instead of the shorthand 'bo-'. For example:

line1 = ax1.plot(
          x, myvalues,
          marker = 'o',
          linestyle = '-',
          markerfacecolor='#333399',
          markeredgecolor='k',
          label='My Blue values')
like image 75
tmdavison Avatar answered Sep 19 '22 15:09

tmdavison