Skip to content

Borders appear only for the first bar in the bar plot. #9820

Closed

Description

@guziy

Bug report

Only the first bar in barplot has border when edgecolor is a single value.

Bug summary

Code for reproduction

import matplotlib.pyplot as plt


def main():

    fig = plt.figure()
    ax = plt.gca()

    data = list(range(5, 10))

    ax.bar(data, data, width=0.5, align="edge", linewidth=2,
           edgecolor="k", facecolor="m")

    plt.show()


if __name__ == '__main__':
    main()

Actual outcome
screen shot 2017-11-20 at 15 50 34

Expected outcome

screen shot 2017-11-20 at 15 51 51

I can work around the issue by specifying a list of edgecolors and linewidths for each bar. Specifying only the list of linewidths for each bar and leaving one value for the edgecolor would only show a border of the first bar due to this code in the Patch.draw:

        lw = self._linewidth
        if self._edgecolor[3] == 0:
            lw = 0

Matplotlib version

  • Operating system: Linux
  • Matplotlib version: 2.1.0
  • Matplotlib backend (print(matplotlib.get_backend())): TkAgg
  • Python version: Python 3.6.2

I installed matplotlib using conda. But I am not sure from which channel.

Activity

  1. guziy commented on Nov 20, 2017

    @guziy
    Author

    I could try to fix it if someone confirms that this is not intended behavior))

    Cheers

  2. jklymak commented on Nov 20, 2017

    @jklymak
    Member

    It’s a duplicate report and fixed in master

  3. guziy commented on Nov 20, 2017

    @guziy
    Author

    Ah, sorry))

    Closing it then

  4. jklymak commented on Nov 20, 2017

    @jklymak
    Member

    #9351, #9818, #9808 fixed by #9353 ;-)

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