Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change stroke color in pygal?

How to set one to red and second to blue?

import pygal

chart = pygal.Line()

chart.x_labels = range(5)
chart.add('one', [1, None, 3, None, 5])
chart.add('two', range(5))

chart.render_to_png(__file__ + '-linear.png')
like image 506
Chameleon Avatar asked Dec 31 '25 06:12

Chameleon


1 Answers

You can use Pygal's Custom Styles to define specific colors for the series that you are loading. The only drawback is that the colors are assigned based on series order, so in your case you should set the colors parameter to ('red','blue') so that they match your serie order.

like image 125
lesingerouge Avatar answered Jan 01 '26 21:01

lesingerouge