Data cursor on a line plot in python - python

I am new to python and am looking for a similar feature found in MATLAB. Its called data cursors in signal processing toolbox and I want to use a pre-existing or build a similar one.
The idea is to get a data line which when moved with a mouse and shows the data point of the plotted graph. Linked with the x-axis of the other subplots we can see the data matching of other graphs too.
Is this achievable in python?

Related

Update source data through chart in Python

Is there any way in Python to modify the source data by moving data points in the chart?
This is intended to work in streamlit: I'd like to make it convenient for users to edit multiple parameters of the same kind visually changing the curve which represents series of parameters and their corresponding value. As far as I know, streamlit currently supports Matplotlib, Plotly, Altair, Bokeh, Vega Lite, Deck.GL, dagre-d3 charts, but not sure whether any of those libraries provide this functionality.

Any Interactive way to manipulate plot data using python ?

Is there any way using python to edit/manipulate a data interactively? That is I want to plot the data and edit the data by dragging the data points in plot by mouse. Is it possible to do this in python?
I want something like this manipulate-chart-data-with-mouse.
I would suggest using dash.
This link gives an example of making an editable plot similar to your requirements.

Paraview programmatically plot quantities over line, using only data on nodes

I have a dataset on a 2D domain.
I mean to get an XY plot of data along a line which contains a number of element edges.
I would typically do this with PlotOverLine.
Now I want to obtain a similar plot, but with my data points located only at the actual locations of nodes in my mesh.
In this way, my XY plot (and its underlying data) would be directly representative of the mesh resolution in my original data.
How can this be done programmatically, 1) from the UI as a macro, 2) from the UI at the python shell, 3) at the CLI (pvpython myscript.py)?
I couldn't even find how to do this via GUI.
I started by Select Points On, but I couldn't go any further.
Moreover, if this is the right way to start, I wouldn't be able to transfer it to python code, since Start Trace does not include Select Points On in the output trace, so I wouldn't know how to add it to code.
PS: This resembles the procedure in Abaqus whereby one defines a Path based on an arbitrary set of points (which can be nodes, e.g.) and then plots a given quantity along that path.

How to remove renderers from a plot?

I'm experimenting with Bokeh server. I have a document with three figures and I'm trying to update two of them depending on the selection I perform on the third. The number of lines to plot in the two figures changes every time.
If I could use multi_line, this would be trivial: I would change the xs and ys in the data_source of the multi_line.
Alas, I need to use multiple scatter plots because multi_line does not support hover and I need it.
So, what I would like to accomplish is to clear the two plots every time I select something in the third, and display the scatter plots corresponding to the new selection.
There are a few possible workarounds, of course (appending scatter points to have a single GlyphRenderer with all scatter plots together, for example, but this would mean using very clunky ways to send the right hover message...). But if it was possible to just clear and update single figures, everything would be cleaner. I couldn't find anything in the docs, however.
I have read the thread you created on the mailing list and this other thread where Bryan says:
Technically, glyph renderers are stored in the .renderers property of
Plots, but I would not recommend rooting around there by hand.
Specifically the "Continuous Updating" notebook I linked earlier has
an example of updating both the data and appearance of an existing
glyph using python and push_notebook. There is not any easy way to remove glyphs at the moment,
other options would be:
recreate a new plot
set the glyph to be invisble
update the glyphs data
So it seems they are the only solutions at the moment

How to draw a graph that can indicate the values when the mouse moves to some part of the graph in python and put it on the web page?

I'm writing a web interface for a database of genes values of some experiments with CGI in Python and I want to draw a graph for the data queried. I'm using matplotlib.pyplot, draw a graph, save it, and perform it on the web page. But usually there are many experiments queried hence there are a lot of values. Sometimes I want to know which experiment does one value belong to because it's a big value, whereas it's hard to identify because the picture is small in size. The names of the experiments are long strings so that it will mess the x axis if I put all the experiment names on the x axis.
So I wonder if there is a way to draw a graph that can interact with users, i.e. if I point my mouse to some part on the graph, there would be one small window appears and tells me the exact value and what is the experiment name here. And the most important is, I can use this function when I put the graph on the web page.
Thank you.
What you want is basically D3.js rendering of your plots. As far as I know, there are currently three great ways of achieving this, all under rapid development:
MPLD3 for creating graphs with Matplotlib and serving them as interactive web graphics (see examples in Jake's blog post).
Plotly where you can either generate the plots directly via Plotly or from Matplotlib figures (e.g. using matplotlylib) and have them served by Plotly.
Bokeh if you do not mind moving away from Matplotlib.

Categories

Resources