bug for savefig to eps in the latest version of matplotlib

Dear all,

I recently update my matplotlib to the latest version, and found
pyplot.savefig to eps file didn't work well like previous version.
Test script:

···

==================================
#!/usr/bin/python -tt
from matplotlib.colors import LogNorm
import matplotlib.pyplot as plt
import numpy as np

# normal distribution center at x=0 and y=5
x = np.random.randn(100000)
y = np.random.randn(100000) + 5

plt.hist2d(x, y, bins=40, norm=LogNorm())
plt.colorbar()
#plt.show()
plt.savefig('test.eps')
#plt.savefig('test.png')

The result of plt.show() is just like the result of test.png, while
test.eps has a weired large file size (more than 20 MB in other case).
In the meantime, the facecolor for 'NaN' value in test.eps is black,
different from test.png and previous version. I consider it is a bug here.
How to reach the desired style (regular size, and white color for 'NaN'
value in image)? Thanks a lot.
--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Xu,Bin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.png
Type: image/png
Size: 13757 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20170330/39b20673/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.eps
Type: image/x-eps
Size: 947546 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20170330/39b20673/attachment-0001.bin>

as a test, can you activate the "classic" mode? I have a suspicion what
this bug is. Just add "import matplotlib; matplotlib.use('classic')" before
any plotting calls.

Ben Root

···

On Wed, Mar 29, 2017 at 11:16 PM, Xu, Bin <xubinrun at gmail.com> wrote:

Dear all,

I recently update my matplotlib to the latest version, and found
pyplot.savefig to eps file didn't work well like previous version.
Test script:

#!/usr/bin/python -tt
from matplotlib.colors import LogNorm
import matplotlib.pyplot as plt
import numpy as np

# normal distribution center at x=0 and y=5
x = np.random.randn(100000)
y = np.random.randn(100000) + 5

plt.hist2d(x, y, bins=40, norm=LogNorm())
plt.colorbar()
#plt.show()
plt.savefig('test.eps')
#plt.savefig('test.png')

The result of plt.show() is just like the result of test.png, while
test.eps has a weired large file size (more than 20 MB in other case). In
the meantime, the facecolor for 'NaN' value in test.eps is black, different
from test.png and previous version. I consider it is a bug here.
How to reach the desired style (regular size, and white color for 'NaN'
value in image)? Thanks a lot.
--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Xu,Bin

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
Matplotlib-users Info Page

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20170330/fa41c443/attachment.html&gt;

Dear Ben Root,

Thanks for your suggestions. Here, I used "plt.style.use('classic')",
but the created eps figure was still similar to previous one or even
larger... Incidentally, the matplotlibrc I used is the default
matplotlibc in my version 2.0.0.

Bin

···

On 03/30/2017 09:43 PM, Benjamin Root wrote:

as a test, can you activate the "classic" mode? I have a suspicion
what this bug is. Just add "import matplotlib;
matplotlib.use('classic')" before any plotting calls.

Ben Root

On Wed, Mar 29, 2017 at 11:16 PM, Xu, Bin <xubinrun at gmail.com > <mailto:xubinrun at gmail.com>> wrote:

    Dear all,

    I recently update my matplotlib to the latest version, and found
    pyplot.savefig to eps file didn't work well like previous version.
    Test script:
    ==================================
    #!/usr/bin/python -tt
    from matplotlib.colors import LogNorm
    import matplotlib.pyplot as plt
    import numpy as np

    # normal distribution center at x=0 and y=5
    x = np.random.randn(100000)
    y = np.random.randn(100000) + 5

    plt.hist2d(x, y, bins=40, norm=LogNorm())
    plt.colorbar()
    #plt.show()
    plt.savefig('test.eps')
    #plt.savefig('test.png')
    ==================================
    The result of plt.show() is just like the result of test.png,
    while test.eps has a weired large file size (more than 20 MB in
    other case). In the meantime, the facecolor for 'NaN' value in
    test.eps is black, different from test.png and previous version. I
    consider it is a bug here.
    How to reach the desired style (regular size, and white color for
    'NaN' value in image)? Thanks a lot.
    --

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Xu,Bin

    _______________________________________________
    Matplotlib-users mailing list
    Matplotlib-users at python.org <mailto:Matplotlib-users at python.org>
    Matplotlib-users Info Page
    <https://mail.python.org/mailman/listinfo/matplotlib-users&gt;

--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Xu,Bin

School of Materials Science and Engineering,
Shanghai Jiao Tong University,
800 Dongchuan Road, Minhang,
Shanghai 200240, China

Email: xubinrun at gmail.com, xubin_materials at sjtu.edu.cn
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20170330/b2e6dcfd/attachment-0001.html&gt;

