Example #1
0
def Plot(fx, x_l, x_u, color_name, canvas):
    plu.plot(fx, int(x_l), int(x_u), 1.0, color_name, True)

    gif1 = ImageTk.PhotoImage(
        image=Image.open(".temp/generated_plot.png").resize((
            400, 300), Image.ANTIALIAS))
    canvas.create_image(5, 10, image=gif1, anchor=NW)
    canvas.gif1 = gif1

    sys.stdout.flush()
Example #2
0
def Plot(fx, xpoints, color_name, theme, canvas):

    global plotted
    if fx:
        plu.plot(fx, xpoints, color_name, 'X-axis', 'Y-axis', theme, True)
        image = Image.open(".temp/generated_plot.png").resize(
            (canvas.winfo_width(), canvas.winfo_height()))
        gif1 = ImageTk.PhotoImage(image, Image.ANTIALIAS)
        canvas.create_image(0, 0, image=gif1, anchor=NW)
        canvas.gif1 = gif1
        plotted = True
    else:
        canvas.delete(ALL)

    sys.stdout.flush()
Example #3
0
        xpoints = list(map(float, options.xpoints[1:-1].split(',')))
        discrete = True
    else:
        if options.xstart:
            xstart = int(options.xstart)
        else:
            xstart = 0

        if options.xend:
            xend = int(options.xend)
        else:
            xend = 100

        if options.stepsize:
            stepsize = int(options.stepsize)
        else:
            stepsize = 1

        xpoints = range(xstart, xend + 1, stepsize)
        discrete = False

    plu.plot(func, xpoints, color, xlabel, ylabel, theme, False, line_style,
             file_path, discrete)

else:  # No function, hence try to take points for line
    xypoints = options.line
    plu.plot_line(xypoints, color, xlabel, ylabel, theme, False, line_style,
                  file_paths)

# Visualise using matplotlib
Example #4
0
parser.add_option('-e', '--xend', dest='xend', help='Enter ending x-value')
parser.add_option('-z', '--stepsize', dest='stepsize', help='Enter step size')
parser.add_option('-c',
                  '--color',
                  dest='color',
                  help='Enter the color for plot')

(options, args) = parser.parse_args()

if not options.func:
    print 'Please enter a function to visualise'
    exit(0)

func = options.func

if options.xstart:
    xstart = int(options.xstart)

if options.xend:
    xend = int(options.xend)

if options.stepsize:
    stepsize = int(options.stepsize)

if options.color:
    color = str(options.color)

# visualise using matplotlib

plu.plot(func, xstart, xend, stepsize, color, False)
Example #5
0
                  help='Enter the y-label for plot')

(options, args) = parser.parse_args()

if not options.func:
    print 'Please enter a function to visualise'
    exit(0)

func = options.func

if options.xstart:
    xstart = int(options.xstart)

if options.xend:
    xend = int(options.xend)

if options.stepsize:
    stepsize = int(options.stepsize)

if options.color:
    color = str(options.color)

if options.xlabel:
    xlabel = str(options.xlabel)

if options.ylabel:
    ylabel = str(options.ylabel)
# visualise using matplotlib

plu.plot(func, xstart, xend, stepsize, color, xlabel, ylabel, False)
Example #6
0
                     with the option xpoints")
    elif options.xpoints:
        xpoints = list(map(float, options.xpoints[1:-1].split(',')))
        discrete = True
    else:
        if options.xstart:
            xstart = int(options.xstart)
        else:
            xstart = 0

        if options.xend:
            xend = int(options.xend)
        else:
            xend = 100

        if options.stepsize:
            stepsize = int(options.stepsize)
        else:
            stepsize = 1

        xpoints = range(xstart, xend + 1, stepsize)
        discrete = False

    plu.plot(func, xpoints, color, xlabel, ylabel, theme, False, discrete)

else:  # No function, hence try to take points for line
    xypoints = options.line
    plu.plot_line(xypoints, color, xlabel, ylabel, theme, False)

# Visualise using matplotlib