d2jsp
Log InRegister
d2jsp Forums > Off-Topic > General Chat > Homework Help > N Little Help In Python > Plots
Add Reply New Topic New Poll
Member
Posts: 16,867
Joined: Sep 4 2017
Gold: 66,094.00
Mar 10 2019 01:41pm
Here is a code

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
import numpy
import matplotlib.pyplot as plt


def p2(lam, n):
return lam ** n * numpy.exp(-lam) / numpy.math.factorial(n)

size = 20
xVec = [0] * size
plt.figure(figsize = (12, 4))

for x in range(size):
xVec[x] = p2(1, x)
plt.subplot(1, 3, 1)
plt.stem(xVec, markerfmt = ' ')


for x in range(size):
xVec[x] = p2(2, x)
plt.subplot(1, 3, 2)
plt.stem(xVec, markerfmt = ' ')

for x in range(size):
xVec[x] = p2(10, x)
plt.subplot(1, 3, 3)
plt.stem(xVec, markerfmt = ' ')

plt.show()
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

i need to change code it to look like this:


offer: 200fg for help
Member
Posts: 3,417
Joined: May 15 2009
Gold: 1,201.69
Mar 13 2019 08:41pm
your plot commands should look like this:

plt.subplot(1,3,1)

plt.subplot(1,3,2)

plt.subplot(1,3,3)

send fg pleeeease
Member
Posts: 3,417
Joined: May 15 2009
Gold: 1,201.69
Mar 13 2019 11:01pm
Quote (marioo1182 @ 13 Mar 2019 19:41)
your plot commands should look like this:

plt.subplot(1,3,1)

plt.subplot(1,3,2)

plt.subplot(1,3,3)

send fg pleeeease


woops mb didn't see you have the same thing. Put your suplot commands outside of your loops however.
Member
Posts: 16,867
Joined: Sep 4 2017
Gold: 66,094.00
Mar 14 2019 03:30am
Quote (marioo1182 @ Mar 14 2019 04:41am)
your plot commands should look like this:

plt.subplot(1,3,1)

plt.subplot(1,3,2)

plt.subplot(1,3,3)

send fg pleeeease


Quote (marioo1182 @ Mar 14 2019 07:01am)
woops mb didn't see you have the same thing. Put your suplot commands outside of your loops however.


its not only this what i ask...
anyway i solved this problem by myself

closed
Go Back To Homework Help Topic List
Add Reply New Topic New Poll