0% found this document useful (0 votes)
208 views15 pages

Matplotlib Exercises

The document outlines 15 tasks to write Python programs that draw line charts with different customizations: label axes and title, use given axis values from text files, plot financial data between dates with legends, styles, markers, set axis limits, plot quantities with positions, multiple formats in one command, multiple chart types on one axes, customize grid lines, render major and minor grids without ticks, and create multiple plots.

Uploaded by

Shashank Dwivedi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
208 views15 pages

Matplotlib Exercises

The document outlines 15 tasks to write Python programs that draw line charts with different customizations: label axes and title, use given axis values from text files, plot financial data between dates with legends, styles, markers, set axis limits, plot quantities with positions, multiple formats in one command, multiple chart types on one axes, customize grid lines, render major and minor grids without ticks, and create multiple plots.

Uploaded by

Shashank Dwivedi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

1.

Write a Python program to draw a line with suitable label


in the x axis, y axis and a title.
2. Write a Python program to draw a line using given axis
values with suitable label in the x axis , y axis and a title.
3. Write a Python program to draw a line using given axis
values taken from a text file, with suitable label in the x
axis, y axis and a title.

Test Data:
12
24
31
4. Write a Python program to draw line charts of the
financial data of Alphabet Inc. between October 3, 2016 to
October 7, 2016.

Sample Financial data (fdata.csv):


Date,Open,High,Low,Close
10-03-16,774.25,776.065002,769.5,772.559998
10-04-16,776.030029,778.710022,772.890015,776.429993
10-05-16,779.309998,782.070007,775.650024,776.469971
10-06-16,779,780.47998,775.539978,776.859985
10-07-16,779.659973,779.659973,770.75,775.080017
5. Write a Python program to plot two or more lines on same plot
with suitable legends of each line.

6. Write a Python program to plot two or more lines with legends,


different widths and colors.
7. Write a Python program to plot two or more lines with different
styles.
8. Write a Python program to plot two or more lines and set the
line markers.
9. Write a Python program to display the current axis limits values
and set new axis values.
10. Write a Python program to plot quantities which have an x and
y position.
11. Write a Python program to plot several lines with different
format styles in one command using arrays.
12. Write a Python program to create multiple types of charts (a
simple curve and plot some quantities) on a single set of axes.
13. Write a Python program to display the grid and draw line
charts of the closing value of Alphabet Inc. between October 3,
2016 to October 7, 2016. Customized the grid lines with linestyle -
, width .5. and color blue.

Date,Close
03-10-16,772.559998
04-10-16,776.429993
05-10-16,776.469971
06-10-16,776.859985
07-10-16,775.080017

14. Write a Python program to display the grid and draw line
charts of the closing value of Alphabet Inc. between October 3,
2016 to October 7, 2016. Customized the grid lines with rendering
with a larger grid (major grid) and a smaller grid (minor grid).Turn
on the grid but turn off ticks.
15. Write a Python program to create multiple plots.

You might also like