0% found this document useful (0 votes)
3 views11 pages

Understanding the subplot() Function

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views11 pages

Understanding the subplot() Function

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Subplot

August 23, 2024

[43]: '''
The subplot() Function
The subplot() function takes three arguments that describes the layout of the␣
↪figure.

The layout is organized in rows and columns, which are represented by the first␣
↪and second argument.

The third argument represents the index of the current plot.

[Link](1, 2, 1)
#the figure has 1 row, 2 columns, and this plot is the first plot.

[Link](1, 2, 2)
#the figure has 1 row, 2 columns, and this plot is the second plot.

General Form of subplot function is

[Link](nrows, ncols, index)


'''
import numpy as np
import [Link] as plt
x=[Link](-2*[Link],2*[Link],100)
y1=[Link](x)
y2=[Link](x)
[Link](1,2,1)
[Link](x,y1)
[Link](1,2,2)
[Link](x,y2)
[Link]()

1
[44]: x=[Link](-2*[Link],2*[Link],100)
y1=[Link](x)
y2=[Link](x)
[Link](1,3,1)
[Link](x,y1)
[Link](1,3,3)
[Link](x,y2)
[Link]()

2
[45]: x=[Link](-2*[Link],2*[Link],100)
y1=[Link](x)
y2=[Link](x)
[Link](2,1,1)
[Link](x,y1)
[Link](2,1,2)
[Link](x,y2)
[Link]()

3
[46]: x=[Link](-2*[Link],2*[Link],100)
y1=[Link](x)
y2=[Link](x)
y3=[Link](x)+[Link](x)
y4=[Link](x)-[Link](x)
[Link](2,2,1)
[Link](x,y1)
[Link](2,2,2)
[Link](x,y2)
[Link](2,2,3)
[Link](x,y3)
[Link](2,2,4)
[Link](x,y4)
[Link]()

4
[47]: x=[Link](-2*[Link],2*[Link],100)
y1=[Link](x)
y2=[Link](x)
y3=[Link](x)+[Link](x)
y4=[Link](x)-[Link](x)
[Link](2,2,1)
[Link](x,y1,c='r',ls='-')
[Link](2,2,2)
[Link](x,y2,c='b',ls='--')
[Link](2,2,3)
[Link](x,y3,c='g',ls=':')
[Link](2,2,4)
[Link](x,y4,c='k',ls='-.')
[Link]()

5
[48]: x=[Link](-2*[Link],2*[Link],100)
y1=[Link](x)
y2=[Link](x)
y3=[Link](x)+[Link](x)
y4=[Link](x)-[Link](x)
y5=[Link](x)*[Link](x)
[Link](3,2,1)
[Link](x,y1,c='r',ls='-')
[Link](3,2,2)
[Link](x,y2,c='b',ls='--')
[Link](3,2,3)
[Link](x,y3,c='g',ls=':')
[Link](3,2,4)
[Link](x,y4,c='k',ls='-.')
[Link](3,2,5)
[Link](x,y5,c='m',ls='-.')
[Link]()

6
[49]: x=[Link](-2*[Link],2*[Link],100)
y1=[Link](x)
y2=[Link](x)
y3=[Link](x)+[Link](x)
y4=[Link](x)-[Link](x)
y5=[Link](x)*[Link](x)
[Link](3,2,1)
[Link](x,y1,c='r',ls='-')
[Link](3,2,2)
[Link](x,y2,c='b',ls='--')
[Link](3,2,5)
[Link](x,y3,c='g',ls=':')
[Link](3,2,4)
[Link](x,y4,c='k',ls='-.')
[Link](3,2,6)
[Link](x,y5,c='m',ls='-.')
[Link]()

7
[50]: x=[Link](-1,1,100)
for i in range(1,9):
[Link](4,2,i)
[Link](x,x**i*[Link](x))

8
[51]: x=[Link](-1,1,100)
for i in range(1,17):
[Link](8,2,i)
[Link](x,x**i*[Link](x))

9
[52]: x=[Link](-1,1,100)
for i in range(1,17):
[Link](8,2,i)
[Link](x,x**i*[Link](x),c=([Link](),[Link](),[Link].
↪rand()))

10
[ ]:

11

You might also like