69 lines
2.7 KiB
Plaintext
69 lines
2.7 KiB
Plaintext
Programming Challenges - Increasing Difficulty
|
|
|
|
Task 1: Basic Plotting
|
|
Create a Python script that plots a simple quadratic function y = x^2 for x values from -5 to 5.
|
|
Requirements:
|
|
- Use NumPy to generate the x values (at least 100 points)
|
|
- Calculate corresponding y values
|
|
- Plot the function using Matplotlib
|
|
- Add appropriate labels and title
|
|
|
|
Task 2: Multiple Functions
|
|
Extend your script to plot two functions on the same graph:
|
|
- y1 = sin(x)
|
|
- y2 = cos(x)
|
|
Requirements:
|
|
- Plot both functions for x values from 0 to 4π
|
|
- Use different colors for each function
|
|
- Add a legend to distinguish the functions
|
|
- Include axis labels and a title
|
|
|
|
Task 3: Parametric Plotting
|
|
Create a script that plots a parametric curve (e.g., a spiral or Lissajous figure).
|
|
Requirements:
|
|
- Use parametric equations to generate x and y coordinates
|
|
- Plot the curve with appropriate styling
|
|
- Add labels, title, and grid
|
|
- Experiment with different parameter ranges
|
|
|
|
Task 4: Data Visualization
|
|
Create a script that visualizes a dataset (you can generate synthetic data or use built-in datasets).
|
|
Requirements:
|
|
- Create at least 2 different types of plots (e.g., line plot, scatter plot, bar chart)
|
|
- Include proper labels, titles, and legends
|
|
- Use color effectively to enhance understanding
|
|
- Add annotations or special markers for important data points
|
|
|
|
Task 5: Interactive Plotting
|
|
Create an interactive plot where users can modify parameters and see the results in real-time.
|
|
Requirements:
|
|
- Use matplotlib widgets or another interactive library
|
|
- Allow users to change at least 2 parameters of a function
|
|
- Update the plot dynamically as parameters change
|
|
- Include clear instructions for the user
|
|
|
|
Task 6: Advanced Visualization
|
|
Create a comprehensive visualization that combines multiple plot types in subplots.
|
|
Requirements:
|
|
- Create at least 3 subplots with different types of visualizations
|
|
- Share axes where appropriate
|
|
- Use consistent styling across all subplots
|
|
- Include a main title for the entire figure
|
|
- Save the figure to a file with high resolution
|
|
|
|
Task 7: Object-Oriented Plotting
|
|
Refactor one of your previous scripts to use object-oriented Matplotlib approach.
|
|
Requirements:
|
|
- Use Figure and Axes objects explicitly
|
|
- Create reusable plotting functions or classes
|
|
- Implement proper error handling
|
|
- Document your code with comments or docstrings
|
|
|
|
Task 8: Custom Visualization
|
|
Create a unique visualization of your choice that demonstrates advanced Matplotlib features.
|
|
Requirements:
|
|
- Use advanced features like custom colormaps, 3D plotting, or animations
|
|
- Include data analysis or transformation
|
|
- Make the visualization informative and visually appealing
|
|
- Provide a clear explanation of what the visualization shows
|