X Tutup
Skip to content

Path effects for text outline is missing corners #7227

@flutefreak7

Description

@flutefreak7

When I try to make text with an outline using path effects, I notice that the path appears to miss some corners on some letters. I'd guess this occurs on letters where the letter's path starts at the corner and the final round is never generated because the path stops at that same corner.

This effect appears on the upper case C, J, S, and to a lesser extent, the O (there is a sliver of outline missing from the left side of the O). It also occurs on lower-case c, j, s, t, y, and o. I didn't check punctuation, unicode, etc, but I'm assuming the effect occurs on many glyphs whose path starts at a vertex or on a curve.

  • Matplotlib version, Python version and Platform (Windows, OSX, Linux ...)

Matplotlib 1.5.1 installed with conda
Python 3.4.4
Windows 7 64-bit

  • How did you install Matplotlib and Python (pip, anaconda, from source ...)

anaconda

  • If possible please supply a Short, Self Contained, Correct, Example
    that demonstrates the issue i.e a small piece of code which reproduces the issue
    and can be run with out any other (or as few as possible) external dependencies.

To see lowercase just change chunk to chunk.lower() within ax.text().

    import matplotlib.pyplot as plt
    import matplotlib.patheffects as path_effects

    plt.figure(figsize=(15, 10))
    ax = plt.axes()

    text_chunks = ['A B C D E F G',
                   'H I J K L M N',
                   'O P Q R S T U',
                   'V W X Y Z ']

    font_size = 100

    for i, chunk in enumerate(text_chunks):
        text = ax.text(x=0.05, y=(0.8 - i*0.2), s=chunk, fontdict={'ha': 'left',
                                                                   'va': 'center',
                                                                   'size':100,
                                                                   'color': 'white'})

        text.set_path_effects([path_effects.Stroke(linewidth=font_size/6,
                                                   foreground='black'),
                               path_effects.Normal()])

    plt.xlim(0, 1)
    plt.ylim(0, 1)
  • If this is an image generation bug attach a screenshot demonstrating the issue.

image

image

  • If this is a regression (Used to work in an earlier version of Matplotlib), please
    note where it used to work.

unknown

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup