<div dir="ltr"><div><div><div><div>Hi Nathan,<br><br></div>I gave that a try. It does put the tickmarks where I want them. However, I have to specify the tickmark locations at the end of my projection plot customization block of code, as shown below, otherwise it has no effect and the tickmark locations stay default. Calling the function p._setup_plots() at the end of the code block negates all the prior customizations I made to the plot, so unfortunately the quick fix doesn't work in this case. <br><br></div>I will file an issue on bitbucket.<br><br></div><div>Here is my plotting code with your quick fix:<br></div><div><br><span style="font-family:monospace,monospace">p = yt.ProjectionPlot(ds,2,string,center=[cent,height,0],width=(wide,height),origin="native",data_source=cut,method='integrate',weight_field='temperature')#,data_source=cut<br>p.set_log(string,False)<br>p.set_minorticks(string,'off')<br>p.set_zlim(string,300,6000) #1E-3,10<br>p.set_colorbar_label(string, 'Temperature [K]') #'Temperature [K]')<br>p.set_cbar_minorticks(string,'off')<br>p.set_cmap(field=string, cmap=mymap) #cmap='kamae_r') #'gray_r')<br>p.set_buff_size((12000,2696)) #6000,1348<br>p.set_figure_size('12') #12<br>p.set_font({'size':12})<br>p.annotate_timestamp(x_pos=cent-0.55*wide+0.084,y_pos=0.0075,time_format="{time:.4} {units}",draw_inset_box=True,coord_system='plot',<br>                     text_args={'color':'black','weight':'normal','size':10},inset_box_args={'boxstyle': 'square,pad=0.2', 'fc':'white','ec': 'black','alpha': 1.0})<br>p._setup_plots()<br>ax = p.plots[string].axes<br>ax.yaxis.set_ticks([0.00, 0.15, 0.30])# ([0.00, 0.15, 0.30])</span><br><br></div>Rearranging the code like this gives me the plot I want, but the tickmark locations stay default:<br><br><span style="font-family:monospace,monospace">p = 
yt.ProjectionPlot(ds,2,string,center=[cent,height,0],width=(wide,height),origin="native",data_source=cut,method='integrate',weight_field='temperature')#,data_source=cut<br>p._setup_plots()<br>ax = p.plots[string].axes<br>ax.yaxis.set_ticks([0.00, 0.15, 0.30])# ([0.00, 0.15, 0.30])<br>p.set_log(string,False)<br>p.set_minorticks(string,'off')<br>p.set_zlim(string,300,6000) #1E-3,10<br>p.set_colorbar_label(string, 'Temperature [K]') #'Temperature [K]')<br>p.set_cbar_minorticks(string,'off')<br>p.set_cmap(field=string, cmap=mymap) #cmap='kamae_r') #'gray_r')<br>p.set_buff_size((12000,2696)) #6000,1348<br>p.set_figure_size('12') #12<br>p.set_font({'size':12})<br>p.annotate_timestamp(x_pos=cent-0.55*wide+0.084,y_pos=0.0075,time_format="{time:.4}
 {units}",draw_inset_box=True,coord_system='plot',<br>                    
 
text_args={'color':'black','weight':'normal','size':10},inset_box_args={'boxstyle':
 'square,pad=0.2', 'fc':'white','ec': 'black','alpha': 1.0})</span><br><br></div>Doing it this way, I get the same error as in my original email:<br><span style="font-family:monospace,monospace"><br>p = 
yt.ProjectionPlot(ds,2,string,center=[cent,height,0],width=(wide,height),origin="native",data_source=cut,method='integrate',weight_field='temperature')#,data_source=cut<br>p._setup_plots()<br>p.set_log(string,False)<br>p.set_minorticks(string,'off')<br>p.set_zlim(string,300,6000) #1E-3,10<br>p.set_colorbar_label(string, 'Temperature [K]') #'Temperature [K]')<br>p.set_cbar_minorticks(string,'off')<br>p.set_cmap(field=string, cmap=mymap) #cmap='kamae_r') #'gray_r')<br>p.set_buff_size((12000,2696)) #6000,1348<br>p.set_figure_size('12') #12<br>p.set_font({'size':12})<br>p.annotate_timestamp(x_pos=cent-0.55*wide+0.084,y_pos=0.0075,time_format="{time:.4}
 {units}",draw_inset_box=True,coord_system='plot',<br>                    
 
