You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DOC: update static image for interpolation_none_vs_nearest.py example #6591
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
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()
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.
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
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.
Activity
efiring commentedon Jun 15, 2016
Related: #6588 and #6590.
jkseppan commentedon Jun 18, 2016
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 withefiring commentedon 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.
[-]BUG: automatic selection of number of ticks is broken in pdf[/-][+]DOC: update static image for interpolation_none_vs_nearest.py example[/+]jkseppan commentedon Jun 18, 2016
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 commentedon Jun 19, 2016
Closed by #6608