colorbar edges in white for PDF output

Hi all,

I just noticed that colorbar edges are drawn in white when output in PDF and black when output in PNG. A small test script is attached along with the output to show the difference.

I’d be interested in knowing if others can reproduce this? I’m using mpl-1.3.x (updated 5 minutes ago) on 64-bit Ubuntu 12.04.

Cheers,

Andrew

bug.py (538 Bytes)

test.png

test.pdf (47.1 KB)

I confirm on 1.2.x. on OSX 10.7.5.

Nicolas

···

On Oct 31, 2012, at 17:20 , Andrew Dawson wrote:

Hi all,

I just noticed that colorbar edges are drawn in white when output in PDF and black when output in PNG. A small test script is attached along with the output to show the difference.

I'd be interested in knowing if others can reproduce this? I'm using mpl-1.3.x (updated 5 minutes ago) on 64-bit Ubuntu 12.04.

Cheers,
Andrew
<bug.py><test.png><test.pdf>------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options

I used git bisect to work out where this first happens and it says https://github.com/matplotlib/matplotlib/commit/4dd3de1b580ac0d7dc53bcca396ba1bf25a8eea9 is the first bad commit. This commit does make changes to the PDF backend so it seems feasible. Unfortunately I don’t know the backend code so this is currently out of my depth…

Perhaps Michael could weigh in on this? Or others familiar with backend workings?

Andrew

···

On 31 October 2012 16:29, Nicolas Rougier <Nicolas.Rougier@…922…> wrote:

I confirm on 1.2.x. on OSX 10.7.5.

Nicolas

On Oct 31, 2012, at 17:20 , Andrew Dawson wrote:

Hi all,

I just noticed that colorbar edges are drawn in white when output in PDF and black when output in PNG. A small test script is attached along with the output to show the difference.

I’d be interested in knowing if others can reproduce this? I’m using mpl-1.3.x (updated 5 minutes ago) on 64-bit Ubuntu 12.04.

Cheers,

Andrew

<bug.py><test.png><test.pdf>------------------------------------------------------------------------------

Everyone hates slow websites. So do we.

Make your web apps faster with AppDynamics

Download AppDynamics Lite for free today:

http://p.sf.net/sfu/appdyn_sfd2d_oct_______________________________________________

Matplotlib-devel mailing list

Matplotlib-devel@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

I've filed an issue for this here:

Mike

···

On 10/31/2012 12:20 PM, Andrew Dawson wrote:

Hi all,

I just noticed that colorbar edges are drawn in white when output in PDF and black when output in PNG. A small test script is attached along with the output to show the difference.

I'd be interested in knowing if others can reproduce this? I'm using mpl-1.3.x (updated 5 minutes ago) on 64-bit Ubuntu 12.04.

Cheers,
Andrew

bug.py

import matplotlib.pyplot as plt
import numpy as np

# dummy data
x = y = np.linspace(-np.pi, np.pi, 50)
X, Y = np.meshgrid(x, y)
Z = np.sin(X) * np.cos(2.*Y)

# draw a filled contour plot and add a colorbar with drawedges turned on
contours = plt.contourf(x, y, Z)
cb = plt.colorbar(orientation='horizontal', drawedges=True)

# turn off tick marks so the edges can be seen
for tick in cb.ax.get_xticklines() + cb.ax.get_yticklines():
     tick.set_visible(False)

# save as a PDF and a PNG
plt.savefig('test.pdf')
plt.savefig('test.png')

I now have a fix attached to that issue. Andrew: can you confirm it works for you?

Mike

···

On 11/01/2012 09:06 AM, Michael Droettboom wrote:

I've filed an issue for this here:

Colorbar edges are different in PDF backend by mdboom · Pull Request #1444 · matplotlib/matplotlib · GitHub

Mike

On 10/31/2012 12:20 PM, Andrew Dawson wrote:

Hi all,

I just noticed that colorbar edges are drawn in white when output in PDF and black when output in PNG. A small test script is attached along with the output to show the difference.

I'd be interested in knowing if others can reproduce this? I'm using mpl-1.3.x (updated 5 minutes ago) on 64-bit Ubuntu 12.04.

Cheers,
Andrew

bug.py

import matplotlib.pyplot as plt
import numpy as np

# dummy data
x = y = np.linspace(-np.pi, np.pi, 50)
X, Y = np.meshgrid(x, y)
Z = np.sin(X) * np.cos(2.*Y)

# draw a filled contour plot and add a colorbar with drawedges turned on
contours = plt.contourf(x, y, Z)
cb = plt.colorbar(orientation='horizontal', drawedges=True)

# turn off tick marks so the edges can be seen
for tick in cb.ax.get_xticklines() + cb.ax.get_yticklines():
     tick.set_visible(False)

# save as a PDF and a PNG
plt.savefig('test.pdf')
plt.savefig('test.png')

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct

_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options