Skip to content

Histogram with histtype='step' dows not respect lines.linewidth  #4065

Closed

Description

@maxnoe

hist with histtype=step ignores the lines.linewidth rcParam.

Activity

  1. tacaswell commented on Feb 6, 2015

    @tacaswell
    Member

    This is because hist use a Patch object to draw the stepped histogram, not a Line2D object.

    I would suggest not using hist and instead use np.histogram + ax.step

    vals, bins = np.histogram(..)
    ax.step(bins[:-1], vals, where='post')

    which should be aware of that rcparam.

  2. maxnoe commented on Feb 6, 2015

    @maxnoe
    ContributorAuthor

    Ah ok. So it does respect patch.linewidth.

  3. anntzer commented on Sep 17, 2015

    @anntzer
    Contributor

    I would like to suggest switching to using ax.step internally to plot such histograms, so that lines.linewidth gets respected (I think it makes sense e.g. for seaborn to set a relatively small patch.linewidth but a large lines.linewidth).

  4. tacaswell commented on Sep 17, 2015

    @tacaswell
    Member

    @anntzer No, because then the return typo of hist would depend on a kwarg which is really bad form.

  5. anntzer commented on Sep 17, 2015

    @anntzer
    Contributor

    Fair enough, reopened on seaborn's side as mwaskom/seaborn#704.

  6. anntzer commented on Oct 8, 2015

    @anntzer
    Contributor

    Reporting an idea that had been shot down on seaborn's side:
    What about having hist locally patch rcParams to set patch.linewidth to lines.linewidth when making the plot? I still think the current behavior is unintuitive.

  7. tacaswell commented on Oct 8, 2015

    @tacaswell
    Member

    👎 on that from me as well.

    If something like that were to happen, the right place would be for seaborn to wrap hist and then use the style context manager to locally over-ride the rcparams.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions