Question: 3 ) visualize data ( 2 0 points ) generate a plot to display f 1 , f 2 , f 3 and f 4

3) visualize data (20 points)
generate a plot to display f1, f2, f3 and f4 over x
detailed steps:
- generate a new figure using the function plt.figure and set the figure size to figsize=(10,6)
- plot f1, f2, f3 and f4 over x[0,:] and set the labels to 'f =50 kHz','f =100 kHz','f =150 kHz', and 'f =200 kHz'
- set the plot title to 'amplitude development vs x for select frequencies'
- switch on the grid
- set the x-axis limits from 0 to 1e-2
- set the y-axis limits from 0 to 2
- set the x-label to 'x' with fontsize 20
- set the y-label to 'amplitude' with fontsize 20
- use the tight_layout function to ensure that all parts of the plot are displayed in the window
- add a legend to the plot in the upper left corner
- export the figure to a file named 'amplitude_vs_x.png' with a resolution of 300 dpi
generate a 2d contour plot with filled contours (hint contourf command, lecture 14)
detailed instructions:
- plot p as a function of x and t
- get the axis properties (ax = gca)
- customize the plot as follows
* set the tick labels to fontsize 20
* set the x-label to x with fontsize 20
* set the y-label to y with fontsize 20
* set the x-limits from 0 to 1e-2
* set the y-limits frmo 0 to 1e-4
* add a colorbar
* ensure that verything is displayed within the available window using the tight_layout function
* set the plot title to 'x-t diagram'
- save the 2d contour plot as a figure with the name 'xt.png'
- show the plots (plt.show())
1d plot
2d plot
display plots
Python Code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!