F
F
FallenBelyash2020-05-23 00:23:56
Python
FallenBelyash, 2020-05-23 00:23:56

How to change color of barplot, barh depending on values ​​in dataframe column?

Hello. I am building several graphs - horizontal barplots (specifically - 15) in matplotlib, x, y values ​​​​are columns from the dataframe. It is necessary to make the color of the charts change depending on the values ​​in another column of the same dataframe, and add the corresponding legend. I don't understand how to do this in my loop.
5ec842c7ed44b151990843.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lightmanLP, 2020-05-23
@lightmanLP

Implementing this in a loop is a bad idea. Break the program into functions.
Well, if you can’t do it right, then you can come up with something with dict. But for this you need more specifics about the choice of color.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question