From e87ccee22b54e6cc4646e3a3cb240fef36ff6697 Mon Sep 17 00:00:00 2001 From: Marius Heidenreich <marius.heidenreich@tu-dortmund.de> Date: Tue, 18 Mar 2025 18:48:46 +0000 Subject: [PATCH] Delete test2.py --- test2.py | 51 --------------------------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 test2.py diff --git a/test2.py b/test2.py deleted file mode 100644 index 54fca3f..0000000 --- a/test2.py +++ /dev/null @@ -1,51 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np -from matplotlib.colors import LinearSegmentedColormap -import matplotlib.patches as patches - -# Create custom colormap -colors = [(255/255, 255/255, 30/255), (255/255, 196/255, 0/255)] # RGB values for #ffff1e and #ffc400 -custom_yellow_cmap = LinearSegmentedColormap.from_list('custom_yellow', colors) - -np.random.seed(19680801) - -# Create figure directly without subplot -fig = plt.figure(figsize=(8, 6)) -ax = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # [left, bottom, width, height] - -N = 10 -y = np.arange(N) -x = np.random.rand(N) - -# Create horizontal bars -bars = ax.barh(y, x, height=0.7) - -# Apply gradient to each bar -for bar in bars: - # Get the coordinates of the bar - x0, y0 = bar.get_xy() - width = bar.get_width() - height = bar.get_height() - - # Set the bar's face color to none (remove default color) - bar.set_facecolor('none') - - # Create multiple thin rectangles to simulate a gradient - steps = 50 - for i in range(steps): - left = x0 + (i/steps) * width - rect_width = width/steps - color = custom_yellow_cmap(i/steps) - rect = patches.Rectangle((left, y0), rect_width, height, - linewidth=0, - color=color) - ax.add_patch(rect) - -# Set limits and labels -ax.set_xlim(0, 1) -ax.set_ylim(-0.5, N-0.5) -ax.set_title('Horizontal Bar Chart with Yellow Gradient') -ax.set_xlabel('Values') -ax.set_ylabel('Categories') - -plt.show() \ No newline at end of file -- GitLab