2
我試過(並失敗!),以得到pyx
在矩形上畫一個透明的圓。pyx模塊:如何使顏色透明
手冊中有關於transparency
的條目,但我無法弄清楚如何使用它。 matplotlib
會使用alpha
- 但我在pyx
文檔中找不到這樣的條目。
在我的例子中,我嘗試在一個實心的矩形上繪製一個藍色透明的Cicle。這裏有人知道該怎麼做嗎?
from pyx import canvas, path, color
from pathlib import Path
HERE = Path(__file__).parent
out_path = HERE/'pyx_test'
c = canvas.canvas()
c.fill(path.rect(-5, -5, 10, 10), [color.rgb.red])
# color.transparency(value) ...?
c.fill(path.circle(0, 0, 6), [color.rgb.blue])
c.writePDFfile(str(out_path))
print('wrote "{}"'.format(out_path))
哼。看起來很簡單!應該能夠自己想出這個!砸了很多! –