I want to add more fine grained grid on a plotted graph. The problem is all of the examples require access to the axis object. I want to add specific grid to already plotted graph (from inside ipython).
How do I gain access to the current figure and axis in ipython ?
With the
plt?
example (assumingipython --pylab
)displays
figure 1
; get its handle with:and a list of its axes:
turn the grid on for the current (and only) axis:
I haven't used the plt in a while, so found this stuff by just making the plot and searching the tab completion and ? for likely stuff. I'm pretty sure this is also available in the
plt
documentation.Or you can create the figure first, and hang on to its handle
And there's
gcf
andgca
(get current figure/axis). Same as in MATLAB if my memory is correct.(these are used in the sidebar link: Matplotlib.pyplot - Deactivate axes in figure. /Axis of figure overlap with axes of subplot)
plt.gcf()
to get current figureplt.gca()
to get current axis