updates
This commit is contained in:
+56
-45
@@ -1,3 +1,4 @@
|
||||
import math
|
||||
I = 1
|
||||
O = 2
|
||||
T = 3
|
||||
@@ -6,50 +7,60 @@ Z = 5
|
||||
J = 6
|
||||
L = 7
|
||||
|
||||
# board = [
|
||||
# [I,I,I,I,L,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
||||
# [S,S,L,L,L,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
||||
# [T,S,S,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
||||
# [T,T,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
||||
# [T,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
||||
# [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
||||
# [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
||||
# [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
||||
# [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
||||
# [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
||||
# [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
||||
# [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
||||
# [0,0,0,0,0,0,0,0,0,0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0,0,0,0],
|
||||
# [0,0,0,0,0,0,0,0,0,0],
|
||||
# [0,0,0,0,0,0,0,0,0,0],
|
||||
# [0,0,0,0,0,0,0,0,0,0],
|
||||
# [0,0,0,0,0,0,0,0,0,0],
|
||||
# [0,0,I,0,0,0,0,0,0,0],
|
||||
# [O,O,I,T,0,0,0,J,J,0],
|
||||
# [O,O,I,T,T,L,L,J,L,0],
|
||||
# [O,O,I,T,I,I,L,J,L,0],
|
||||
# [S,S,S,S,0,S,S,S,S,S]
|
||||
# ]
|
||||
|
||||
board_width = len(board[0])
|
||||
board_height = len(board)
|
||||
|
||||
@@ -149,11 +160,11 @@ for y in range(height):
|
||||
else:
|
||||
pixels[x, y] = color_internal.mask(0xFFFFFFC0)
|
||||
else:
|
||||
pixels[x, y] = (0, 0, 0)
|
||||
# if (x+y)&1:
|
||||
# pixels[x, y] = (0, 0, 255)
|
||||
# else:
|
||||
# pixels[x, y] = ((x+y)>>3, (((1280+720)>>3)-((x+y)>>3)), 0)
|
||||
# pixels[x, y] = (0, 0, 0)
|
||||
if (x+y)&1:
|
||||
pixels[x, y] = (0, 0, 255)
|
||||
else:
|
||||
pixels[x, y] = (int((x + y) * 255 / ((width - 1) + (height - 1))), int((1 - (x + y) / (width + height - 2)) * 255), 0)
|
||||
|
||||
|
||||
img.save("output/folie_16_background.png")
|
||||
|
||||
+30
-21
@@ -1,3 +1,4 @@
|
||||
import math
|
||||
I = 1
|
||||
O = 2
|
||||
T = 3
|
||||
@@ -72,24 +73,32 @@ colors = [
|
||||
]
|
||||
|
||||
base_board = [
|
||||
[I,I,I,I,L,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
||||
[S,S,L,L,L,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
||||
[T,S,S,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
||||
[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0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
||||
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
||||
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
||||
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
||||
[0,0,0,0,0,J,0,T,0,0,Z,Z,0,J,0,0,L,0,0,0,0,0,O,O,0,0,0,0,S,0,0,0,L,0,0,S,0,O,O,0,J,J,T,0,0,0,0,J],
|
||||
[J,0,T,T,T,J,T,T,T,Z,Z,Z,Z,J,O,O,L,0,O,O,0,0,O,O,0,Z,Z,T,S,S,O,O,L,Z,Z,S,S,O,O,L,J,T,T,T,0,0,0,J],
|
||||
[J,J,J,T,J,J,I,I,I,I,Z,Z,J,J,O,O,L,L,O,O,I,I,I,I,Z,Z,T,T,T,S,O,O,L,L,Z,Z,S,L,L,L,J,I,I,I,I,0,J,J]
|
||||
]
|
||||
|
||||
next_piece = [
|
||||
@@ -97,7 +106,7 @@ next_piece = [
|
||||
[0,T,0]
|
||||
]
|
||||
|
||||
coord = 28
|
||||
coord = 44
|
||||
|
||||
board_width = len(base_board[0])
|
||||
board_height = len(base_board)
|
||||
@@ -148,8 +157,8 @@ for t in range(len(base_board)-1):
|
||||
# if (x+y)&1:
|
||||
# pixels[x, y] = (0, 0, 255)
|
||||
# else:
|
||||
pixels[x, y] = pixels2[x, y]# ((x+y)>>2, (((1280+720)>>2)-((x+y)>>2)), 255)
|
||||
|
||||
pixels[x, y] = pixels2[math.floor(x/1.5), math.floor(y/1.5)]#((x+y)>>2, (((1280+720)>>2)-((x+y)>>2)), 255)
|
||||
#
|
||||
|
||||
img.save(f"output/folie_{t}_background.png")
|
||||
if t == 1:
|
||||
|
||||
@@ -16,38 +16,48 @@ def format_val(x, pos=None):
|
||||
# ==========================================
|
||||
# 1. EDIT YOUR DATA HERE
|
||||
# ==========================================
|
||||
labels_main = ['Bitboard Tetris', 'TET-CPU', '4 TET-CPU']
|
||||
subtexts = ['AMD R7-7735H', '50Mhz', '50Mhz']
|
||||
labels_main = ['RTX 40 Series¹', 'RTX 40 Series²', 'RTX 40 Series²', '4 TET-FPGA', '4 TET-FPGA'][::-1]
|
||||
subtexts = ['60FPS', '60FPS', '360FPS', '60FPS (Worst-Case)', '60FPS'][::-1]
|
||||
note = ['competitor', 'competitor', 'competitor', 'ours', 'ours'][::-1]
|
||||
|
||||
invert_faster = False
|
||||
invert_ours = True
|
||||
|
||||
# Combine main titles and subtexts with newline characters
|
||||
labels = [f"{main}\n{sub}" for main, sub in zip(labels_main, subtexts)]
|
||||
|
||||
values = [41700, 909000, 909000 * 4] # e.g., Speed, FPS, Transactions per second (Higher is better)
|
||||
values = [57, 35, 17, 24.8, 12.8][::-1] # Base values (e.g., Delay Part 1)
|
||||
values_extra = [0, 0, 0, 25, 17][::-1] # Extra add-on values (e.g., Delay Part 2)
|
||||
|
||||
# Define your unit here (add a space at the start so it looks clean)
|
||||
unit_label = "Moves per Second [Moves/sec]"
|
||||
unit_label = "Delay in [ms]"
|
||||
|
||||
# Style choices
|
||||
brand_color = '#00E5FF'
|
||||
competitor_color = '#888888'
|
||||
|
||||
max_val = max(values)
|
||||
# Bracket will compare the first and last
|
||||
start_val, end_val = values[0], values[-1]
|
||||
multiplier = end_val / start_val
|
||||
competitor_color = '#00FF00'
|
||||
extra_color = '#FF0000' # Color for extra segments (ours)
|
||||
extra_color_extra = "#0E0E0E" # Color for extra segments (competitor)
|
||||
|
||||
black_outline = [path_effects.withStroke(linewidth=3, foreground='black')]
|
||||
|
||||
# ==========================================
|
||||
# 2. SETUP & DYNAMIC PLOTTING
|
||||
# ==========================================
|
||||
fig, ax = plt.subplots(figsize=(10, 6)) # Height for more labels
|
||||
fig, ax = plt.subplots(figsize=(10, 6))
|
||||
fig.patch.set_alpha(0.0)
|
||||
ax.patch.set_alpha(0.0)
|
||||
|
||||
# Create color list: grey for all, brand_color for the last one
|
||||
colors = [competitor_color] * (len(values) - 1) + [brand_color]
|
||||
bars = ax.barh(labels, values, color=colors, height=0.5, zorder=3)
|
||||
# Create color lists dynamically based on the 'note' array
|
||||
colors = [brand_color if n == 'ours' else competitor_color for n in note]
|
||||
extra_colors = [extra_color if n == 'ours' else extra_color_extra for n in note]
|
||||
|
||||
# Plot base bars and stacked extra bars
|
||||
bars_base = ax.barh(labels, values, color=colors, height=0.5, zorder=3)
|
||||
bars_extra = ax.barh(labels, values_extra, left=values, color=extra_colors, height=0.5, zorder=3)
|
||||
|
||||
# Calculate total combined values for limits and bracket positioning
|
||||
total_values = [v + e for v, e in zip(values, values_extra)]
|
||||
max_val = max(total_values)
|
||||
|
||||
# Configure Axis
|
||||
ax.xaxis.set_major_formatter(ticker.FuncFormatter(format_val))
|
||||
@@ -57,10 +67,7 @@ ax.spines['bottom'].set_visible(True)
|
||||
ax.spines['bottom'].set_color('white')
|
||||
ax.spines['bottom'].set_path_effects(black_outline)
|
||||
|
||||
# Set base size for x-axis ticks
|
||||
ax.tick_params(axis='x', colors='white', labelsize=12)
|
||||
|
||||
# Set larger font size specifically for Y-axis labels
|
||||
ax.tick_params(axis='y', colors='white', labelsize=18)
|
||||
|
||||
for label in ax.get_xticklabels() + ax.get_yticklabels():
|
||||
@@ -70,21 +77,44 @@ ax.xaxis.grid(True, linestyle='--', color='white', alpha=0.3, zorder=0)
|
||||
xlabel = ax.set_xlabel(unit_label, color='white', fontsize=12, labelpad=12, fontfamily='monospace')
|
||||
xlabel.set_path_effects(black_outline)
|
||||
|
||||
# Add Labels for each bar
|
||||
for bar, val in zip(bars, values):
|
||||
width = bar.get_width()
|
||||
txt = ax.text(width - (max_val * 0.02) if width >= (max_val*0.15) else width + (max_val*0.02),
|
||||
bar.get_y() + bar.get_height()/2,
|
||||
format_val(val),
|
||||
ha='right' if width >= (max_val*0.15) else 'left',
|
||||
va='center', color='white', fontsize=12, fontweight='bold')
|
||||
txt.set_path_effects(black_outline)
|
||||
# Add Labels for each bar and text inside/outside the extra segment
|
||||
for bar_base, bar_ext, v_base, v_ext in zip(bars_base, bars_extra, values, values_extra):
|
||||
base_width = bar_base.get_width()
|
||||
extra_width = bar_ext.get_width()
|
||||
total_width = base_width + extra_width
|
||||
|
||||
if v_ext > 0:
|
||||
# 1. Label at the very end of the total bar (just base+extra numbers)
|
||||
end_txt = ax.text(total_width + (max_val * 0.02),
|
||||
bar_base.get_y() + bar_base.get_height()/2,
|
||||
f"{format_val(total_width)} ({format_val(v_base)}+{format_val(v_ext)})",
|
||||
ha='left',
|
||||
va='center', color='white', fontsize=10, fontweight='bold')
|
||||
end_txt.set_path_effects(black_outline)
|
||||
|
||||
# 2. Text "[Peripherals]" centered horizontally inside the red/extra bar segment
|
||||
mid_extra_x = base_width + (extra_width / 2.0)
|
||||
in_txt = ax.text(mid_extra_x,
|
||||
bar_base.get_y() + bar_base.get_height()/2,
|
||||
"[Peripherals]",
|
||||
ha='center',
|
||||
va='center', color='white', fontsize=9, fontweight='bold')
|
||||
in_txt.set_path_effects(black_outline)
|
||||
else:
|
||||
# Standard label for bars without an extra segment
|
||||
end_txt = ax.text(total_width + (max_val * 0.02),
|
||||
bar_base.get_y() + bar_base.get_height()/2,
|
||||
format_val(total_width),
|
||||
ha='left',
|
||||
va='center', color='white', fontsize=10, fontweight='bold')
|
||||
end_txt.set_path_effects(black_outline)
|
||||
|
||||
# ==========================================
|
||||
# 3. DYNAMIC BRACKET (First vs Last)
|
||||
# 3. DYNAMIC BRACKET (First vs Last based on totals)
|
||||
# ==========================================
|
||||
y_start, y_end = bars[0].get_y() + bars[0].get_height()/2, bars[-1].get_y() + bars[-1].get_height()/2
|
||||
x_line, x_tick = max_val * 1.05, max_val * 1.02
|
||||
y_start = bars_base[0].get_y() + bars_base[0].get_height()/2
|
||||
y_end = bars_base[-1].get_y() + bars_base[-1].get_height()/2
|
||||
x_line, x_tick = max_val * 1.15, max_val * 1.12
|
||||
|
||||
l1, = ax.plot([x_tick, x_line], [y_end, y_end], color=brand_color, lw=2)
|
||||
l2, = ax.plot([x_tick, x_line], [y_start, y_start], color=brand_color, lw=2)
|
||||
@@ -92,13 +122,22 @@ l3, = ax.plot([x_line, x_line], [y_start, y_end], color=brand_color, lw=2)
|
||||
for l in [l1, l2, l3]:
|
||||
l.set_path_effects(black_outline)
|
||||
|
||||
mult_txt = ax.text(x_line + (max_val * 0.03), (y_start+y_end)/2,
|
||||
f'{multiplier:.1f}x\nFASTER',
|
||||
start_val, end_val = values[0], values[-1]
|
||||
multiplier = end_val / start_val
|
||||
|
||||
if (invert_faster):
|
||||
mult_txt = ax.text(x_line + (max_val * 0.03), (y_start+y_end)/2,
|
||||
f'{(1/multiplier):.1f}x\nFASTER',
|
||||
ha='left', va='center', color=brand_color, fontsize=18, fontweight='heavy')
|
||||
else:
|
||||
mult_txt = ax.text(x_line + (max_val * 0.03), (y_start+y_end)/2,
|
||||
f'{multiplier:.1f}x\nFASTER³',
|
||||
ha='left', va='center', color=brand_color, fontsize=18, fontweight='heavy')
|
||||
|
||||
mult_txt.set_path_effects(black_outline)
|
||||
|
||||
# Set x-axis limit so the axis line ends cleanly near ~4.4M with bracket room
|
||||
ax.set_xlim(0, max_val * 1.25)
|
||||
# Set x-axis limit to comfortably fit the stacked bars, labels, and bracket
|
||||
ax.set_xlim(0, max_val * 1.40)
|
||||
|
||||
plt.tight_layout()
|
||||
plt.subplots_adjust(bottom=0.2)
|
||||
|
||||
Reference in New Issue
Block a user