Technology Programming

How to Integrate a Plotted Function in Python

    • 1). Double-click the "Matplotlib PyLab" icon to launch the plotting command line.

    • 2). Create the data you want to plot by entering the following code:

      "max_x, max_y, min_x, min_y = 11.0, 11.0*11.0, 0.0, 0.0" and press "Enter."

    • 3). Program arrays so that they plot "X" and "Y" variables by typing the following code into the command line:

      "x_arr = []

      y_arr = []"

      Press "Enter."

    • 4). Type the following code to fill the arrays with data:

      "for i in range(min_x,max_x):

      x_arr.append(float(i))

      y_arr.append(float(i*i))"

      Press "Enter." Normally, the data will be drawn from database queries.

    • 5). Type the following code to create a FigureCanvas:

      "fig = plt.figure()"

      Press "Enter."

    • 6). Place the axis in the "FigureCanvas" by typing the following code:

      "ax = fig.add_axes([0.1, 0.1, 0.8, 0.8])"

      Press "Enter." You can replace the values with 0.0 to 1.0.

    • 7). Type the following code to set the minimum and maximum values for each axis:

      "ax.set_xlabel('x data')

      ax.set_ylabel('y data')

      ax.set_xlim(min_x,max_x)

      ax.set_ylim(min_y,max_y)"

      Press "Enter."

    • 8). Plot the function by typing the following code:

      "ax.plot(x_arr,y_arr, color='red', lw=2)"

      Press "Enter."

Related posts "Technology : Programming"

Differences Between Byte Array Vs. String

Programming

Web Design Company UK/

Programming

Develop A Quality Plan With These Self Help Tips

Programming

TMediaPlayer: What track am I on?

Programming

How You Can Prove Your Expertise

Programming

Furniture Advice And Tips And Also Hardwearing. Property Searching Wonderful

Programming

Web Design Fort Lauderdale Business

Programming

Hire Web Designer and Diminish Development Expenditure

Programming

Web Masters.

Programming

Leave a Comment