I have a dataframe df in which the column extracted_day consists of dates ranging between 2022-05-08 to 2022-05-12. There is another column named gas_price, which consists of the price of the gas. There is also a column named minutes_elapsed_from_the_start_of_the_day which consists of how many minutes elapsed throughout the day. I want to construct a joyplot such that for each date, it shows the gas_price in the y axis and has minutes_elapsed_from_start_of_day in the x axis. We may also use ridgeplot or any other plot if this doesn't work.

enter image description here

This is the code that I have written, but it doesn't serve my purpose because it plots the density (the number of readings that lie in the range given by the x axis). My requirement is that the y axis should consist of the gas_price and the x axis should consist of minutes_elapsed_from_the_start_of_the_day.

from joypy import joyplot
import matplotlib.pyplot as plt
df['extracted_day'] = df['extracted_day'].astype(str)
joyplot(df, by = 'extracted_day', column = 'minutes_elapsed_from_start_of_day',figsize=(14,10))
plt.xlabel("Number of minutes elapsed throughout the day")

enter image description here

New contributor
Anwesa Roy is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • $\begingroup$ Programming issues are off-topic here. We focus on the theoretical and philosophical aspects of AI. Ask your question on Stack Overflow. $\endgroup$
    – nbro
    May 14 at 11:16


Browse other questions tagged .