def init_xyplot(fd_fff): xx = [0.0] * 20 #float xx[ 20 ], yy = [0.0] * 20 #yy[ 20 ]; #for ( i = 0; i <= 10; i++ ) for i in range(0, 10+1): xx[i] = float(i) yy[i] = math.exp( - (xx[i] - 5) * (xx[i] - 5) / 8) xfl.fl_set_xyplot_data(fd_fff.xyplot, xx, yy, 8, "Plot Title", \ "X-Axis", "Y|Axis") xfl.fl_set_xyplot_ybounds(fd_fff.xyplot, 0, 1.1) xfl.fl_set_xyplot_xbounds(fd_fff.xyplot, 0, 10) xfl.fl_add_xyplot_overlay(fd_fff.xyplot, 1, xx, yy, 11, xfl.FL_YELLOW) xfl.fl_set_xyplot_overlay_type(fd_fff.xyplot, 1, xfl.FL_LINEPOINTS_XYPLOT) xfl.fl_set_xyplot_interpolate(fd_fff.xyplot, 1, 2, 0.1) xfl.fl_add_xyplot_text(fd_fff.xyplot, 0.5, 1.0, "Gaussian\nDistribution", \ xfl.FL_ALIGN_RIGHT, xfl.FL_WHITE) xfl.fl_set_xyplot_key(fd_fff.xyplot, 0, "Original") xfl.fl_set_xyplot_key(fd_fff.xyplot, 1, "Overlay") xfl.fl_set_xyplot_key_position(fd_fff.xyplot, 9.8, 1.08, \ xfl.FL_ALIGN_LEFT_BOTTOM)
def main(lsysargv, sysargv): global xypui x = [0.0] * 11 y = [0.0] * 11 xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0) xypui = create_form_axypform() # Fill-in form initialization code xfl.fl_set_xyplot_ybounds(xypui.xyplot, 1.0, 10.0) for i in range(0, 11): x[i] = y[i] = float(i) + 1 xfl.fl_add_xyplot_overlay(xypui.xyplot, 1, x, y, 10, xfl.FL_YELLOW) xfl.fl_set_xyplot_overlay_type(xypui.xyplot, 1, xfl.FL_LINEPOINTS_XYPLOT) xfl.fl_set_xyplot_interpolate(xypui.xyplot, 1, 2, 0.1) #srand( time( NULL ) ); random.seed(None) RAND_MAX = xfl.INT_MAX for i in range(0, 10): y[i] += float(random.random() / RAND_MAX - 0.5) xfl.fl_set_xyplot_data(xypui.xyplot, x, y, 11, \ "Active (log) xyplot with overlay", "x-axis", "y-axis") xfl.fl_set_xyplot_linewidth(xypui.xyplot, 0, 2) xfl.fl_set_xyplot_xgrid(xypui.xyplot, xfl.FL_GRID_MINOR) # Show the first form xfl.fl_show_form(xypui.axypform, xfl.FL_PLACE_MOUSE | xfl.FL_FREE_SIZE, xfl.FL_FULLBORDER, "xyplotactivelog") xfl.fl_do_forms() return 0
def interpolate_cb(pobj, data): if xfl.fl_get_button(pobj): value = 3 else: value = 0 xfl.fl_set_xyplot_interpolate(xypui.xyplot, 0, value, 0.2)