Assignment - 7

Learn Plotting - All univeristy Questions

Submit before 10pm on 13th sep 2026.

1.Plot the function y = 3x^2 for −1 ≤ x ≤ 3 as a continuous line. Include enough points so thatthe curve you plot appears smooth. Label the axes x and y

2.Plot the functions sin x and cos x vs x on the same plot with x going from −π to π. Make sure the limits of the x-axis do not extend beyond the limits of the data. Plot sin x in the color orange and cos x in the color green and include a legend to label the two curves. Place the legend within the plot, but such that it does not cover either of the sine or cosine traces. Draw thin gray lines behind the curves, one horizontal at y = 0 and the other vertical at x = 0

3.Explain semi-log plots and log-log plots along with the functions used in creating such plots.

4.Write the specific purpose of functions used in plotting:

i) plot( ) ii) legend( ) iii. title( )

5.Create an array in the range 1 to 20 with values 1.25 apart. Another array contains the log values of the elements in the first array. Create a plot of first vs second array. Specify the x-axis(containing first array’s values) title as ‘Random Values’ and y-axis title as ‘Logarithm Values’.

6.Explain how matplotlib can be used to create histogram.

7.Give the reason for using Error bars in plotting with appropriate syntax.

8.Write the steps to be followed to draw a straight line using matplotlib module.

9.Plot the function sin(x)/x vs. x with x[0 to 10].Make sure the limits of the x-axis do not extend beyond the limits of the data. Plot sin x with multiple plots laid out in the same window.

10.What is meant by semi-log plots?

11.Write a Python code to generate a 2-row x 3-column grid of subplots using matplotlib functions.

12.Plot the function y=4x2+1 for -1≤ x ≤ 5 as a continuous line. The curve must appear as a smooth line. Place the legend and label the axis.

13.Describe semi-log plots and log-log plots along with the functions used in creating such plots.

14.Write a program to generate two subplots. In the top graph tan x and √(8/x)^2 − 1 vs x is plotted. In the bottom graph cot x and  √(8/x)^2 − 1   vs x is plotted. x values must vary from 0 to 10 and limit the y value from -10 to 10. Draw thin gray lines behind the curves, one horizontal at y = 0 for both subplots. Draw thin gray lines behind the curves vertical at x = π/2,3 π/2 and 5π/2 for the first subplot and x= πand 2π in the second subplot. Give label to both x-axis and y-axis.

15.Write python code to plot filled contour for the function z ═ (x^2 + y^2)^1/2 wher x andy values vary from -3.0 to 3.0. Add a color bar to the plot. Give a title to the plot label the axis.

16.Write a program to plot y=4x^2 for -1≤ x ≤ 3

17.What are contour and vector field plots? How to generate these plots?

Comments

Popular posts from this blog

Python For Engineers CST 445 KTU Open Elective Notes S7 - Dr Binu V P

Model Question Paper CST 445 KTU Python For Engineers

Plotting- Simple plots,setting limits,subplot, semilog, loglog plots