INFORMATICS PRACTICES
DATA VISUALIZATION
1. What is data visualization?
Answer: It is the graphical representation of information and data.
2. Which is a python package used for 2D graphics?
Answer: [Link]
3. The command used to give a heading to a graph is _________
Answer: [Link]()
4. Using Python Matplotlib _________ can be used to count how many values fall into each interval.
Answer: histogram
5. Fill the missing statement:
import [Link] as plt
marks=[30,10,55,70,50,25,75,49,28,81]
plt._____(marks, bins=auto, color=green)
[Link]()
Answer: hist
6. Which module of matplotlib library is required for plotting of graph?
Answer: pyplot
7. A histogram is used:
Answer: for continuous data
8. Identify the right type of chart using the hints:
Hint 1: Used to visualize trends over time
Hint 2: Line is drawn chronologically
Answer: Line chart
9. Which of the following is/are correct statement for plot method?
Answer: [Link](x,y,color,others)
10. To give a title to x-axis, which of the following method is used?
Answer: [Link](title)
11. To change the width of bars in bar chart, which of the following argument with a float value is
used?
Answer: width
12. What is the purpose of legend?
Answer: A legend is an area describing the elements of the graph.
13. Which function can be used to export generated graph in matplotlib to png
Answer: savefig()
14. Which one of these is not a valid line style in matplotlib
Answer: '<'
15. How can we make bar chart horizontal?
Answer: [Link]()
Q16. Write Python code to plot a bar chart for Indias medal tally.
Also give suitable python statement to save this chart.
import [Link] as plt
countries = ['India', 'USA', 'UK', 'China']
medals = [15, 35, 10, 42]
[Link](countries, medals, color='green')
[Link]("Medal Tally")
[Link]("Countries")
[Link]("No. of Medals")
[Link]("[Link]")
[Link]()
Q17. Write a python program to plot a line chart showing weekly average temperature in
Delhi.
import [Link] as plt
week = [1, 2, 3, 4]
avg_temp = [40, 42, 38, 44]
[Link](week, avg_temp, marker='o')
[Link]("Weekly Avg Temperature in Delhi")
[Link]("Week")
[Link]("Temperature (C")
[Link]()
Q18. Consider the following graph. Write the code to plot it.
import [Link] as plt
x = ['Math', 'Science', 'English', 'History']
y = [80, 70, 75, 65]
[Link](x, y, color='orange')
[Link]("Sample Subject Scores")
[Link]()
Q20. Draw a bar graph of the given data of number of students and pass percentage in 7
different classes.
import [Link] as plt
classes = ['6th','7th','8th','9th','10th','11th','12th']
students = [130,120,135,130,150,80,75]
pass_percent = [70,80,76,89,90,95,100]
x = range(len(classes))
[Link](x, students, width=0.4, label='Students')
[Link]([i+0.4 for i in x], pass_percent, width=0.4, label='Pass %')
[Link]([i+0.2 for i in x], classes)
[Link]()
[Link]()