I have a dataframe df in which the column extracted_day consists of dates ranging between 2022-05-08 to 2022-05-12. I have another column named gas_price, which consists of the price of the gas. 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.

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

  • $\begingroup$ I might be misunderstanding what you're looking for, but does the plot you currently have not show what you want? In other words, what is still missing from your current plot? $\endgroup$
    – Oxbowerce
    May 13 at 14:40
  • $\begingroup$ @Oxbowerce The current plot basically plots the density (the number of readings that lie in the range given by the x axis). My requrement 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. $\endgroup$
    – Anwesa Roy
    May 14 at 5:18


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.