em-dash not correctly displayed in saved pdf when using tex

Hi, I am having issues with producing an em-dash in pdf when using tex. A sample script is as below:

#!/usr/bin/env python3
import matplotlib.pyplot as plt
import math
import numpy as np

x = np.linspace(0, 2 * math.pi)
y = np.cos(x)

plt.plot(x, y)
plt.suptitle(r"abc --- def")
plt.savefig("test.pdf")
plt.show()

I have customized rc parameters:

backend = ?TkAgg?
font.family = ?serif?
text.usetex = True
image.cmap = ?CMRmap"

The plot rendered on screen looks fine. However, there are some weird characters showing up right before the em-dash in the saved pdf, as attached here.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.pdf
Type: application/pdf
Size: 148357 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20151228/6a962bb6/attachment-0001.pdf>
-------------- next part --------------

I am using Linux Mint 17.3, and uname -a gives

Linux Eridanus 3.19.0-32-generic #37~14.04.1-Ubuntu SMP Thu Oct 22 09:41:40 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

I am using python 3.4.3 + matplotlib 1.3.1, the latter of which is kind of old, but still remains the latest in the Ubuntu LTS repository. On the other had, I have installed the texlive-full package, which should include all the tex related packages. My dvipng is 1.14, and my ghostscript is 9.10. I have also tried different backends like Agg or PDF, but it makes no difference.

I have tried googling around for similar issues, but had no luck.

It would be very much appreciated If anyone had some idea how this comes about.

Sincerely,
Chao-Chin

I can't reproduce with matplotlib master, suggesting this bug has already
been fixed.

Mike

···

On Mon, Dec 28, 2015 at 4:26 AM, Chao-Chin Yang <chaochinyang at icloud.com> wrote:

Hi, I am having issues with producing an em-dash in pdf when using tex. A
sample script is as below:

#!/usr/bin/env python3
import matplotlib.pyplot as plt
import math
import numpy as np

x = np.linspace(0, 2 * math.pi)
y = np.cos(x)

plt.plot(x, y)
plt.suptitle(r"abc --- def")
plt.savefig("test.pdf")
plt.show()

I have customized rc parameters:

backend = ?TkAgg?
font.family = ?serif?
text.usetex = True
image.cmap = ?CMRmap"

The plot rendered on screen looks fine. However, there are some weird
characters showing up right before the em-dash in the saved pdf, as
attached here.

I am using Linux Mint 17.3, and uname -a gives

Linux Eridanus 3.19.0-32-generic #37~14.04.1-Ubuntu SMP Thu Oct 22
09:41:40 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

I am using python 3.4.3 + matplotlib 1.3.1, the latter of which is kind of
old, but still remains the latest in the Ubuntu LTS repository. On the
other had, I have installed the texlive-full package, which should include
all the tex related packages. My dvipng is 1.14, and my ghostscript is
9.10. I have also tried different backends like Agg or PDF, but it makes
no difference.

I have tried googling around for similar issues, but had no luck.

It would be very much appreciated If anyone had some idea how this comes
about.

Sincerely,
Chao-Chin

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

--
Michael Droettboom
Continuum Analytics
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160106/465a5504/attachment-0001.html>

What is the default encoding on your system? I wonder if in `draw_tex` or
`dvi_read` we are transcoding the text?

Tom

···

On Wed, Jan 6, 2016 at 8:56 AM Michael Droettboom <mdroettboom at continuum.io> wrote:

I can't reproduce with matplotlib master, suggesting this bug has already
been fixed.

Mike

On Mon, Dec 28, 2015 at 4:26 AM, Chao-Chin Yang <chaochinyang at icloud.com> > wrote:

Hi, I am having issues with producing an em-dash in pdf when using tex.
A sample script is as below:

#!/usr/bin/env python3
import matplotlib.pyplot as plt
import math
import numpy as np

x = np.linspace(0, 2 * math.pi)
y = np.cos(x)

plt.plot(x, y)
plt.suptitle(r"abc --- def")
plt.savefig("test.pdf")
plt.show()

I have customized rc parameters:

backend = ?TkAgg?
font.family = ?serif?
text.usetex = True
image.cmap = ?CMRmap"

The plot rendered on screen looks fine. However, there are some weird
characters showing up right before the em-dash in the saved pdf, as
attached here.

