Hello, I’m trying to make it so the markersize of each plotted…

Question Answered step-by-step Hello, I’m trying to make it so the markersize of each plotted… Hello, I’m trying to make it so the markersize of each plotted point will be dependent on the the amount of money it has stored. Ex: point 1 has $20 dollars, point 2 has $30 dollars -> when the graph is drawn point 2 will have a larger markersize than point 1.The information is collected from a csv file that has the amounts contained in each point. How would I make this work? Another tutor provided me with the answer below:Image transcription textI do not python liberary set up andtherefore, i did not test the code but asfar as given exception in th… Show more… Show moreHowever, when I made the correction the graph looked like this:Image transcription textTransactions Between Nodes 10 5Randomly Generated Y Values 0 – -5 -10-10 -5 0 5 10 Randomly Ge… Show more… Show moreThey all look to be the same size and not dependent on the total amount they hold. How could I fix this, do I need to normalize the data first then implement the code above? CSV FILE:Image transcription textA B C D id sender id receiver i amount 2 0 2504 5989 100306 3769 1815 99713 N 1118 2329 101305 5 3 5618 3236 99734 41153150 99732 1378 164 102014 8 2506 2745 98006 5… Show more… Show moreCode:Image transcription textimport matplotlib. pyplot as pit importpandas as pd from itertools importpermutations from rando… Show more… Show moreImage transcription textA 39 xs = [point1[0], point2[0] ] A 40 ys= [point1[1], point2[1] ] 41 42 43 44 x, y= hanging_line(point1, poin… Show more… Show moreImage transcription text76 # merge 2 lists and keep only theuniqe ones, to find uniqe nodes 77merged_list = senders+re… Show more… Show moreImage transcription text113 114 #normalization oftransactional amount 115 whole_sheet[ “amount”] =… Show more… Show moreImage transcription text151 pit . plot (x[i]/10, y[i]/10,marker=”o”,markersize=amounts[i*le… Show more… Show moreCode to copy:import matplotlib.pyplot as pltimport pandas as pdfrom itertools import permutationsfrom random import sampleimport numpy as np def hanging_line(point1, point2):   a = (point2[1]/10 – point1[1]/10)/(np.cosh(point2[0]/10) – np.cosh(point1[0]/10))  b = point1[1]/10 – a*np.cosh(point1[0]/10)  x = np.linspace(point1[0]/10, point2[0]/10,200)  y = a*np.cosh(x) + b  return (x,y)def draw(sends, receives,amounts): sender_points = [] color_sends = [] for val in sends:      sender = locations[uniqe_nodes.index(val)]      sender_points.append(sender)            color = node_colors[uniqe_nodes.index(val)]      color_sends.append(color) receiver_points = [] for val in receives:      receiver = locations[uniqe_nodes.index(val)]      receiver_points.append(receiver)       for i in range(len(sender_points)):     x_values = []     y_values = []     point1 = sender_points[i]     point2 = receiver_points[i]          xs = [point1[0], point2[0]]     ys = [point1[1], point2[1]]               x,y = hanging_line(point1, point2)     #plt.plot(x, y)     # change the color intensity based on amount of transaction     plt.plot(x, y, c=color_sends[i],alpha=(amounts[i]))               #get the mid index of the line array (consisting of points) i.e. x and y     mid_x = int(len(x) – 2)     mid_y = int(len(y) – 2)     #get the x and y coordinate for the start of the arrow     xa = x[mid_x]     ya = y[mid_y]     #get the next x and y cordinate of the line     dxa = x[mid_x+1]     dya = y[mid_y+1]     #draw the arrow : starting at xa and ya and in the direction of dxa and dya     plt.arrow(xa, ya, dxa – xa, dya – ya, head_width=1.5, head_length=1, shape=’full’, lw=0, length_includes_head=True, color=color_sends[i],alpha=(amounts[i]) )          #plt.arrow(xa,ya ,0.1 , 0.1, head_width=0.7, head_length=1, length_includes_head=True,color=color_sends[i])     # whole_sheet = pd.read_csv(“new_payment_output.csv”)whole_sheet = pd.read_csv(“outputpayments_output.csv”,nrows = 25)# put senders and receivers into 2 separate listssenders = whole_sheet[“sender_id”].tolist()receivers = whole_sheet[“receiver_id”].tolist() # merge 2 lists and keep only the uniqe ones, to find uniqe nodesmerged_list = senders+receiversuniqe_nodes = list(set(merged_list)) population = len(uniqe_nodes)print(“Number of unique nodes:”,population)# print(uniqe_nodes)# store the sending TXs amounts with respect to each unique nodesent = [0] * populationfor idx, val in enumerate(uniqe_nodes): rows = whole_sheet.loc[whole_sheet[‘sender_id’] == val] amount_list = rows[“amount”].tolist() # Show the nodes that acted as sender in multiple TXs #if len(amount_list)>1:  #print(val, amount_list) total = sum(amount_list) sent[idx] = total # store the receiving TXs amounts with respect to each unique nodereceived = [0] * populationfor idx, val in enumerate(uniqe_nodes): rows = whole_sheet.loc[whole_sheet[‘receiver_id’] == val] amount_list = rows[“amount”].tolist() # Show the nodes that acted as receiver in multiple TXs # if len(amount_list)>1: #     print(idx, val, amount_list) total = sum(amount_list) received[idx] = total # final balance of each nodebalance = [a_i – b_i for a_i, b_i in zip(received, sent)]#print min and max#print(min(whole_sheet[“amount”]))#print(max(whole_sheet[“amount”]))#normalization of transactional amountwhole_sheet[“amount”] = (whole_sheet[“amount”] –                        whole_sheet[“amount”].min()) / (whole_sheet[“amount”].max() –                                                        whole_sheet[“amount”].min())# Get the amount as listamounts  = whole_sheet[“amount”].to_list()#  loop where each unique node is assigned a (x,y) location randomly, # and no two nodes should have the same locationsupper_range = population*2;lower_range = -population*2;number_of_points = population;#create list in a different way locations=sample(list(permutations(range(lower_range,upper_range),2)),number_of_points);# print(locations)#print(locations[0][1])x = []y = []for i in range(len(locations)): x.append(locations[i][0]) y.append(locations[i][1]) # print(x)# print(y)#draw lines between nodescolors = [‘darkred’,’darkolivegreen’,’dodgerblue’,’black’,’darkblue’,’darkmagenta’,’darkorange’,’darkslategrey’,’hotpink’,’saddlebrown’]node_colors = []# colors = [‘red’,’green’,’blue’]for i in range(len(locations)): # plt.plot(x[i]/10,y[i]/10, marker=”o”, markersize=8, c = colors[i%len(colors)]) plt.plot(x[i]/10,y[i]/10, marker=”o”, markersize=amounts[i%len(amounts)], c = colors[i%len(colors)]) node_colors.append(colors[i%len(colors)])plt.title(‘Transactions Between Nodes’)plt.xlabel(“Randomly Generated X Values”)plt.ylabel(“Randomly Generated Y Values”)# Send amount as argument to plot funcitondraw(senders, receivers,amounts)# plt.plot([0,0],[0,10])plt.show()  Computer Science Engineering & Technology Python Programming COP 6727 Share QuestionEmailCopy link Comments (0)