made graph markers unique (based on letters instead of symbols) to ease reading

This commit is contained in:
Guillaume Raffy 2020-09-28 11:52:13 +02:00
parent 053d0f17ac
commit 53eb1be087
1 changed files with 18 additions and 3 deletions

View File

@ -54,6 +54,19 @@ def plotCpuPassmark():
plt.show() plt.show()
def create_unique_marker(config_index):
marker_string=''
alphabet_size = 26
alphabel_base = 0x41
while True:
digit_index = config_index % alphabet_size
marker_string = chr(alphabel_base + digit_index) + marker_string
if config_index < alphabet_size:
break
else:
config_index = config_index // alphabet_size
return marker_string
def plot_system_efficiency(): def plot_system_efficiency():
cpuTable = numpy.genfromtxt('cpu_table.dat', dtype=("|U15", float, int, float, float, float), names=True, delimiter='\t') cpuTable = numpy.genfromtxt('cpu_table.dat', dtype=("|U15", float, int, float, float, float), names=True, delimiter='\t')
@ -208,21 +221,23 @@ def plot_system_efficiency():
print('itemTotalCost', itemTotalCost[i]) print('itemTotalCost', itemTotalCost[i])
print('flops', item_flops[i]) print('flops', item_flops[i])
# print y # print y
config_index = 0
for label, x1, y1, power, speed, price, in zip(item_label, x, y, item_power_consumption, item_speed, item_price): for label, x1, y1, power, speed, price, in zip(item_label, x, y, item_power_consumption, item_speed, item_price):
print(label, x1, y1) print(label, x1, y1)
if y1 > 0.0001: if y1 > 0.0001:
color = getColorCodeFromItemLabel(label) color = getColorCodeFromItemLabel(label)
# marker = markersCycler.next() # marker = markersCycler.next()
marker = get_marker_from_label( label ) # marker = get_marker_from_label( label )
#print(x1, y1) #print(x1, y1)
short_label = label.replace('dell-poweredge-','').replace('intel-xeon-','') short_label = label.replace('dell-poweredge-','').replace('intel-xeon-','')
plt.scatter( x1, y1, facecolors=color, s=markerSize, marker=marker[0], label=short_label) plt.scatter( x1, y1, facecolors=color, s=(markerSize * len(create_unique_marker(config_index))) , marker='$\mathrm{%s}$' % create_unique_marker(config_index), label=short_label)
if y1 > 5.0e16: if False: # y1 > 5.0e16:
plt.annotate( u'%s' % short_label, plt.annotate( u'%s' % short_label,
xy = (x1, y1), xytext = (x1*4.0, (y1-5.2e16)*7.1), xy = (x1, y1), xytext = (x1*4.0, (y1-5.2e16)*7.1),
textcoords = 'data', ha = 'right', va = 'bottom', textcoords = 'data', ha = 'right', va = 'bottom',
bbox = dict(boxstyle = 'round,pad=0.5', fc = 'yellow', alpha = 0.5), bbox = dict(boxstyle = 'round,pad=0.5', fc = 'yellow', alpha = 0.5),
arrowprops = dict(arrowstyle = '->', connectionstyle = 'arc3,rad=0')) arrowprops = dict(arrowstyle = '->', connectionstyle = 'arc3,rad=0'))
config_index += 1
plt.xlabel(u'purchase price [€]') plt.xlabel(u'purchase price [€]')
plt.ylabel(u'num total DP operations/total cost [€/^-1]') plt.ylabel(u'num total DP operations/total cost [€/^-1]')