我想用PyX
python中的包制作密度图。
我使用代码
from pyx import *
import numpy
import math
from pyx.graph import axis
g = graph.graphxy(height=8, width=8,
x=graph.axis.linear(min=0.0, max=2.0, title=r"$x-axis$"),
y=graph.axis.linear(min=0.0, max=2.0, title=r'$y-axis$'))
g.plot(graph.data.file("datatotest.dat", xmin=1, xmax=2, ymin=3, ymax=4, color=5, title=r"$bar$"),
[graph.style.rect(gradient=color.gradient.Gray)]
)
g.writePDFfile()
我使用数据
0 1 0 1 0.12
0 1 1 2 0.56
1 2 0 1 0.98
1 2 1 2 0.23
我得到了结果
我想要更多有趣的颜色。
但是使用color.gradient.Rainbow
给出了错误消息:
“颜色空间字符串不适用于 hsb 颜色”
.
color.gradient.Hue.
例如,我在使用 Reverse 时遇到类似的错误。
问题:除了灰色之外,还有什么其他颜色渐变在这里起作用?