text_args={'color':'black','weight':'normal','size':10},inset_box_args={'boxstyle':
 'square,pad=0.2', 'fc':'white','ec': 'black','alpha': 1.0})<br>ax = p.plots[string].axes<br>ax.yaxis.set_ticks([0.00, 0.15, 0.30])# ([0.00, 0.15, 0.30])</span><br><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 10, 2015 at 2:49 PM, Nathan Goldbaum <span dir="ltr"><<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@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"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Mon, Aug 10, 2015 at 1:33 PM, Gabriel Goodwin <span dir="ltr"><<a href="mailto:ggoodwin52@gmail.com" target="_blank">ggoodwin52@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"><div><div><div>Hello All,<br><br></div>Does know how to specify custom tickmark locations for the y axis of a projection plot in the 3.2 release? I was able to do it in 3.1 using the following code:<br><br><span style="font-family:monospace,monospace">p = yt.ProjectionPlot(ds,2,string,center=[cent,height,0],width=(wide,height),origin="native",data_source=cut,method='integrate',weight_field='temperature')<br>ax = p.plots[string].axes<br>ax.yaxis.set_ticks([0.00, 0.15, 0.30])</span><br><br></div>This would place tickmarks and their labels on the y axis at 0, 0.15, and 0.3.<br><br></div>When I try and do this using yt 3.2 I get the following error:<br><br><pre><span>AttributeError</span>                            Traceback (most recent call last)
<span><ipython-input-76-6e901a613181></span> in <span><module><span>()</span>
<span>     16</span> ax <span>=</span> p<span>.</span>plots<span>[</span>string<span>]</span><span>.</span>axes<span></span><span></span><span></span><span></span>
<span>---> 17<span> </span>ax<span>.</span>yaxis<span>.</span>set_ticks<span>(</span><span>[</span><span>0.00</span><span>,</span> <span>0.15</span><span>,</span> <span>0.30</span><span>]</span><span>)</span> <span></span><span></span><span></span><span></span>

<span>AttributeError</span>: 'NoneType' object has no attribute 'yaxis'<br></span></span></pre></div></blockquote><div><br></div></span><div>This is due to a performance improvement that was merged in after 3.1 went out.  See: <a href="https://bitbucket.org/yt_analysis/yt/pull-requests/1481/plot-window-performance/diff" target="_blank">https://bitbucket.org/yt_analysis/yt/pull-requests/1481/plot-window-performance/diff</a></div><div><br></div><div>The quick fix is to call "p._setup_plots()" before manipulating the axes object. The error you're seeing is because we don't actually call out to matplotlib anymore until just before the plots need to be created to be saved to disk or displayed to a user.</div><div><br></div><div>You're definitely not doing anything crazy and the way it works now is definitely a bit nonintuitive if you're used to the plots being valid immediately after calling ProjectionPlot. </div><div><br></div><div>One thing I could see doing is to make sure the plot is created if a user *does* actually try to access the axes object. This could be done by making the "axes" attribute a property that returns the axes if it's been created already or creates the axes if it hasn't yet been created and then returns them. That would take a little bit of coding work to get functional. </div><div><br></div><div>Please feel free to file an issue about this or take a stab at implementing it yourself. I can't guarantee that I'll be able to work on this myself on a short timescale, but filing the issue will prevent us from forgetting about it.</div><div><br></div><div>-Nathan</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><div dir="ltr"><pre><span><span><br></span></span></pre><pre><span><span><font face="arial,helvetica,sans-serif">It appears that we can no longer manipulate the axes object like we were able to in 3.1.<br><br></font></span></span></pre><pre><span><span><font face="arial,helvetica,sans-serif">Thank you!<br></font></span></span></pre><br><div><div><br><br></div></div></div>
<br></span>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div></div>
<br>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div>