당신은 그 파이썬 PIL을 사용해야 할 수도 있습니다 : 여기
http://effbot.org/imagingbook/pil-index.htm 당신이 PIL를 설치 한 후에는, 시작 할 수있는 간단한 예입니다 : 물론
import Image, ImageDraw
import math
# Create image, giving size and background color
im = Image.new("RGB", (400,400), (0, 128, 128))
# You will do your drawing in the image through the 'draw' object
draw = ImageDraw.Draw(im)
def f(x):
return math.sin(3*x)
# One loop alongside the line
for i in xrange(400):
# and another if you need a different width
for j in xrange(196, 204):
# Calculate an x-value in the range 0-1. This is a hack
# you might need something more general.
x = i/400.0
c = f(x)
# And calculate the colors from there
red = int(256*(1.0-c))
blue = 256 - red
im.putpixel((i, j), (red, 0, blue))
im.save("test.png", "PNG")
, 나는 않을 것 성능이 필요한 모든 것에 대해 위의 방법을 권장하지만, 서둘러 퇴장하는 데 충분할 수 있습니다.
질문을 구체화하십시오 - 특정 플로팅 라이브러리를 염두에두고 값에 따라 색을 설정하는 것과 파이썬으로 플로팅하는 일반적인 질문이 있습니까? – alonisser