I have a problem in plotting some data from a list; values are not correct 
and I have to modify them.
this is the plot with the correlated functions:

import timeit
import numpy as np
import matplotlib.pyplot as plt

def factorise(n):
    factors = []
    for i in range(1,n+1):
        if n%i == 0:
            factors.append(i)
    return factors  

print('The following show the time needed to factorise each number in the 
interval:')

def list_of_times(number):
    times = []
    for i in range(1,number+1):  
        factorise(i)
        t = timeit.repeat('factorise(5)', 'from __main__ import 
factorise',repeat = 1, number = 1)
        times.append(t)
        print("{} = {} seconds".format(i,t))
    return times

number = 5

list_of_times(number)

#%%
x_values = np.arange(1,6)
print(f'x_values: {x_values}')
y_values = list_of_times(number)   
print(f'y_values: {y_values}')
plt.plot(x_values,y_values)
plt.title('The time exploration function')
plt.ylabel('$\ time(sec)$')
plt.xlabel('$x$')
plt.grid(True)  #These help the visualisation
plt.savefig('y_values_upto'+str(6)+'.png',dpi=100)
plt.show()

[image: Screenshot (7).png]



[image: Screenshot (6).png]




[image: Screenshot (5).png]



as you can see there s so many problems in the graph (i would like integers 
for x and I don't know why the y axes has these numbers)




-- 
You received this message because you are subscribed to the Google Groups 
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/spyderlib/209d4215-d740-4f26-930a-6ad0aaae24b2%40googlegroups.com.

Reply via email to