Installation
pip install c3pyo
Plot charts using simple syntax directly in your web browser or through integration into your web applications. Check out some examples below and use the menu to see more examples.
Simple Line Chart
x = [1, 2, 3, 4, 5, 6, 7]
y1 = [150, 450, 200, 100, 300, 0, 325]
y2 = [230, 220, 150, 400, 105, 50, 302]
import c3pyo as c3
chart = c3.LineChart()
chart.plot(x, y1, label='Series 1')
chart.plot(x, y2, label='Series 2')
chart.show()
Simple Bar Chart
men_height = [175, 176, 172, 172, 177]
women_height = [156, 162, 158, 160, 164]
countries = ['UK', 'USA', 'Japan', 'China', 'Russia']
import c3pyo as c3
chart = c3.BarChart()
chart.plot(men_height, label='Men_Heights')
chart.plot(women_height, label='Women_Heights')
chart.set_xticklabels(countries)
chart.ylabel('Height (cm)')
chart.show()
Simple Pie Chart
import c3pyo as c3
chart = c3.PieChart()
chart.plot(45000, label='Google')
chart.plot(30000, label='Social Media')
chart.plot(25000, label='Referral')
chart.plot(10000, label='Email Marketing')
chart.show()
Simple Scatter Chart
import numpy as np
x = np.random.randint(50, size=1000)
y = np.random.randint(50, size=1000)
y2 = np.random.randint(100, size=1000)
import c3pyo as c3
chart = c3.ScatterChart()
chart.plot(x, y, label='Series 1')
chart.plot(x, y2, label='Series 2')
chart.show()