Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
efiring opened this issue Jun 15, 2016 · 5 comments
Closed

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

efiring opened this issue Jun 15, 2016 · 5 comments
Milestone

Comments

@efiring
Copy link
Member

efiring commented Jun 15, 2016

Gallery output from interpolation_none_vs_nearest.py:
interpolation_none_vs_nearest_00
interpolation_none_vs_nearest_01

@efiring efiring added this to the 2.0 (style change major release) milestone Jun 15, 2016
@efiring
Copy link
Member Author

efiring commented Jun 15, 2016

Related: #6588 and #6590.

@jkseppan
Copy link
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()

@efiring
Copy link
Member Author

efiring commented Jun 18, 2016

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.

@efiring efiring 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 Jun 18, 2016
@jkseppan
Copy link
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.

@efiring
Copy link
Member Author

efiring commented Jun 19, 2016

Closed by #6608

@efiring efiring closed this as completed Jun 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants