i could not understand the working of
plt.figure(0,figsize=(4,2))
and plt.subplot(1,4,i)
i could not understand the working of
plt.figure(0,figsize=(4,2))
and plt.subplot(1,4,i)
hey @Vinayak-Jaiswal-2235522119878218 ,
by default whenever we import matplotlib a default reference to a figure is created in the backend , which remains inactive until we call the above command . With this command we just activate that figure so that it can used for further purposes. Here we have just created figure with shape ( 4 ,2)
This means we want to create a grid of plots with grid rows = 1 ( first parameter ) and columns = 4 ( second parameter ) and the third parameter helps in which section / plot we need to use to plot our data.
Below is an example of a grid with rows = 3 and columns = 4 and the way we can access them.
(3,4,1) || (3,4,2) || (3,4,3) || (3,4,4) ||
(3,4,5) || (3,4,6) || (3,4,7) || (3,4,8) ||
(3,4,9) || (3,4,10) || (3,4,11) || (3,4,12) ||
using iteration in a for loop we can easily plot various different plots like this in a grid form.
I hope this would have resolved your doubt.
Thank You.
Happy learning
.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.