-
Notifications
You must be signed in to change notification settings - Fork 16
Allow user to insert existing figure into specific grid #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you clarify what you mean by this? If I understand correctly, that seems out of scope for this project, which is really more intended to handle the subplot geometry, and you can do with that as you wish using the normal What kind of use case were you thinking of, though? Even if it's out of scope for this project, it might be worth including in the documentation. |
What I was thinking was when we trying to make the presentation, we had a lot of pain on how to insert pre-generated figures (sin functions to the power of number of grids) into the specs. We can only plot the figures on the go. t1 = np.arange(-5.0, 5.0, 0.2)
specs1 = strategies.SquareStrategy("left").get_grid(5)
for i, sub in enumerate(specs1):
plt.subplot(sub)
plt.plot(t1, np.sin(t1) ** i)
plt.show() In my view, it is hard for me to find a way inserting a figure into specific grid, what I want to do is: #pre-generated figures sin_0 through sin_4 are the same as
#plt.plot(t1, np.sin(t1) ** i) in the previous code
images = [sin_0, sin_1, sin_2, sin_3, sin_4]
specs1 = strategies.SquareStrategy("left").get_grid(5)
for i, sub in enumerate(specs1):
# This is wrong but what I was tring to do is
# if I can have another feature to just insert any image I want in any order
# this might be helpful because I can have images = [sin_3, sin_0, sin_2, sin_1, sin_4]
# and still insert into the grids using my order.
# But it is harder to do in the previous example
# i means which grid is the target grid, and
# image[i] means which image to insert into the target grid.
sub.insert(i,images[i])
plt.show() Or maybe I can figure out a matplotlib way and do a documentation example. |
The way Matplotlib is designed we don't really have the concept of embedding a t1 = np.arange(-5.0, 5.0, 0.2)
def helper(ax, i):
return ax.plot(t1, np.sin(t1)**i)
specs1 = strategies.SquareStrategy("left").get_grid(5)
fig = plt.figure()
for i, sub in enumerate(specs1):
ax = fig.add_subplot(sub)
helper(ax, i) which for this case is a bit of overkill, but starts to be worth it as |
Can we add an insert function to let users insert their premade figures into specific grids?
The text was updated successfully, but these errors were encountered: