Вы можете попробовать использовать CairoPlot:
import CairoPlot
#the data list stands for your low-to-high (1) and high-to-low (0) data
data = lambda x : [0,0,1,1,0,0,1][x]
CairoPlot.function_plot( 'Up_and_Down', data, 500, 300, discrete = True, x_bounds=( 0,len(data) - 1 ), step = 1 )
Для получения дополнительной информации, проверьте CairoPlot
Edit:
Я не понял вашу функцию fn (t) здесь. Идея function_plot состоит в том, чтобы построить функцию, а не вектор.
Чтобы построить эти точки, вы можете использовать function_plot следующим образом:
#notice I have split your data into two different vectors,
#one for x axis and the other one for y axis
x_data = [10, 11, 12.5, 15]
y_data = [0, 1, 0, 1]
def get_data( i ):
if i in x_data :
return y_data[x_data.index(i)]
else :
return 0
CairoPlot.function_plot( 'Up_and_Down', get_data, 500, 300, discrete = True, x_bounds=( 0,20 ), step = 0.5 )
Я думаю, это будет работать
Для 100% -ного закрепления ЦПУ это не должно произойти ... Я посмотрю на это позже сегодня. Спасибо за указание
\ O_