Problem 2: Filled Plot With Grid
Objective: Matplotlib Manipulation, Color, Line Style, Label, Grid, Title, Savefig Self Learning
Instructions:
Write code in numpy_fill_plot_with_grid_yourlastname.py to generate a figure similar to the example below. Use the function y = sin(4 * pi * x) * (e ** (-5 * x)), where x is an ndarray. For the value of 'e', refer to the natural constant.
Please wrap logical code blocks into function(s). Use code/line(s) to call the function(s). Use the color, xticks, yticks, grid, and add labels to x/y. Also, add a title exactly as shown in the example. Make sure the grid does not show on the filled red area.
Hint: Use plt.fill(x, y, zorder=something.....). Use matplotlib to save the figure to a PDF file called numpy_fill_plot_with_grid_yourlastname.pdf.
Hints: plt.plot, plt.xlabel, plt.ylabel, plt.xticks, plt.yticks, plt.title, plt.grid, plot.fill, plt.savefig, np.arange, np.linspace, np.pi, np.exp
Submission:
Please submit your code numpy_fill_plot_with_grid_yourlastname.py & numpy_fill_plot_with_grid_yourlastname.pdf to Blackboard.
Example PDF File