2014-06-27 27 views
0

我想创建一个饼图来在现有的构建器脚本中使用,我不知道如何去做。 (其实际上要实施一个速度计)我如何在PsychoPy Builder中绘制饼图

有没有人有任何建议?

我知道我需要深入一些python代码。

Google Groups https://groups.google.com/forum/#!topic/psychopy-users/JcnS7ZtuVlM中的这个旧帖子给出了一些利用pylab的示例代码,但是当它们被放到Builder中时,它们无法使其工作。

感谢,

回答

2

我已经计算出如何做到这一点,现在所以这里是我的备案方法。

# create 1st sector - use the **ori** parameter to control what bearing it 
# starts on (0 is vertical) 
rad1 = visual.RadialStim(win=win, name='rad1', color=[1,-1,-1], 
    angularCycles = 0, radialCycles = 0, radialPhase = 0.5, colorSpace = 'rgb', 
    ori= -90.0, pos=(0.5, -0.3), size=(0.3,0.3), visibleWedge=(0.0, 135.0)) 
rad1.draw() 

#now draw another sector next to it by using **ori** again to line them up 
rad2 = visual.RadialStim(win=win, name='rad1', color=[-1,1,-1], 
    angularCycles = 0, radialCycles = 0, radialPhase = 0.5, colorSpace = 'rgb', 
    ori= 45.0, pos=(0.5, -0.3), size=(0.3,0.3), visibleWedge=(0.0, 45.0)) 
rad2.draw() 

这工作正常生成器,它拖放到一个代码段,并知道Builder使用一个称为win

注意,这里使用的默认模式尺寸(-1到1)窗口,它会在不同的屏幕尺寸上看起来不同如果您希望它是圆形的,您可能需要更改为cm(并校准显示器)。

感谢乔恩P代表他的建议(通过谷歌组)使用RadialStim)