Skip to content

DOC: update static image for interpolation_none_vs_nearest.py example #6591

Closed

Description

@efiring

Gallery output from interpolation_none_vs_nearest.py:
interpolation_none_vs_nearest_00
interpolation_none_vs_nearest_01

Activity

  1. added this to the milestone on Jun 15, 2016
  2. efiring commented on Jun 15, 2016

    @efiring
    MemberAuthor

    Related: #6588 and #6590.

  3. jkseppan commented on Jun 18, 2016

    @jkseppan
    Member

    How exactly did you produce these images? Note that the example code does not actually create a pdf file, it uses the static file lib/matplotlib/mpl-data/sample_data/None_vs_nearest-pdf.png. When I change the example to really produce both images, on a recent master (6b1adfd) I get similar results on both backends. I converted the pdf file to png with

    gs -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -sDEVICE=pngalpha -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r100 -sOutputFile=None_vs_nearest-pdf.png None_vs_nearest-pdf.pdf
    

    none_vs_nearest-pdf
    none_vs_nearest-png

    diff --git a/examples/images_contours_and_fields/interpolation_none_vs_nearest.py b/examples/images_contours_and_fields/interpolation_none_vs_nearest.py
    index 802c2d1..ab6dbe5 100644
    --- a/examples/images_contours_and_fields/interpolation_none_vs_nearest.py
    +++ b/examples/images_contours_and_fields/interpolation_none_vs_nearest.py
    @@ -45,18 +45,19 @@ fig.text(0.75, 0.90, "Interpolation = 'nearest'", ha='center')
     # would save the figure as a PNG, save the same figure as a PDF, and
     # then compare them.  The following code would suffice.
     txt = fig.text(0.452, 0.95, 'Saved as a PNG', fontsize=18)
    -# plt.savefig('None_vs_nearest-png.png')
    -# txt.set_text('Saved as a PDF')
    -# plt.savefig('None_vs_nearest-pdf.pdf')
    +plt.savefig('None_vs_nearest-png.png')
    +txt.set_text('Saved as a PDF')
    +plt.savefig('None_vs_nearest-pdf.pdf')
    
     # Here, however, we need to display the PDF on a webpage, which means
     # the PDF must be converted into an image.  For the purposes of this
     # example, the 'Nearest_vs_none-pdf.pdf' has been pre-converted into
     #'Nearest_vs_none-pdf.png' at 80 dpi.  We simply need to load and
     # display it.
    -pdf_im_path = cbook.get_sample_data('None_vs_nearest-pdf.png')
    -pdf_im = plt.imread(pdf_im_path)
    -fig2 = plt.figure(figsize=[8.0, 7.5])
    -plt.figimage(pdf_im)
    +#pdf_im_path = cbook.get_sample_data('None_vs_nearest-pdf.png')
    +#pdf_im = plt.imread(pdf_im_path)
    +#fig2 = plt.figure(figsize=[8.0, 7.5])
    +#plt.figimage(pdf_im)
    +
    +#plt.show()
    
    -plt.show()
  4. efiring commented on Jun 18, 2016

    @efiring
    MemberAuthor

    Aha! I pulled the files straight from the gallery output, I believe, without looking to see what was going on. I was on the lookout for problems with the tick number selection.
    When I generate the figures with v2.x, everything is as expected. (I don't think you are running with the version you think you are, though--the small image colormap should be viridis, and there should be fewer ticks.) The real bug is that the saved static image needs to be updated. I will edit the title of this issue accordingly.

  5. changed the title [-]BUG: automatic selection of number of ticks is broken in pdf[/-] [+]DOC: update static image for interpolation_none_vs_nearest.py example[/+] on Jun 18, 2016
  6. jkseppan commented on Jun 18, 2016

    @jkseppan
    Member

    You're right, I was invoking python from a different virtualenv. In any case, even with the correct python the results look similar across the two backends.

  7. efiring commented on Jun 19, 2016

    @efiring
    MemberAuthor

    Closed by #6608

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions