Skip to content

Instantly share code, notes, and snippets.

@bwanaaa
Last active January 30, 2020 23:49
Show Gist options
  • Select an option

  • Save bwanaaa/12252cf36b35fced0eb3c2f64a76cb8a to your computer and use it in GitHub Desktop.

Select an option

Save bwanaaa/12252cf36b35fced0eb3c2f64a76cb8a to your computer and use it in GitHub Desktop.

Revisions

  1. bwanaaa revised this gist Jan 30, 2020. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions python loop and plot
    Original file line number Diff line number Diff line change
    @@ -27,7 +27,6 @@ for i in range(0,10):
    x=y*0.0 + mu # dummy x value is all mu
    print('array x is just all mu so that each x,y pt can be plotted')
    print (x)
    plt.plot(x,y) # k=black, plot small points
    time.sleep(2)

    plt.plot(x,y,'ko',markersize=1) # k=black, plot small points


  2. bwanaaa created this gist Jan 30, 2020.
    33 changes: 33 additions & 0 deletions python loop and plot
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    import numpy as np
    import matplotlib.pyplot as plt
    import time
    muarr = np.linspace(0,10,10)
    print('muarray')
    print(muarr)

    z = np.linspace(0.0,1.0,10) # create an array
    print('array z')
    print(z)

    def fillit(mu):
    x = 10 # initial x value
    for i in range(0,10): # fill n2-n1 iterations
    z[i] = i * x * mu
    return z # returning the array

    for i in range(0,10):
    mu = muarr[i] #for a specific horizontal axis location
    print()
    print('iteration '+ str(i))
    print('muarray '+str(i))
    print('mu = '+str(mu))
    y=fillit(mu) # an array of 10 elements from 0 to 100*mu
    print('array y is an array of 10 elements from 0 to 100*mu')
    print (y)
    x=y*0.0 + mu # dummy x value is all mu
    print('array x is just all mu so that each x,y pt can be plotted')
    print (x)
    plt.plot(x,y) # k=black, plot small points
    time.sleep(2)