![]() ![]() The other answer has code for dealing with a list of axes: axes.get_shared_x_axes(). Then you can play with subplotadjust (), but you must be careful with making space in a symmetric way if you want to keep the solution simple. # ax2.autoscale() # call autoscale if needed Example: fig, axes plt.subplots (ncols2, sharexTrue, shareyTrue,figsize (8,4)) fig.subplotsadjust (0,0,1,1,0,0) As Benjamin Bannier points out, as a drawback you have zero margins. Since both the above subplots have the same -axis limits, you can remove the redundant -axis values from the right-hand side subplot using the keyword shareyTrue fig, (ax1, ax2) plt. In case subplotsTrue, share y axis and set some y axis labels to invisible. In contrast to the sharing at creation time, you will have to set the xticklabels off manually for one of the axes (in case that is wanted). Make plots of DataFrame using matplotlib / pylab. Using ax1.get_shared_x_axes().join(ax1, ax2)Ĭreates a link between the two axes, ax1 and ax2. However if for any reason, you need to share axes after they have been created (actually, using a different library which creates some subplots, like here might be a reason), there would still be a solution: Sharing the axes after they have been created should therefore not be necessary. ![]() When you create a subplot() or axes() instance, you can pass in a keyword indicating what axes you. ![]() Or fig, (ax1, ax2) = plt.subplots(nrows=2, sharex=True) Sharing axis limits and views sharex and sharey attribute. The usual way to share axes is to create the shared properties at creation. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |