Untitled
unknown
plain_text
a year ago
1.2 kB
4
Indexable
import matplotlib.pyplot as plt from matplotlib.patches import RegularPolygon from matplotlib.textpath import TextPath from matplotlib.font_manager import FontProperties from matplotlib.patches import PathPatch # Define the logo text and properties logo_text = "HobbyHive" font_prop = FontProperties(fname='/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf', size=70) # Create the text path text_path = TextPath((0, 0), logo_text, prop=font_prop) # Create the figure and axis fig, ax = plt.subplots(figsize=(10, 3)) # Add hexagon shapes around the text hexagon_side_length = 1.2 for i in range(-1, 9): hex_patch = RegularPolygon((i * hexagon_side_length * 1.5, 0), numVertices=6, radius=hexagon_side_length, orientation=np.pi/6, facecolor='gold', edgecolor='black', alpha=0.7) ax.add_patch(hex_patch) # Add the text to the plot patch = PathPatch(text_path, facecolor='orange', edgecolor='black') ax.add_patch(patch) # Set limits and aspect ax.set_xlim(-2, 15) ax.set_ylim(-3, 3) ax.set_aspect('equal') # Remove axes ax.axis('off') # Display the logo plt.show() ``` ​:citation[oaicite:0]{index=0}​
Editor is loading...
Leave a Comment