Skip to content

Documentation for withStroke #7064

Closed
Closed

Description

@magnunor

I was trying to figure out how to avoid gaps in "borders" around text, as explained in https://stackoverflow.com/questions/39391592/gaps-in-border-around-text

Tryph found the solution, and posted it in the answers there. So I'm thinking it would be useful to improve the doc-string and/or documentation for matplotlib.patheffects.withStroke (https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/patheffects.py#L177).

I'm happy to do this, but I'm wondering what would be the best place to add some info about it? I'm guessing the doc-strings themselves, and possible somewhere in the documentation?

Activity

  1. tacaswell commented on Sep 8, 2016

    @tacaswell
    Member

    The docstring would be a good place as would http://matplotlib.org/devdocs/users/patheffects_guide.html (which is sourced from https://github.com/matplotlib/matplotlib/blob/master/doc/users/patheffects_guide.rst)

    Thanks for taking this on, we ❤️ documentation extensions / fixes!

  2. added this to the milestone on Sep 8, 2016
  3. magnunor commented on Sep 8, 2016

    @magnunor
    ContributorAuthor

    Sounds good!

    I'm a little bit confused about the relation between:

    Since both work similarly, except Stroke gives thicker lines, given the same linewidth:

    import matplotlib.pyplot as plt
    import matplotlib.patheffects as patheffects
    
    fig, axarr = plt.subplots(2)
    axarr[0].text(
            0.1, 0.5, "test: S6",
            color='white',
            fontsize=90,
            path_effects=[patheffects.withStroke(linewidth=13, foreground='black', capstyle="round")])
    axarr[1].text(
            0.1, 0.5, "test: S6",
            color='white',
            fontsize=90,
            path_effects=[patheffects.Stroke(linewidth=13, foreground='black', capstyle="round")])
    fig.savefig("text_stroke.png")

    text_stroke

  4. rougier commented on Sep 21, 2016

    @rougier
    Member

    From the image it seems that the first goes outside the shape only while the second goes both ways.

  5. Kojoley commented on Sep 21, 2016

    @Kojoley
    Member

    From the image it seems that the first goes outside the shape only while the second goes both ways.

    On the second image there is no actual text, only stroke.

    http://matplotlib.org/api/patheffects_api.html#matplotlib.patheffects.withStroke

    Adds a simple Stroke and then draws the original Artist to avoid needing to call Normal.

  6. rougier commented on Sep 21, 2016

    @rougier
    Member

    Thanks for the precision.

  7. modified the milestones: , on May 3, 2017
  8. modified the milestones: , on Oct 9, 2017
  9. QuLogic commented on Feb 3, 2021

    @QuLogic
    Member

    #15515 added consistent docs on all with* effects, since they are all generated from the base effect.

  10. modified the milestones: needs sorting, v3.3.0 on Feb 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions