I don't know how this thing is called, or even how to describe it, so the title may be a little bit misleading.
The first attached graph was created with pyplot. I would like to draw a straight line that goes through all graphs instead of the three red dot I currently use. Is it possible in pyplot? Second image is what I am looking for.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
[Update 03/2013] In newer revisions of matplotlib, there's ConnectionPatch that greatly simplifies this task. It's particularly useful whenever there are more than two subplots that need to be covered.
Relevant documentation:
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.axvline
Edit: since @DSM's answer was so much better than mine I have shamefully incorporated some of that answer in an attempt to make my answer less poor.
I've tried to handle the somewhat-general case of multiple subplots in a column (i.e. not the even-more-general case of multiple subplots, e.g. in a grid).
Thanks, @DSM, for your answer and @Artium for the question.
I would try
axvline(x, y1, y2)
(link), but I don't think any of the options in pyplot will draw something that spans across several subplots/graphs.If that's the case, I would just try drawing the same vertical line at each point in the graph, hoping that the same intent is conveyed to the viewer.
You can pull this off by turning clipping off for the relevant lines. There's probably a cleaner way to do this -- you might be able to draw lines on the main frame directly -- but the following worked for me:
With a bit more work you could modify the line drawing to handle the general case of multiple subplot windows, but I'm profoundly lazy. :^)