I am using Linux Mint 17.3, and uname -a gives

Linux Eridanus 3.19.0-32-generic #37~14.04.1-Ubuntu SMP Thu Oct 22
09:41:40 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

I am using python 3.4.3 + matplotlib 1.3.1, the latter of which is kind
of old, but still remains the latest in the Ubuntu LTS repository. On the
other had, I have installed the texlive-full package, which should include
all the tex related packages. My dvipng is 1.14, and my ghostscript is
9.10. I have also tried different backends like Agg or PDF, but it makes
no difference.

I have tried googling around for similar issues, but had no luck.

It would be very much appreciated If anyone had some idea how this comes
about.

Sincerely,
Chao-Chin

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

--
Michael Droettboom
Continuum Analytics
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160106/69a78f74/attachment.html>

Here is my locale:

LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=sv_SE.UTF-8
LC_TIME=en_US.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=sv_SE.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=sv_SE.UTF-8
LC_NAME=sv_SE.UTF-8
LC_ADDRESS=sv_SE.UTF-8
LC_TELEPHONE=sv_SE.UTF-8
LC_MEASUREMENT=sv_SE.UTF-8
LC_IDENTIFICATION=sv_SE.UTF-8
LC_ALL=

I hope this helps.

Sincerely,
Chao-Chin

···

On 01/06/2016 03:06 PM, Thomas Caswell wrote:

What is the default encoding on your system? I wonder if in
`draw_tex` or `dvi_read` we are transcoding the text?

Tom

On Wed, Jan 6, 2016 at 8:56 AM Michael Droettboom > <mdroettboom at continuum.io <mailto:mdroettboom at continuum.io>> wrote:

    I can't reproduce with matplotlib master, suggesting this bug has
    already been fixed.

    Mike

    On Mon, Dec 28, 2015 at 4:26 AM, Chao-Chin Yang > <chaochinyang at icloud.com <mailto:chaochinyang at icloud.com>> wrote:

        Hi, I am having issues with producing an em-dash in pdf when
        using tex. A sample script is as below:

        #!/usr/bin/env python3
        import matplotlib.pyplot as plt
        import math
        import numpy as np

        x = np.linspace(0, 2 * math.pi)
        y = np.cos(x)

        plt.plot(x, y)
        plt.suptitle(r"abc --- def")
        plt.savefig("test.pdf")
        plt.show()

        I have customized rc parameters:

        backend = ?TkAgg?
        font.family = ?serif?
        text.usetex = True
        image.cmap = ?CMRmap"

        The plot rendered on screen looks fine. However, there are
        some weird characters showing up right before the em-dash in
        the saved pdf, as attached here.

        I am using Linux Mint 17.3, and uname -a gives

        Linux Eridanus 3.19.0-32-generic #37~14.04.1-Ubuntu SMP Thu
        Oct 22 09:41:40 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

        I am using python 3.4.3 + matplotlib 1.3.1, the latter of
        which is kind of old, but still remains the latest in the
        Ubuntu LTS repository. On the other had, I have installed the
        texlive-full package, which should include all the tex related
        packages. My dvipng is 1.14, and my ghostscript is 9.10. I
        have also tried different backends like Agg or PDF, but it
        makes no difference.

        I have tried googling around for similar issues, but had no luck.

        It would be very much appreciated If anyone had some idea how
        this comes about.

        Sincerely,
        Chao-Chin

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

    --
    Michael Droettboom
    Continuum Analytics
    _______________________________________________
    Matplotlib-users mailing list
    Matplotlib-users at python.org <mailto:Matplotlib-users at python.org>
    https://mail.python.org/mailman/listinfo/matplotlib-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160106/dc35a9a2/attachment-0001.html>

I'm not a fan of the new style of gridlines in 1.5.1 (the dot spacing
has decreased significantly). How do I get the old style in 1.5.1?

M
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gridlines_new.pdf
Type: application/pdf
Size: 23707 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160313/12f2658c/attachment-0002.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gridlines_old.pdf
Type: application/pdf
Size: 23607 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160313/12f2658c/attachment-0003.pdf>

Your 'new' style looks like it taken off of either master or v2.x, not
1.5.1.

