import pylab
import numpy

# constant values
V0=5


# create the array R containing 500 values 
# evenly spaced, in the logarithmic space, 
# between 1e1 and 1e6
R = numpy.logspace(1,6,100)

# initialize the rG and the counter values
rG = 0.
colorcounter = 0

# create the string array for the colors of the 
# plotted lines
colore=['black','red','green','orange','blue','gray','violet']

# initialize the string array needed for the legend
legenda = [('rG = 0')]

# realize the for cycle (NOTE THE INDENT OF THE 
# SECTION TO BE REPEATED IN THE LOOP!)
for colorcounter in range(0,7):
    
    # evaluate the function
    I=V0/(R+rG)

    # set the log log scale
    pylab.xscale('log')
    pylab.yscale('log')

    # bellurie che dovete ricordare!
    pylab.rc('font',size=16)
    pylab.xlabel('R  [ohm]')
    pylab.ylabel('I  [A]')
     
    # draw the plot
    pylab.plot(R,I,color=colore[colorcounter])
    
    # modify the axes range to better show the behavior
    pylab.xlim(1e1, 1e3)
    pylab.ylim(3e-3,3e-1)
    
    # draw the legenda
    pylab.legend(legenda, prop={'size':12})
    
    # increment the rG value
    rG += 5.
    
    # update the legenda (append the current rG value)
    legenda.append('rG = ' + str(rG) + ' ohm')

# save the plot (in my own directory!) 
# (NOTE THAT THERE IS NO INDENT SINCE THE FOR 
# CYCLE IS NOW COMPLETED)
pylab.savefig('D:\stash\dida14_15\lab2_14_15\simul_res_int\plot5.pdf')

# display the plot on screen
pylab.show()