The black is probably from a 0 alpha ending up in the output (which eps
does not support). I wonder where you think the bug is Ben, my guess is in
the image resampling code.

Tom

···

On Thu, Mar 30, 2017 at 10:01 AM Xu, Bin <xubinrun at gmail.com> wrote:

Dear Ben Root,

Thanks for your suggestions. Here, I used "plt.style.use('classic')", but
the created eps figure was still similar to previous one or even larger...
Incidentally, the matplotlibrc I used is the default matplotlibc in my
version 2.0.0.
Bin

On 03/30/2017 09:43 PM, Benjamin Root wrote:

as a test, can you activate the "classic" mode? I have a suspicion what
this bug is. Just add "import matplotlib; matplotlib.use('classic')" before
any plotting calls.

Ben Root

On Wed, Mar 29, 2017 at 11:16 PM, Xu, Bin <xubinrun at gmail.com> wrote:

Dear all,

I recently update my matplotlib to the latest version, and found
pyplot.savefig to eps file didn't work well like previous version.
Test script:

#!/usr/bin/python -tt
from matplotlib.colors import LogNorm
import matplotlib.pyplot as plt
import numpy as np

# normal distribution center at x=0 and y=5
x = np.random.randn(100000)
y = np.random.randn(100000) + 5

plt.hist2d(x, y, bins=40, norm=LogNorm())
plt.colorbar()
#plt.show()
plt.savefig('test.eps')
#plt.savefig('test.png')

The result of plt.show() is just like the result of test.png, while
test.eps has a weired large file size (more than 20 MB in other case). In
the meantime, the facecolor for 'NaN' value in test.eps is black, different
from test.png and previous version. I consider it is a bug here.
How to reach the desired style (regular size, and white color for 'NaN'
value in image)? Thanks a lot.
--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Xu,Bin

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
Matplotlib-users Info Page

--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Xu,Bin

School of Materials Science and Engineering,
Shanghai Jiao Tong University,
800 Dongchuan Road, Minhang,
Shanghai 200240, China

Email: xubinrun at gmail.com, xubin_materials at sjtu.edu.cn
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
Matplotlib-users Info Page

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20170401/5936eca8/attachment.html&gt;

I was thinking it was possibly a change in background, but that would have
been tied to the style change. Since the bug is in both syles, my original
theory doesn't pan out.

Ben Root

···

On Sat, Apr 1, 2017 at 4:00 PM, Thomas Caswell <tcaswell at gmail.com> wrote:

The black is probably from a 0 alpha ending up in the output (which eps
does not support). I wonder where you think the bug is Ben, my guess is in
the image resampling code.

Tom

On Thu, Mar 30, 2017 at 10:01 AM Xu, Bin <xubinrun at gmail.com> wrote:

Dear Ben Root,

Thanks for your suggestions. Here, I used "plt.style.use('classic')", but
the created eps figure was still similar to previous one or even larger...
Incidentally, the matplotlibrc I used is the default matplotlibc in my
version 2.0.0.
Bin

On 03/30/2017 09:43 PM, Benjamin Root wrote:

as a test, can you activate the "classic" mode? I have a suspicion what
this bug is. Just add "import matplotlib; matplotlib.use('classic')" before
any plotting calls.

Ben Root

On Wed, Mar 29, 2017 at 11:16 PM, Xu, Bin <xubinrun at gmail.com> wrote:

Dear all,

I recently update my matplotlib to the latest version, and found
pyplot.savefig to eps file didn't work well like previous version.
Test script:

#!/usr/bin/python -tt
from matplotlib.colors import LogNorm
import matplotlib.pyplot as plt
import numpy as np

# normal distribution center at x=0 and y=5
x = np.random.randn(100000)
y = np.random.randn(100000) + 5

plt.hist2d(x, y, bins=40, norm=LogNorm())
plt.colorbar()
#plt.show()
plt.savefig('test.eps')
#plt.savefig('test.png')

The result of plt.show() is just like the result of test.png, while
test.eps has a weired large file size (more than 20 MB in other case). In
the meantime, the facecolor for 'NaN' value in test.eps is black, different
from test.png and previous version. I consider it is a bug here.
How to reach the desired style (regular size, and white color for 'NaN'
value in image)? Thanks a lot.
--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Xu,Bin

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
Matplotlib-users Info Page

--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Xu,Bin

School of Materials Science and Engineering,
Shanghai Jiao Tong University,
800 Dongchuan Road, Minhang,
Shanghai 200240, China

Email: xubinrun at gmail.com, xubin_materials at sjtu.edu.cn
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
Matplotlib-users Info Page

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20170403/77c14e25/attachment.html&gt;