The default grid linestyle is controlled by 'grid.linestyle' rcparam. The
old default is ':' (dotted), the new default is '-' (solid).

There is also a 'classic' style which restores all of the old default
styles.

Tom

···

On Sun, Mar 13, 2016 at 11:42 PM Mike Kaufman <mckauf at gmail.com> wrote:

I'm not a fan of the new style of gridlines in 1.5.1 (the dot spacing
has decreased significantly). How do I get the old style in 1.5.1?

M
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160314/a0b65fde/attachment.html>

Sorry, yep this is master. I switched the grid.linestyle to ':', but the
dot spacing is much much closer together than the old style. How do I
change the spacing?

M

···

On 3/13/16 11:50 PM, Thomas Caswell wrote:

Your 'new' style looks like it taken off of either master or v2.x, not
1.5.1.

The default grid linestyle is controlled by 'grid.linestyle' rcparam.
The old default is ':' (dotted), the new default is '-' (solid).

There is also a 'classic' style which restores all of the old default
styles.

Tom

On Sun, Mar 13, 2016 at 11:42 PM Mike Kaufman <mckauf at gmail.com > <mailto:mckauf at gmail.com>> wrote:

    I'm not a fan of the new style of gridlines in 1.5.1 (the dot spacing
    has decreased significantly). How do I get the old style in 1.5.1?

    M
    _______________________________________________
    Matplotlib-users mailing list
    Matplotlib-users at python.org <mailto:Matplotlib-users at python.org>
    https://mail.python.org/mailman/listinfo/matplotlib-users

See the new 'lines.*_pattern' rcparams.

···

On Sun, Mar 13, 2016 at 11:52 PM Mike Kaufman <mckauf at gmail.com> wrote:

Sorry, yep this is master. I switched the grid.linestyle to ':', but the
dot spacing is much much closer together than the old style. How do I
change the spacing?

M

On 3/13/16 11:50 PM, Thomas Caswell wrote:
> Your 'new' style looks like it taken off of either master or v2.x, not
> 1.5.1.
>
> The default grid linestyle is controlled by 'grid.linestyle' rcparam.
> The old default is ':' (dotted), the new default is '-' (solid).
>
> There is also a 'classic' style which restores all of the old default
> styles.
>
> Tom
>
> On Sun, Mar 13, 2016 at 11:42 PM Mike Kaufman <mckauf at gmail.com > > <mailto:mckauf at gmail.com>> wrote:
>
>
> I'm not a fan of the new style of gridlines in 1.5.1 (the dot spacing
> has decreased significantly). How do I get the old style in 1.5.1?
>
> M
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org <mailto:Matplotlib-users at python.org>
> https://mail.python.org/mailman/listinfo/matplotlib-users
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160314/f1ba0c8b/attachment.html>

Thomas, was this expected (the change in dot spacing?). I wonder if it is a
bug in the new spacing scaled by thickness feature?

Ben Root

···

On Mon, Mar 14, 2016 at 12:00 AM, Thomas Caswell <tcaswell at gmail.com> wrote:

See the new 'lines.*_pattern' rcparams.

On Sun, Mar 13, 2016 at 11:52 PM Mike Kaufman <mckauf at gmail.com> wrote:

Sorry, yep this is master. I switched the grid.linestyle to ':', but the
dot spacing is much much closer together than the old style. How do I
change the spacing?

M

On 3/13/16 11:50 PM, Thomas Caswell wrote:
> Your 'new' style looks like it taken off of either master or v2.x, not
> 1.5.1.
>
> The default grid linestyle is controlled by 'grid.linestyle' rcparam.
> The old default is ':' (dotted), the new default is '-' (solid).
>
> There is also a 'classic' style which restores all of the old default
> styles.
>
> Tom
>
> On Sun, Mar 13, 2016 at 11:42 PM Mike Kaufman <mckauf at gmail.com >> > <mailto:mckauf at gmail.com>> wrote:
>
>
> I'm not a fan of the new style of gridlines in 1.5.1 (the dot
spacing
> has decreased significantly). How do I get the old style in 1.5.1?
>
> M
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org <mailto:Matplotlib-users at python.org>
> https://mail.python.org/mailman/listinfo/matplotlib-users
>

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160315/9dffe7ad/attachment.html>