Technology Networking & Internet

How to Graph With Python

    • 1). Launch PyLab by clicking on the program icon located within the program's subdirectory in your Windows Start menu or Application area in Mac OS. A command line window appears.

    • 2). Declare an array of data that you wish to graph by writing the following statement:

      data = [0, 1, 1, 2, 4, 4, 6, 7, 7, 7, 8, 9, 9]

    • 3). Create a line chart of the data using the plot function by writing the following statement and hitting "Enter." The statement is immediately executed and a window pops up, displaying the line chart.

      plot(data)

    • 4). Create a histogram graph by returning to the PyLab command line window and typing the following:

      hist(data)

    • 5). Create a pie chart using the pie function, like this:

      pie(data)

Leave a reply