<div dir="ltr">By default, the minor ticks are turned off. You have to turn it on yourself. This is one of the things that set_xscale('log') does for you automatically.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 8, 2017 at 1:50 PM, Slavin, Jonathan <span dir="ltr"><<a href="mailto:jslavin@cfa.harvard.edu" target="_blank">jslavin@cfa.harvard.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">I was able to get the major ticks labeled in the way I want by doing:</div><div class="gmail_default"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">ax.xaxis.set_major_formatter(t<wbr>icker.FuncFormatter(lambda x,pos: r'$10^{%i}$'% x))</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">I don't get any minor ticks that way. I could live with that, though I'd prefer to get logarithmically spaced minor ticks. I tried </div><div class="gmail_default"><font face="arial, helvetica, sans-serif">ax.xaxis.set_minor_locator(tic<wbr>ker.LogLocator())</font><br></div><div class="gmail_default"><font face="arial, helvetica, sans-serif">but that seemed to have no effect.</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif">The idea of providing logarithmically</font><span style="font-family:arial,helvetica,sans-serif"> bin edges seems like a good one, but as Tom says does not do what is expected. I tried using numpy's histogram2d providing logarithmically spaced bins and it worked as expected (though for some reason the array returned was transposed), so I think this is a bug in hist2d.</span></div><div class="gmail_default"><span style="font-family:arial,helvetica,sans-serif"><br></span></div><div class="gmail_default"><span style="font-family:arial,helvetica,sans-serif">Jon</span></div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 8, 2017 at 12:01 PM, Thomas Caswell <span dir="ltr"><<a href="mailto:tcaswell@gmail.com" target="_blank">tcaswell@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">You can do this with the formatter on the axis, see <a href="https://matplotlib.org/gallery/ticks_and_spines/tick-formatters.html#sphx-glr-gallery-ticks-and-spines-tick-formatters-py" target="_blank">https://matplotlib.org/gal<wbr>lery/ticks_and_spines/tick-for<wbr>matters.html#sphx-glr-gallery-<wbr>ticks-and-spines-tick-formatte<wbr>rs-py</a> and <a href="https://matplotlib.org/api/ticker_api.html" target="_blank">https://matplotlib.<wbr>org/api/ticker_api.html</a><div><br></div><div>You can also pass log-spaced bins to `hist2D` and then set the axis scales to log (but trying to construct an example did not got as I expected...)</div><div><br></div><div>Tom</div></div><br><div class="gmail_quote"><div><div class="m_1320344501499671236h5"><div dir="ltr">On Wed, Nov 8, 2017 at 10:10 AM Slavin, Jonathan <<a href="mailto:jslavin@cfa.harvard.edu" target="_blank">jslavin@cfa.harvard.edu</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_1320344501499671236h5"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Hi,</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">I'm wondering if anyone knows of a good way to relabel axes for a particular case I'm dealing with. I'm making a 2D histogram, using hist2d of course. The thing is that for my case, where I'm plotting the density vs. pressure for results from a hydro run, it makes more sense to use the log of the quantities as the inputs for hist2d. So then I need to give the log of the density and pressure to hist2d. This works fine for making the histogram, but then the axes are labelled with log10(n), log10(P). I'd prefer to have the axes labelled as for a logarithmic plot, so instead of say 4.0, 10^4. Is there a simple way of doing that. I'm pretty sure I can just specify by hand the ticks and tick labels, though that's kind of a pain. Any help would be appreciated.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Regards,</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Jon</div><div><br></div>-- <br><div class="m_1320344501499671236m_853930977432644604m_-1528068698478801248gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr">______________________________<wbr>__________________________<br>Jonathan D. Slavin Harvard-Smithsonian CfA<br><a href="mailto:jslavin@cfa.harvard.edu" target="_blank">jslavin@cfa.harvard.edu</a> 60 Garden Street, MS 83<br>phone: <a href="tel:(617)%20496-7981" value="+16174967981" target="_blank">(617) 496-7981</a> Cambridge, MA 02138-1516<br>cell: <a href="tel:(781)%20363-0035" value="+17813630035" target="_blank">(781) 363-0035</a> USA<br>______________________________<wbr>__________________________<br><br></div></div></div></div>
</div></div></div><span>
______________________________<wbr>_________________<br>
Matplotlib-users mailing list<br>
<a href="mailto:Matplotlib-users@python.org" target="_blank">Matplotlib-users@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/matplotlib-users" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/matplotlib-users</a><br>
</span></blockquote></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_1320344501499671236gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr">______________________________<wbr>__________________________<br>Jonathan D. Slavin Harvard-Smithsonian CfA<br><a href="mailto:jslavin@cfa.harvard.edu" target="_blank">jslavin@cfa.harvard.edu</a> 60 Garden Street, MS 83<br>phone: <a href="tel:(617)%20496-7981" value="+16174967981" target="_blank">(617) 496-7981</a> Cambridge, MA 02138-1516<br>cell: <a href="tel:(781)%20363-0035" value="+17813630035" target="_blank">(781) 363-0035</a> USA<br>______________________________<wbr>__________________________<br><br></div></div></div></div>
</div>
</div></div><br>______________________________<wbr>_________________<br>
Matplotlib-users mailing list<br>
<a href="mailto:Matplotlib-users@python.org">Matplotlib-users@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/matplotlib-users" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/matplotlib-<wbr>users</a><br>
<br></blockquote></div><br></div>