Untitled
unknown
plain_text
4 months ago
1.5 kB
3
Indexable
# Create a figure and axis fig, ax = plt.subplots(figsize=(8, 8)) # Add ellipses to represent the sets ellipse_q = Ellipse((0.5, 0.5), width=0.8, height=0.6, edgecolor='blue', facecolor='none', lw=2, label="Q (Rationale getallen)") ellipse_z = Ellipse((0.5, 0.5), width=0.6, height=0.4, edgecolor='green', facecolor='none', lw=2, label="Z (Gehele getallen)") ellipse_n = Ellipse((0.5, 0.5), width=0.4, height=0.2, edgecolor='red', facecolor='none', lw=2, label="N (Natuurlijke getallen)") # Add ellipses to the plot ax.add_patch(ellipse_q) ax.add_patch(ellipse_z) ax.add_patch(ellipse_n) # Add labels for sets ax.text(0.5, 0.65, "Q", color="blue", fontsize=14, ha='center', va='center') ax.text(0.5, 0.55, "Z", color="green", fontsize=14, ha='center', va='center') ax.text(0.5, 0.45, "N", color="red", fontsize=14, ha='center', va='center') # Add examples to the sets ax.text(0.5, 0.38, "1, 2, 3", color="red", fontsize=12, ha='center', va='center') # N ax.text(0.5, 0.48, "-3, 0, 1", color="green", fontsize=12, ha='center', va='center') # Z ax.text(0.5, 0.58, "1/2, -5, 3", color="blue", fontsize=12, ha='center', va='center') # Q # Set the limits and aspect ratio ax.set_xlim(0, 1) ax.set_ylim(0, 1) ax.set_aspect('equal') # Remove axes for better visualization ax.axis('off') # Show plot plt.title("Relatie tussen N, Z en Q met Voorbeelden", fontsize=16) plt.legend(loc='upper left', fontsize=12) plt.show()
Editor is loading...
Leave a Comment