<div dir="ltr"><p style="box-sizing:border-box;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,"segoe ui",helvetica,arial,sans-serif,"apple color emoji","segoe ui emoji","segoe ui symbol";font-size:14px;margin-top:0px">Is there a way to use <code style="box-sizing:border-box;font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:11.9px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-radius:3px">ax.margins</code> to adjust the axes limits, after the axes limits have already been adjusted using <code style="box-sizing:border-box;font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:11.9px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-radius:3px">ax.set_ylim</code>? It appears that <code style="box-sizing:border-box;font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:11.9px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-radius:3px">ax.margins</code> has effect only if <code style="box-sizing:border-box;font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:11.9px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-radius:3px">ax.set_ylim</code> has not been used.</p><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px"><font color="#333333" face="-apple-system, blinkmacsystemfont, segoe ui, helvetica, arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol"><span style="font-size:14px">This notebook</span></font><br style="box-sizing:border-box"><font color="#333333" face="-apple-system, blinkmacsystemfont, segoe ui, helvetica, arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol"><span style="font-size:14px"><a href="http://nbviewer.jupyter.org/github/qap/python_examples/blob/matplotlib/matplotlib/matplotlib_axmargins.ipynb">http://nbviewer.jupyter.org/github/qap/python_examples/blob/matplotlib/matplotlib/matplotlib_axmargins.ipynb</a></span></font><br></p><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,"segoe ui",helvetica,arial,sans-serif,"apple color emoji","segoe ui emoji","segoe ui symbol";font-size:14px">describes a situation in which this need may arise.</p><p style="box-sizing:border-box;margin-top:0px;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,"segoe ui",helvetica,arial,sans-serif,"apple color emoji","segoe ui emoji","segoe ui symbol";font-size:14px;margin-bottom:0px">Note: the y-axis is just an example, the same also applies to the x-axis (<code style="box-sizing:border-box;font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:11.9px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-radius:3px">ax.set_xlim</code>).</p></div>