[Question] Is it possible to use the library to plot timeseries (non-KDE) data? #214
-
I'm trying to understand whether I can reproduce a plot that I made in matplotlib also in plotly. The plot is a ridgeline-like plot but instead of plotting KDEs I'm just representing the evolution of snow depth at a certain station over the winter (for different seasons). So, the plot has basically the same logic of a ridgeline plot but instead of computing and plotting a KDE I only have to plot the timeseries. The way I achieved this in matplotlib was to just use subplots and plot in every axis a simple line plot with filled area. I then removed any background and reduced the vertical padding so that the different plots overlap a little bit. All the axes share the same xrange and yrange. Is this library flexible enough to allow something like that or is that not possible at all? Are you using the violin plot method under the hood? Thanks :) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @guidocioni ! Nice example! 👍 And yes, you can currently do this with the library! You need to use the (perhaps not very intuitively named) Here's a very basic example: from ridgeplot import ridgeplot
fig = ridgeplot(
densities=[
[(0, 0), (1, 1), (2, 0)], # 2021-2022
[(1, 0), (2, 1), (3, 0)], # 2022-2023
[(2, 0), (3, 1), (4, 0)], # 2023-2024
],
labels=["2021-2022", "2022-2023", "2023-2024"],
)
fig.show() ![]() |
Beta Was this translation helpful? Give feedback.
-
I'm closing for now, will reopen if I find any issue while doing this :) |
Beta Was this translation helpful? Give feedback.
Hi @guidocioni ! Nice example! 👍
And yes, you can currently do this with the library!
You need to use the (perhaps not very intuitively named)
densities
parameter. For your use case, you should pass it in a shallow format.Here's a very basic example: