Skip to content

How to use make_addplot with a new y AND x axis? #518

New issue

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

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

Already on GitHub? # to your account

Open
Effysan opened this issue Mar 29, 2022 · 4 comments
Open

How to use make_addplot with a new y AND x axis? #518

Effysan opened this issue Mar 29, 2022 · 4 comments
Labels
question Further information is requested

Comments

@Effysan
Copy link

Effysan commented Mar 29, 2022

I need to be able to place dots freely on top of a candlestick chart. How can this be achieved?

@Effysan Effysan added the question Further information is requested label Mar 29, 2022
@DanielGoldfarb
Copy link
Collaborator

DanielGoldfarb commented Mar 29, 2022

The ability to have multiple y-axes, and the ability to place markers above, below, or around candles, is demonstrated clearly in the additional plots tutorial. Please take the 5 or 10 minutes needed to read through the entire tutorial.

(after reading through the entire addplot tutorial and trying that approach, then, for additional ideas, see this multiple scatter markers example and also issue #97.)


Time (the x-axis) is always shared between all panels.

If you really want to have multiple time axes in the same plot, you will have to gain access to the Figure and Axes objects and create your own Axes object that has a different time axis. If this is really what you want, please explain why; perhaps if I understand your final goal then I can suggest the best way to acheive that.

@Effysan
Copy link
Author

Effysan commented Mar 30, 2022

Thank you for the fast and in-depth response Daniel.

I have indeed read the additional plots tutorial.

The use-case for my request is as follows:
I am plotting a candlestick graph, with 2 moving averages displayed.
I wish to mark every intersection of these 2 moving averages with a dot, which I am attempting to do by adding a scatter graph ontop of the candlestick graph, with make_addplot.
Naturally, the points of intersection can appear at any x value.
The issue is, of course, that I am not able to freely place markers/scatter dots on the graph.
Any suggestion would be greatly appreciated(:

I will look into the suggesting "Gain access to the Figure and Axes objects".
Thank you(:

PS. An additional question (that would also solve my problem):
Is there a way to plot an individual market/dot at a single point, on top of a candlestick graph?

@DanielGoldfarb
Copy link
Collaborator

OK. As I understand it now you want to be able to plot points for which the x-value is at any datetime on the x-axis, even if that datetime falls between two rows of you DataFrame (effectively interpolating between rows).

This can be done, but it can be quite tricky (for reasons that I will explain). A little too busy right now to provide the details. Hope to get back to you in a day or two.

@Effysan
Copy link
Author

Effysan commented Mar 31, 2022

Exactly right!

No worries at all Daniel, thank you for this response.

Your time is clearly valuable, and I by no means expect your response to be a detailed walkthrough.
A simple point in the right direction would be more than enough.

Thanks again(:

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants