Skip to content

default value of lines.dash_capstyle #7174

Closed

Description

@tacaswell

In #7087 @rougier asked about changing the default dash_capstyle to 'round'. This is what it would look like on top of the rest of the changes.

so

import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from cycler import cycler

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(6, 3))

N = 15

x = np.arange(N)
y = np.ones_like(x)

sty_cycle = (cycler('ls', ['--' ,':', '-.']) *
             cycler('lw', [None, 1, 2, 5]))

classic = {'lines.dash_capstyle': 'butt'}

v2 = {'lines.dash_capstyle': 'round'}

def demo(ax, rcparams, title):
    ax.axis('off')
    ax.set_title(title)
    with mpl.rc_context(rc=rcparams):
        for j, sty in enumerate(sty_cycle):
            ax.plot(x, y + j, **sty)

demo(ax1, classic, 'v2.0')
demo(ax2, {}, 'v2.0 + rounded')

I am not a huge fan of the rounded caps, it is barely noticeable at small line widths and looks worse at large linewidths (IMO).

It would also require re-doing the dash patterns.

Activity

  1. added this to the milestone on Sep 25, 2016
  2. rougier commented on Sep 25, 2016

    @rougier
    Member

    Note also that dots with cap are not round. Does that mean the default is "butt" cap (= no cap) and not "square" ?

  3. tacaswell commented on Sep 25, 2016

    @tacaswell
    MemberAuthor

    Yes, the current default is 'butt'

  4. rougier commented on Sep 25, 2016

    @rougier
    Member

    Maybe square would a better option such that when you replace square caps with round caps, you get actual dot. But this would mean changing all the dash styles I imagine.

  5. efiring commented on Sep 25, 2016

    @efiring
    Member

    An advantage of butt is that it means the line from A to B actually goes exactly from A to B--it doesn't overshoot by half the line thickness. I don't see any advantage to square caps, only disadvantages. I think that under some circumstances the round caps might look better, but this is not worth the fuss of changing combined with the disadvantages under other circumstances. I recommend that we close this now.

  6. dopplershift commented on Oct 10, 2016

    @dopplershift
    Contributor

    I agree with @efiring -- it's about having the clearest and most useful visualization with good aesthetics by default. The caps obscure the end points of a line, so we should leave those to users who can justify to themselves the need for "pretty" over exactness.

  7. NelleV commented on Oct 10, 2016

    @NelleV
    Member

    There seems to be a consensus that butt is better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions