Skip to content

default value of lines.dash_capstyle #7174

Closed
@tacaswell

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions