broken graph with nan values

641 views
Skip to first unread message

dennis engel

unread,
Jan 3, 2016, 4:33:09 PM1/3/16
to pyqtgraph
Is it possible to create a broken plot with nan values like this example in matplotlib (http://matplotlib.org/examples/pylab_examples/nan_test.html) ?
If i do the same with pyqtgraph it draws a line at the nan section, but it should be a gap.

has anybody a workaround ?

Thanks 

Dennis

vas...@gmail.com

unread,
Jan 3, 2016, 5:35:00 PM1/3/16
to pyqt...@googlegroups.com
You can try to implement something like in my answer from 10/25/15 in the topic "Discontinuous line plot?". You need to move up-down your cursor and later move it left out of a displayed window to make a line breaks.
Basically: when any nan (or moving out of window in that case) happened, one line plot (and array) is ended and then generate a new plot (and array) on the same graph. I am not sure how to send you a direct link, but the attached file is called "discontinuous_line_plot.py".

--
You received this message because you are subscribed to the Google Groups "pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyqtgraph+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/a00effc4-5776-4c33-b12c-2fcb1fde4b46%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

dennis engel

unread,
Jan 12, 2016, 11:05:43 AM1/12/16
to pyqtgraph

After the holidavs, I 've tried it. But "discontinuous_line_plot.py" doesn't work for me. It draws no gaps on my systems. So it read the PlotDataItem.py documentation and file and found a solution that's working for me.
The solution is the "connect" paramter. It can be "all", "pair" or a array. 

ipython Commandline example:
import pyqtgraph as pg
import numpy as np
pg.plot(np.random.normal(size=10), connect=np.array([1,1,1,1,0,0,1,1,1,1]))

A added a example file for updating a graph.

Have Fun

Dennis

plot.py
Reply all
Reply to author
Forward
0 new messages