-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[ENH]: Make it so that linestyle works the same way as color when plotting several bars, lines, scatter points, etc. #23222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Some parameters are dealt with here and a cycler is created which is used to loop over for each rectangle patch: matplotlib/lib/matplotlib/axes/_axes.py Lines 2381 to 2392 in 8e2987b
The remaining parameters are added to the rectangle patch here: matplotlib/lib/matplotlib/axes/_axes.py Line 2430 in 8e2987b
I see two possible solutions:
I'll take this into consideration in #23056 and see if something can be done to make simplify this procedure. |
I think it has been a design mistake that Therefore I suggest not to expand further in this direction. We generally don't want trivial vectorization on the methods as that increases implementation complexity.
seems simple enough. |
@AndreasBugten thanks for the suggestion. As laid out in the comment above, I don't want to expand the |
Problem
Hello!
I am trying to plot a series of bars within a bar plot, and I want each bar to have its own color and linestyle. I intend to achieve this by using a list of colors, and a list of linestyles, and then simply plot the bars and set the color and linestyle to their respective lists. This works for color, but not for linestyle, since the linestyle function does not recognize a list as input.
Below I have two code snippets, and their respective outputs, which highlights the problem.
First, without using linestyle:

Then, using linestyle:

I have checked that all of the linestyles are compatible with the plt.bar function.
Proposed solution
No response
The text was updated successfully, but these errors were encountered: