<div dir="ltr">The margins are only used when Matplotlib auto-selects the limits for you.  Once you have used `set_xlim` or `set_ylim` we take those as explicit user-intent and will not automatically change the limits again.<div><br></div><div>Tom</div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, Jan 28, 2017 at 11:00 AM Jack Yu <<a href="mailto:llacque@gmail.com">llacque@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg"><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" class="gmail_msg">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" class="gmail_msg">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" class="gmail_msg">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" class="gmail_msg">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" class="gmail_msg">ax.set_ylim</code> has not been used.</p><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px" class="gmail_msg"><font color="#333333" face="-apple-system, blinkmacsystemfont, segoe ui, helvetica, arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol" class="gmail_msg"><span style="font-size:14px" class="gmail_msg">This notebook</span></font><br style="box-sizing:border-box" class="gmail_msg"><font color="#333333" face="-apple-system, blinkmacsystemfont, segoe ui, helvetica, arial, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol" class="gmail_msg"><span style="font-size:14px" class="gmail_msg"><a href="http://nbviewer.jupyter.org/github/qap/python_examples/blob/matplotlib/matplotlib/matplotlib_axmargins.ipynb" class="gmail_msg" target="_blank">http://nbviewer.jupyter.org/github/qap/python_examples/blob/matplotlib/matplotlib/matplotlib_axmargins.ipynb</a></span></font><br class="gmail_msg"></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" class="gmail_msg">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" class="gmail_msg">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" class="gmail_msg">ax.set_xlim</code>).</p></div>
_______________________________________________<br class="gmail_msg">
Matplotlib-users mailing list<br class="gmail_msg">
<a href="mailto:Matplotlib-users@python.org" class="gmail_msg" target="_blank">Matplotlib-users@python.org</a><br class="gmail_msg">
<a href="https://mail.python.org/mailman/listinfo/matplotlib-users" rel="noreferrer" class="gmail_msg" target="_blank">https://mail.python.org/mailman/listinfo/matplotlib-users</a><br class="gmail_msg">
</blockquote></div>