Hello all,
I am trying to plot and analyze the data using matplotlib library as well as plotly. The requirement is as below image (image is from a different app):
Details of the plot shown in the image is as follows:
- X axis is time
- Multiple Y axis for each data (temperature)
- There are 2 cursors - Cursor A and Cursor B
- Tooltips for each signal can be seen at Cursor A and Cursor B
- Time Difference between Cursor A and Cursor B can also be seen
- Both X-axis and Y-axis is interactive
I am checking multiple libraries (matplotlib, plotly & seaborn) in python but unable to find a library which can render the plot/graph similar to the image above.
Expectation:
- Plot the data from .csv, .mf4, .dat etcโฆ similar to the above image
- Have multiple y axis that is interactive
- Have 2 cursor
- Tooltips for each signal at the place of cursor
I have tried using following lines of code:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.widgets import Cursor
from matplotlib.widgets import MultiCursor
x1 = np.random.randint(0, 10, 10)
y1 = np.random.randint(0, 10, 10)
x2 = np.random.rand(10)
y2 = np.random.rand(10)
x3 = np.random.randn(10)
y3 = np.random.randn(10)
fig, ax = plt.subplots(nrows = 1, ncols = 1, sharex = "col")
twin1 = ax.twinx()
twin1.spines["left"].set_position(("axes", 1))
p1, = ax.plot(x1, y1, "C0", label = "x1y1")
ax.set_xlabel("x1")
ax.set_ylabel("y1")
p2, = ax.plot(x2, y2, "C1", label = "x2y2")
ax.set_xlabel("x2")
ax.set_ylabel("y2")
p3, = twin1.plot(x3, y3, "C3", label = "x3y3")
twin1.set_xlabel("x3")
twin1.set_ylabel("y3")
cursor = MultiCursor(fig.canvas, (ax, twin1), vertOn = True, horizOn = False, color = 'red', linewidth = "3")
ax.legend(loc = "upper left")
twin1.legend(loc = "upper right")
plt.tight_layout()
With the above code I am getting a plot (tried with matplotlib) as below, which is not as per my requirement:
Can anyone please suggest whether any method is available to achieve the requirement (as shown in first image) with plotly? Thank you in advance.