0

enter image description here

My data looks like this with about 922 entries and is a pandas dataframe with the name df_creation_time. I now want to create a barchart from this where this data is represented in a chart with different colors per bar, representing the Type. So first I have to sum the amount of times a Type appears at a given day at a certain hour. I did that with df_creation_time.value_counts() which gives me this:

enter image description here

Now what i need in the end is it to look like this

enter image description here

But I just cant seem to find a way for it to keep data from the same day in the same bar just with different colors. I asked this question already but I very poorly stated my problem and explained what i really wanted so I am trying this again here. I will propably reply within minutes to any comments or potential answeres. Hope to get this solved today :)

Pasgru
  • 25
  • 7
  • With seaborn, the approach would be `sns.countplot(data=df_creation_time, x='CREATION_TIME', hue='Type')`. But seaborn won't stack the bars, only dodging (or putting them on the same spot with transparency). – JohanC Feb 04 '22 at 22:13
  • 1
    Does this answer your question? [stacked bar plot using matplotlib](https://stackoverflow.com/questions/44309507/stacked-bar-plot-using-matplotlib) – Ahmed Elashry Feb 04 '22 at 22:16
  • @AhmedElashry might be the solution, looks like I have to split my data by Type first. And as I have to do this whole thing 4 times because I have in total 4 timestamps (Creation Time, Time at Station 2, at Station 3, Finished) this looks like a very tedious process. But if I cant find anything else I will try it – Pasgru Feb 04 '22 at 22:26
  • once you figure out how to do it, the rest is just a for-loop. You can add more details to the question if you could not do it and I will be gad to help. – Ahmed Elashry Feb 04 '22 at 22:30
  • There is not a lot more to my data. Just 3 more columns like Creation Time that display times of different stations in the process. Its about 3 different products that fo trough an assembly line – Pasgru Feb 04 '22 at 22:53

0 Answers0