def test_circles_2(): """ Another example with circles """ # The colors package contain e few utility functions for colors: import cartesius.colors as colors coordinate_system = cartesius.CoordinateSystem() from_color = (255, 0, 255) to_color = (0, 255, 0) iterations = 20 for i in range(1, iterations): x = i / 2. y = math.sin(x) center = (i / 1, math.sin(x)) color = colors.get_color_between(from_color, to_color, i / float(iterations)) coordinate_system.add( elements.Circle(center, radius=math.sqrt(x), transparency_mask=50, fill_color=color, color=(0, 0, 0))) return coordinate_system.draw(300, 200), coordinate_system.draw( 300, 200, antialiasing=True)
def data_generator(): for x in range(25): key = x / 2. value = 2 * math.sin(x / 4.) color = colors.get_color_between(bottom_collor, top_color, (value + 2) / 4.) yield charts.data(key, value, fill_color=color)
def f(): from_color = (255, 255, 0) to_color = (100, 100, 255) i = -2 while i < 6: value = 2 * math.sin(i) color = colors.get_color_between(from_color, to_color, (value + 2)/4.) yield charts.data(i, value, fill_color=color, color=(0, 0, 0)) i += .05
def f(): from_color = (255, 255, 0) to_color = (100, 100, 255) i = -2 while i < 6: value = 2 * math.sin(i) color = colors.get_color_between(from_color, to_color, (value + 2) / 4.) yield charts.data(i, value, fill_color=color, color=(0, 0, 0)) i += .05
def test_circles_2(): """ Another example with circles """ # The colors package contain e few utility functions for colors: import cartesius.colors as colors coordinate_system = cartesius.CoordinateSystem() from_color = (255, 0, 255) to_color = (0, 255, 0) iterations = 20 for i in range(1, iterations): x = i / 2. y = math.sin(x) center = (i / 1, math.sin(x)) color = colors.get_color_between(from_color, to_color, i/float(iterations)) coordinate_system.add(elements.Circle(center, radius=math.sqrt(x), transparency_mask=50, fill_color=color, color=(0, 0, 0))) return coordinate_system.draw(400, 250), coordinate_system.draw(400, 250, antialiasing=True)
def data_generator(): for x in range(25): key = x / 2. value = 2 * math.sin(x/4.) color = colors.get_color_between(bottom_collor, top_color, (value + 2) / 4.) yield charts.data(key, value, fill_color=color)