KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I would like to add a rectangle over a graph. Through all the documentation I've found, the rectangle should be opaque by default, with transparency controlled by an alpha argument. However, I can't get the rectangle to show up as opaque, even with alpha = 1. Am I doing something wrong, or is there something else I need to know about the way that graphs interact with patches? Here is a toy example: import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as patches from pylab import * x = np.arange(10) y = x fig = plt.figure() ax = fig.add_subplot(111) ax.plot(x, y) rect = patches.Rectangle( ( 2,3 ), 2, 2, alpha = 1, ec = "gray", fc = "CornflowerBlue", visible = True) ax.add_patch(rect) plt.show()
Tags (comma-separated)
Save Edits
Cancel