colorbar edges in white for PDF output

It is possible I have spoken too soon. It certainly fixes the specific issue I was having, however I am now getting serious issues with a plot that uses the basemap toolkit. The contours and coastlines extend way beyond the plot boundaries. I’ve put links to before and after plots from something I’m working on, I don’t have time to do a clean test script tonight though.

I don’t know if this is a matplotlib issue or something to do with basemap… some thought is probably required on this one.

http://dl.dropbox.com/u/4496818/bad.pdf

http://dl.dropbox.com/u/4496818/good.pdf

Andrew

···

On 1 November 2012 16:02, Andrew Dawson <dawson@…1101…> wrote:

Yes this seems to work for me.

On 1 November 2012 15:25, Michael Droettboom <mdroe@…31…> wrote:

  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:

    [https://github.com/matplotlib/matplotlib/issues/1444](https://github.com/matplotlib/matplotlib/issues/1444)



    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


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](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](https://lists.sourceforge.net/lists/listinfo/matplotlib-devel)

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

Web Site: http://www2.physics.ox.ac.uk/contacts/people/dawson


Dr Andrew Dawson
Atmospheric, Oceanic & Planetary Physics
Clarendon Laboratory
Parks Road

Oxford OX1 3PU, UK
Tel: +44 (0)1865 282438

Email: dawson@…1102…1…

Thanks. I think the clipping is getting thrown away by what I just did. It should be an easy fix.

Mike

···

On 11/01/2012 01:59 PM, Andrew Dawson wrote:

It is possible I have spoken too soon. It certainly fixes the specific issue I was having, however I am now getting serious issues with a plot that uses the basemap toolkit. The contours and coastlines extend way beyond the plot boundaries. I've put links to before and after plots from something I'm working on, I don't have time to do a clean test script tonight though.

I don't know if this is a matplotlib issue or something to do with basemap... some thought is probably required on this one.

http://dl.dropbox.com/u/4496818/bad.pdf
http://dl.dropbox.com/u/4496818/good.pdf

Andrew

On 1 November 2012 16:02, Andrew Dawson <dawson@…1101… > <mailto:dawson@…1101…>> wrote:

    Yes this seems to work for me.

    On 1 November 2012 15:25, Michael Droettboom <mdroe@…31… > <mailto:mdroe@…31…>> wrote:

        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:

        https://github.com/matplotlib/matplotlib/issues/1444

        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 <mailto:Matplotlib-devel@lists.sourceforge.net>
        https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

        ------------------------------------------------------------------------------
        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
        <mailto:Matplotlib-devel@lists.sourceforge.net>
        https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

    – Dr Andrew Dawson
    Atmospheric, Oceanic & Planetary Physics
    Clarendon Laboratory
    Parks Road
    Oxford OX1 3PU, UK
    Tel: +44 (0)1865 282438 <tel:%2B44%20%280%291865%20282438>
    Email: dawson@…1101… <mailto:dawson@…1101…>
    Web Site: http://www2.physics.ox.ac.uk/contacts/people/dawson

Can you try https://github.com/matplotlib/matplotlib/pull/1446?

Mike

···

On 11/01/2012 01:59 PM, Andrew Dawson wrote:

It is possible I have spoken too soon. It certainly fixes the specific issue I was having, however I am now getting serious issues with a plot that uses the basemap toolkit. The contours and coastlines extend way beyond the plot boundaries. I've put links to before and after plots from something I'm working on, I don't have time to do a clean test script tonight though.

I don't know if this is a matplotlib issue or something to do with basemap... some thought is probably required on this one.

http://dl.dropbox.com/u/4496818/bad.pdf
http://dl.dropbox.com/u/4496818/good.pdf

Andrew

On 1 November 2012 16:02, Andrew Dawson <dawson@…1101… > <mailto:dawson@…1101…>> wrote:

    Yes this seems to work for me.

    On 1 November 2012 15:25, Michael Droettboom <mdroe@…31… > <mailto:mdroe@…31…>> wrote:

        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:

        https://github.com/matplotlib/matplotlib/issues/1444

        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 <mailto:Matplotlib-devel@lists.sourceforge.net>
        https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

        ------------------------------------------------------------------------------
        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
        <mailto:Matplotlib-devel@lists.sourceforge.net>
        https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

    – Dr Andrew Dawson
    Atmospheric, Oceanic & Planetary Physics
    Clarendon Laboratory
    Parks Road
    Oxford OX1 3PU, UK
    Tel: +44 (0)1865 282438 <tel:%2B44%20%280%291865%20282438>
    Email: dawson@…1101… <mailto:dawson@…1101…>
    Web Site: http://www2.physics.ox.ac.uk/contacts/people/dawson