<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Nathan,<br>
    <br>
    Thank you for your prompt reply!<br>
    <br>
    I also have two questions:<br>
    <br>
    1.  When I tried your new script, the bug are presented below:<br>
-------------------------------------------------------------------------------------------------<br>
    pz.set_size_inches(10)<br>
    AttributeError: 'ProjectionPlot' object has no attribute
    'set_size_inches'<br>
-------------------------------------------------------------------------------------------------<br>
    <br>
    2.  For your two images, I also found that figure's resolution of
    the 'off-axis projection' is worse than the 'regular projection',
    for example, the 'off-axis projection' figure has more obvious grid
    point. <br>
    Is there any difference between two projection ways? Because I
    supposed it should be same.<br>
    <br>
    Thank you again!<br>
    <br>
    Regards,<br>
    Dan<br>
    <br>
     <br>
    <br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 05/15/2017 09:56 PM, Nathan Goldbaum
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAJXewOk7_86vf8jztswQjVVEaEmRHWE0eDYJ=U1m5yga+cV8Mw@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hi Dan,
        <div><br>
        </div>
        <div>I adapted your script to use a public dataset from <a
            moz-do-not-send="true" href="http://yt-project.org/data"
            target="_blank">yt-project.org/data</a>. I also don't have a
          definition for a surface_brightness field in my copy of yt, so
          I guess you defined that elsewhere? I used 'density'. Here's
          the script I ended up coming up with:</div>
        <div><br>
        </div>
        <div><a moz-do-not-send="true"
            href="http://paste.yt-project.org/show/7142/"
            target="_blank">http://paste.yt-project.org/<wbr>show/7142/</a><br>
        </div>
        <div><br>
        </div>
        <div>(note that you can upload scripts with the "yt pastebin"
          command line tool, e.g. "yt pastebin my_script.py")</div>
        <div><br>
        </div>
        <div>And indeed, in that case I get two images that aren't the
          desired high resolution you're looking for (although both
          images have the same resolution). The issue is that yt is
          saving the figure to disk through matplotlib. To control the
          image size in pixels through matplotlib you need to know the
          figure size in inches and the dpi (e.g. the number of pixels
          per inch of figure). Here's a revised version of the script
          above which saves to disk two images with the desired
          3200x3200 resolution:</div>
        <div><br>
        </div>
        <div><a moz-do-not-send="true"
            href="http://paste.yt-project.org/show/7145/"
            target="_blank">http://paste.yt-project.org/<wbr>show/7145/</a><br>
        </div>
        <div><br>
        </div>
        <div>It also hides the axes and colorbar, since that makes it
          easier to guess ahead of time what the final image resolution
          will be. Here are the two images:</div>
        <div><br>
        </div>
        <div>regular projection: <a moz-do-not-send="true"
            href="http://i.imgur.com/ialfYC4.png">http://i.imgur.com/ialfYC4.png</a></div>
        <div>off-axis projection: <a moz-do-not-send="true"
            href="http://i.imgur.com/PcvPZ9f.png">http://i.imgur.com/PcvPZ9f.png</a></div>
        <div><br>
        </div>
        <div>You can share images you make using yt using the "yt
          upload_image" command, which will upload an image stored
          locally to imgur. We usually suggest using that to share
          images or alternatively something like a Jupyter notebook on <a
            moz-do-not-send="true" href="http://gist.github.com">gist.github.com</a>
          to avoid clogging people's e-mail with high resolution images.</div>
        <div><br>
        </div>
        <div>Finally, if you don't want to mess with matplotlib and just
          want the underlying images, you can get those via the frb
          attribute of the plot object. Something like:</div>
        <div><br>
        </div>
        <div>    plot = yt.ProjectionPlot(ds, 'z', ('gas', 'density'))</div>
        <div>    plot.set_buff_size((3200, 3200))</div>
        <div><br>
        </div>
        <div>    # image will be a 3200x3200 numpy array</div>
        <div>    image = plot.frb['gas', 'density']</div>
        <div><br>
        </div>
        <div>I hope that helps clear things up. If you are still having
          issues it would help if you could share the exact yt version
          you are using as well as a runnable test script that
          demonstrates the issue. If you can't trigger the issue using
          one of the public SPH datasets on <a moz-do-not-send="true"
            href="http://yt-project.org/data">yt-project.org/data</a>,
          you can share one of your datasets using the yt curldrop: <a
            moz-do-not-send="true"
            href="https://docs.hub.yt/services.html#curldrop"><a class="moz-txt-link-freetext" href="https://docs.hub.yt/services.html#curldrop">https://docs.hub.yt/services.html#curldrop</a></a></div>
        <div><br>
        </div>
        <div>-Nathan</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Mon, May 15, 2017 at 4:40 AM,
          bazhaoyu_sjtu <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:hudan_bazhaoyu@sjtu.edu.cn" target="_blank">hudan_bazhaoyu@sjtu.edu.cn</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi
            yt-users:<br>
            <br>
            I want to ask you a question about the figures' resolution,
            I handled Gadget file -- hdf5.<br>
            <br>
            I used the 'ProjectionPlot' to plot the surface brightness
            map which is integrated along the 'z' axis, please see the
            figure 1; And I plot another surface brightness map by
            'OffAxisProjectionPlot' with the normal_vector is [0, 0, 1],
            please see the figure 2.<br>
            <br>
            # I can't upload attachments ??? #<br>
            <br>
            Comparing two figures, we can find the structures of them is
            same, but the resolution is different! The
            'OffAxisProjectionPlot' is obviously worse than
            'ProjectionPlot', I don't know why!<br>
            <br>
            Below are the process I created two figures:<br>
            <br>
            ==============================<wbr>==============================<wbr>==========<br>
            import yt<br>
            import numpy as np<br>
            import yt.units as units<br>
            import pylab<br>
            <br>
            fname = "snap_206.hdf5"<br>
            unit_base = {'UnitLength_in_cm' : 3.08568e+21,<br>
            'UnitMass_in_g' : 1.989e+43,<br>
            'UnitVelocity_in_cm_per_s' : 100000}<br>
            bbox_lim = 1e5 # kpc<br>
            bbox = [[-bbox_lim,bbox_lim],<br>
            [-bbox_lim,bbox_lim],<br>
            [-bbox_lim,bbox_lim]]<br>
            ds = yt.load(fname,unit_base=unit_b<wbr>ase,bounding_box=bbox)<br>
            ds.index<br>
            ad= ds.all_data()<br>
            <br>
            <br>
            ## For 'ProjectionPlot' ##<br>
            pz = yt.ProjectionPlot(ds, 'z', ('gas',
            'surface_brightness'), 'max', width=(0.4,'Mpc'))<br>
            <br>
            <br>
            ## For 'OffAxisProjectionPlot' ##<br>
            L = [0,0,1]<br>
            north_vector = [0,1,0]<br>
            pz = yt.OffAxisProjectionPlot(ds, L, ('gas',
            'surface_brightness'), 'max', north_vector = north_vector,
            width=(0.4,'Mpc'))<br>
            <br>
            <br>
            pz.set_buff_size((3200,3200))<br>
            pz.save()<br>
            ==============================<wbr>==============================<wbr>=============<br>
            <br>
            What can i do to fix this difference of resolution between
            two plot ways?<br>
            Thanks a lot!<br>
            <br>
            Regards,<br>
            Dan<br>
            <br>
            <br>
            ==============================<wbr>====<br>
            Department of Physics, Shanghai Jiao Tong University<br>
            800 Dongchuan Road, Minhang, Shanghai 200240, PRC<br>
            E-mail : <a moz-do-not-send="true"
              href="mailto:hudan_bazhaoyu@163.com" target="_blank">hudan_bazhaoyu@163.com</a><br>
            <a moz-do-not-send="true"
              href="mailto:hudan_bazhaoyu@sjtu.edu.cn" target="_blank">hudan_bazhaoyu@sjtu.edu.cn</a><br>
            ==============================<wbr>====<br>
            ______________________________<wbr>_________________<br>
            yt-users mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
            <a moz-do-not-send="true"
              href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org"
              rel="noreferrer" target="_blank">http://lists.spacepope.org/lis<wbr>tinfo.cgi/yt-users-spacepope.<wbr>org</a><br>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
yt-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a>
<a class="moz-txt-link-freetext" href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>