Solved Project 0: Basic plotting in Python with matplotlib.pyplot

$30.00

Original Work ?
Category: Tags: , , You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (1 vote)

Data File

The first line of IrisData.txt contains two integers. The first represents how many lines of data
are in the file. The second how many features are associated with each line. Each line after that
contains four floating point values representing the sepal length, sepal width, petal length, and
petal width of a type of iris flower, followed by the name of the iris type: either setosa,
versicolor, or virginica. Values are tab separated.

Python Program
Write a Python program that will print out a two-dimensional plot of any two features for all
three varieties of iris flowers in the plot area of Spyder using the features of matplotlib.pyplot.
Your program should begin by asking for the name of the input file. For example (blue is user
response):

Enter the name of your data file: Irisdata.txt
Then the program should prompt the user for two features to plot. For example, it could say:
You can do a plot of any two features of the Iris Data set

The feature codes are:
0 = sepal length
1 = sepal width
2 = petal length
3 = petal width
Enter feature code for the horizontal axis: 0
Enter feature code for the vertical axis: 1

Once the program does a plot it should ask the user if they want to another plot. For example:
Would you like to do another plot? (y/n) y

If the answer is y, then the user should be prompted for new features to plot on the horizontal
and vertical axes as before and a new plot generated. N should end the program.

Plots should be labelled with a title, axes should be labelled, there should be a legend and all
three varieties should be color coded and have different symbols. An example is shown below.
Your Python program should be named yourlastname_yourfirstname_P0.py, then zipped and
uploaded to Canvas.