Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW FEATURE]: Lollipop plot #46

Open
PauBadiaM opened this issue Sep 10, 2024 · 2 comments
Open

[NEW FEATURE]: Lollipop plot #46

PauBadiaM opened this issue Sep 10, 2024 · 2 comments

Comments

@PauBadiaM
Copy link

PauBadiaM commented Sep 10, 2024

New Plotter

Hi @Mr-Milk,

I see that marsilea is taking off, congrats! ;) Would it be possible to add Lollipop plots, such as these:
image

I have tried using an Area and Range plotter but I cannot seem to be able to indicate the Range plotter the exact position. Here is an example:

import numpy as np
import matplotlib.pyplot as plt
from marsilea.plotter import Area, Range

data = np.array([
    [0.        , 0.60269096],
    [1.        , 0.46828727],
    [2.        , 0.40277137],
    [3.        , 0.38755981],
    [4.        , 0.36966192],
    [5.        , 0.28196691],
    [6.        , 0.09663924],
    [7.        , 0.08940182],
    [8.        , 0.        ],
    [9.        , 0.        ]
])

subdata = data[[3, 6, 9], :]

_, ax = plt.subplots(figsize=(4, 2), dpi=150)
Area(data[:, 1]).render(ax)
Range(subdata).render(ax)

image

Sorry if this is something that can already be done. Thank you for your time!

Proposed solution

It could be a modified Range plotter, but with the ability to specify the specific x or y position.

@Mr-Milk
Copy link
Member

Mr-Milk commented Sep 10, 2024

Thank you! I'm open to adding a Lollipop plot as a new plotter. What you showed doesn't seem like a standard lollipop? But I'm not sure of its definition. It would be great if you could have a better name that doesn't confuse people.

In terms of a quick solution, it should be quite easy to implement a workable plotter yourself, please check https://marsilea.readthedocs.io/en/stable/tutorial/new_renderplan.html.
I can help you if you have any questions.

@PauBadiaM
Copy link
Author

Oh wow I completely missed this! I will have a look and do a PR eventually, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants