Skip to content

[Question] Is it possible to use the library to plot timeseries (non-KDE) data? #170

Closed

Description

@guidocioni

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).

8fdf10ad-d197-40a4-8572-9dd631fb351b

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 :)

Activity

  1. tpvasconcelos commented on Jan 25, 2024

    @tpvasconcelos
    Owner

    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:

    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()
    image
  2. guidocioni commented on Jan 25, 2024

    @guidocioni
    Author

    I'm closing for now, will reopen if I find any issue while doing this :)

  3. Repository owner locked and limited conversation to collaborators on Oct 8, 2024
  4. converted this issue into a discussion #214 on Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions