The document contains Python code examples for creating various visualizations using the Matplotlib library. It includes instructions for plotting car prices for different brands in 2022 and 2023, as well as a pie chart showing the distribution of land and water on Earth. Each example is accompanied by the necessary code to generate the specified graphs.
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 ratings0% found this document useful (0 votes)
3 views4 pages
Data Visualization in Python
The document contains Python code examples for creating various visualizations using the Matplotlib library. It includes instructions for plotting car prices for different brands in 2022 and 2023, as well as a pie chart showing the distribution of land and water on Earth. Each example is accompanied by the necessary code to generate the specified graphs.
plt.xlabel('Company') plt.ylabel('Price') plt.title('The Price Report in 2022 and 2023') plt.legend() plt.show() Visualization _Questions
3. Write a python program to display the graph as show:
Answer:
import matplotlib.pyplot as plt
labels=['water','land'] values=[70,30] color=["blue","yellow"] plt.pie(values,labels=labels,colors=color,autopct= "%.1f%%") plt.title("The distribution of land and water on Earth") plt.legend() plt.show()