Git Product home page Git Product logo

pglive's People

Contributors

domarm-comat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pglive's Issues

LiveAxisRange Multiple Plots Auto range if plot turned off.

Is LiveAxisRange supposed to work with multiple plots?
if you turn one of the plots off with the legend the "A" autorange breaks and plots disappear.

    PV1watts_plot = LiveLinePlot(pen='orange',name='PV-1',fillLevel=0, brush=(213,129,44,100))
    PV2watts_plot = LiveLinePlot(pen='cyan',name='PV-2', fillLevel=0, brush=(102,102,255,100))

    # Data connectors for each plot with dequeue of max_points
    self.PV1watts_connector = DataConnector(PV1watts_plot, max_points=48000) 
    self.PV2watts_connector = DataConnector(PV2watts_plot, max_points=48000) 


    # Setup bottom axis with TIME tick format
    # use Axis.DATETIME to show date
    pv1_watts_bottom_axis = LiveAxis("bottom", **{Axis.TICK_FORMAT: Axis.TIME})

    # Create plot
    self.PV1_graph_Widget = LivePlotWidget(title="Charger 1 & 2 Watts 1 Hour of 24",
    axisItems={'bottom': pv1_watts_bottom_axis},
    x_range_controller=LiveAxisRange(roll_on_tick=1800, offset_left=1), **kwargs)

    self.PV1_graph_Widget.x_range_controller.crop_left_offset_to_data = True
    
  
    # Show grid
    self.PV1_graph_Widget.showGrid(x=True, y=True, alpha=0.3)

    # Set labels
    self.PV1_graph_Widget.setLabel('bottom')
    self.PV1_graph_Widget.setLabel('left', 'Watts')

    self.PV1_graph_Widget.addLegend() # If plot is named, auto add name to legend

    # Add Line
    self.PV1_graph_Widget.addItem(PV1watts_plot)
    self.PV1_graph_Widget.addItem(PV2watts_plot)

    # Add chart to Layout in Qt Designer
    self.PV1_Watts_Layout.addWidget(self.PV1_graph_Widget)

Bug or Feature? LivePlotWidget "bottom" axis ticks labels disappear if string is more than simple one liner

Hello,
First, thank you for pglive. DataConnector is very cool!

To determine if pglive will work for my project needs, I am trying to implement your LivePlotWidget with a barchart such that the bottom axis labels are like those shown below from another plotter I wrote just using pyqtgraph.

image

However, LivePlotWidget refuses to show any tick labels if the string has more than two vertical elements.

For context, I am building the bottom axis in the image above using simple string formatting like so...
listOfBottomTuples = [ [ (i, '\n%s\n↑ %d,%d\nμ %d,%d\n↓ %d,%d\nσ %d,%d\n' % (str(i),aLMax,aUMax,aLMean,aUMean,aLMin,aUMin,aLStd,aUStd) if i == 1 else '\n%s\n%d,%d\n%d,%d\n%d,%d\n%d,%d\n' % (str(i),aLMax,aUMax,aLMean,aUMean,aLMin,aUMin,aLStd,aUStd)) for i,aLMax,aUMax,aLMean,aUMean,aLMin,aUMin,aLStd,aUStd in values ] ]
It's brute force but works just fine for a plotter that updates once per second in the other plotter tool I wrote.

I can create a simple list of tuples containing channel numbers and that works just fine. But it does not like more than that as labels and it appears that the space between the tick labels and axis label is fixed. Below is my implementation of your LivePlotWidget where you can see the most I can put in the tick labels before it shows nothing. It just so happens that the tick labels are just down to where the axis label 'Lane' sits.

image

When it refuses, it looks like this...

image

Am I incorrect in thinking that the space between tick labels and axis label should grow automatically like it does in pyqtgraph native plotWidget? If this is not a bug and instead just me being an idiot, then please point me in the right direction.

Thank you in advance.
Brian

Placing the widget into an existing window

Thanks for making this.
Using your examples I can make a stand alone window with my live data and it looks and works great.

I am having difficulty placing the widget into an existing window made with PYQT designer.
I have promoted a Qwidget to a PlotWidget class but cannot figure out how to embed it into the promoted widget.

Can you include an example how this might be achieved?

Thank you.

How to append data from list or array

Hello,

First off I just want to say this package has been extremely useful, thanks to whoever put this together!

Is there a way to use cb_append_data_point with a list or array? I found cb_set_data works with lists, but I would like retain the existing data in the window similar to how to append_data_point function works.

So far I have tried iterating over the list with a for loop and appending each individual item, but the plot still only shows one value from the list. Any suggestions?

Custom ViewBox

is ViewBox implemented? and How can I get the ViewBox? I jusst want to modify the wheelEvent, and some other Events? but I can find out the method? and can you add numpy array to the options of input data format, it is seem run well with small data, but with a lager it have been slow down and lag, i think with numpy array will be more fast then list like current.

X and Y axis display scientific notation when value is zero and range contiues to increase.

Version 0.5.2

If I start my program and the current values are zero, the X and Y axis displays in scientific notation wheres the older version did not exhibit this trait.

It takes a few minuets (2 or 3) at a 1hz rate but the range just keeps increasing in both the positive and negative direction.

Old 0.3.3
0 3 3_Version

New 0.5.2
0 5 2_Version

I think the chart may correct with fresh values that are not zero but I thought you may find this report helpful.

Well, it seems to be happening with larger values as well. The autorange seems to be in a increasing runaway mode.

Understanding DataConnector update_rate and data append time

Hello,

I am currently working on a project that requires sampling packets of data at a high speed. For this example, I am sampling 8 channels of sensor data at 20kHz with a packet time of 6.4ms, downsampling the data to a small numpy array, and appending each channel using cb_append_data_array with list comprehension as shown below. The actual data I'm appending to each connector is a 1-D array with no more than 10 samples.

[connector.cb_append_data_array(np.ma.compressed(units[:, index]), np.ma.compressed(x_time[:, index])) for index, connector in enumerate(data_connectors)]

Right now I'm trying to reduce the CPU usage of my program, which is currently in the range of 40-50% when running a plot_rate of 15 Hz. With the code above commented out (not plotting any data), my CPU usage is <5% so pyqtgraph is using the majority of the CPU consumption.

I'm struggling to understand the effect of changing the DataConnector update_rate, I have found that if the value is set too low, some of the data is "dropped" and does not get plotted. If I set the value too high, does this negatively impact CPU usage? Where should this value be set?

Also, I have found the connector appending speed varies significantly, is this directly related to the update_rate setting?

image

Feature request: Add crosshair after LivePlotWidget constructor called

When using QtDesigner to design a GUI, the construction of the widgets is done in the generated UI class (if pyuic was used), which means that we don't have a chance to specify any constructor arguments if we don't touch that file.

So after looking through the source code a bit, I've found the only way to add a crosshair to a LivePlotWidget after construction is to do something like this:

widget.crosshair_enabled = True
widget._add_crosshair(pg.mkPen(color='red', width=1), {'color': 'green'})

But this clearly violates encapsulation. Shouldn't there be some way to add a crosshair after construction that would not require calling a privated method?

I believe this was the original motivation behind #13 as well.

.removeItem() interferes with auto-range

I can't tell if the problem is caused by pyqtgraph or pglive.

When I remove a plot with foo.removeItem(bar), it doesn't seem to be completely removed, so the auto-range display no longer works.

My condition is that the second plot is included in the auto-range as soon as it appears and excluded as soon as it is removed. This doesn't seem to work and I can't find a way to solve this problem.

I took the examples code and modified it slightly so that the problem is reproducible:

import sys
from math import sin
from threading import Thread
from time import sleep

from PySide6.QtWidgets import QApplication

from pglive.sources.data_connector import DataConnector
from pglive.sources.live_plot import LiveLinePlot
from pglive.sources.live_plot_widget import LivePlotWidget

"""
In this example Line plot is displayed.
"""
app = QApplication(sys.argv)
running = True

plot_widget = LivePlotWidget(title="Line Plot @ 100Hz")
plot_curve = LiveLinePlot()
plot_widget.addItem(plot_curve)
# DataConnector holding 600 points and plots @ 100Hz
data_connector = DataConnector(plot_curve, max_points=600, update_rate=100)

plot_curve2 = LiveLinePlot()
data_connector2 = DataConnector(plot_curve2, max_points=600, update_rate=100)
plot_widget.addItem(plot_curve2)

def sin_wave_generator(connector):
    """Sine wave generator"""
    x = 0
    while running:
        x += 1
        data_point = sin(x * 0.01)
        # Callback to plot new data point
        connector.cb_append_data_point(data_point, x)

        sleep(0.01)

def add_and_remove():
  # Wait two seconds before starting
  sleep(2)
  # Generate the second sine wave for three seconds
  x2 = 0
  while x2 <= 300:
    x2 += 1
    data_point = 2+sin(x2 * 0.01)
    # Callback to plot new data point
    data_connector2.cb_append_data_point(data_point, x2)
    sleep(0.01)
  # Remove the seconds sine wave
  plot_widget.removeItem(plot_curve2)
    
plot_widget.show()
Thread(target=sin_wave_generator, args=(data_connector,)).start()
Thread(target=add_and_remove, args=()).start()
app.exec()
running = False

Append data and set data difference

Hi, I am a little confused with cb_set_data and cb_append_data_point. Source code says, it "replaces current data" for cb_set_data, and "appends new data point" for cb_append_data_point. My understanding is that, when using cb_append_data_point, we can retain old data. For instance, if the plot widget is set to max_points of 600, the plot will start scrolling when it reaches max_points, but we will be able to pan and look at the past data if cb_append_data_point is used. Whereas, if we use cb_set_data, points in the view box will be replaced by a new set of data points when max_point is reached. Please let me know if this is correct. Thanks.

Formatting x axis timestamp for Axis.TIME

Hello,
After much trial and error I think I have found the problem with what I thought was a roll_on_tick issue (it was only a symptom of the timestamp issue).
It would seem that its related to my Axis.TIME time format.
prior to 0.6.9 I have formatted and used the timestamp as follows.

(relevant portions)

import time
MP_bottom_axis = LiveAxis("bottom", **{Axis.TICK_FORMAT: Axis.TIME})
timestamp = time.time()
self.Exterior_Temp_connector.cb_append_data_point(TempSensor3, timestamp)

This no longer works and it results in a chart that is zoomed out.
omitting the timestamp in the connector.cb_append_data_point, it displays fine but obviously the time is incorrect.

In all the examples you have provided, such as (live_plot_range.py) the time stamp always starts at 14:00

Can you provide an example to show how to update connector.cb_append_data_point with the time of the data update?

I can provide a more complete example if needed.

Roll on tick

Hello,

I spoke too soon before, it looks like there are still some issues with roll_on_tick. This time however, I took the time to write some code for you to reproduce the error, I made this program as similar as I could to how my data acquisition program actually functions.

When the sampling rate is increased higher than the plot rate, the roll on tick stops working properly. I believe this is because the appended array size is getting larger and larger and ticks are not getting counted properly.

When self.sampling_rate is set to 15 Hz, everything works as it should. When self.sampling_rate is increased to 200 Hz or over, it starts to noticeably lag:

import sys
import time
import threading
import numpy as np
from pglive.sources.data_connector import DataConnector
from pglive.sources.live_axis_range import LiveAxisRange
from pglive.sources.live_plot import LiveLinePlot
from pglive.sources.live_plot_widget import LivePlotWidget
from PySide6.QtWidgets import QApplication
import pyqtgraph as pg


class Window(pg.LayoutWidget):

    def __init__(self, parent=None):
        super().__init__(parent)

        self.plot_rate = 15  # sets the plot rate in Hz
        self.sampling_rate = 15  # sets the sampling rate in hz

        self.packet_size = 16  # sets the packet size in number of samples
        self.packet_time = self.packet_size / self.sampling_rate # sets the time between packets in seconds
        self.plot_slice_width = self.sampling_rate / self.plot_rate  # sets the length of the data array to be plotted

        self.connector_points = 100  # sets the connector size in number of points
        self.roll_on_tick = self.connector_points  # sets the roll on tick value

        self.time_list, self.amplitude_list = [], []  # initialize lists use to collect data
        self.time, self.amplitude = 0, 0  # initialize variables
        self.running = False

        plot_widget = LivePlotWidget(x_range_controller=LiveAxisRange(roll_on_tick=self.roll_on_tick))
        self.addWidget(plot_widget)
        plot_curve = LiveLinePlot()
        plot_widget.addItem(plot_curve)
        self.data_connector = DataConnector(plot_curve, max_points=self.connector_points, plot_rate=self.plot_rate)

    def generate_data(self):
        generation_loop = 0  # data generation loop counter
        while self.running:
            time.sleep(self.packet_time)

            if generation_loop == 0:
                self.time, step = np.linspace(0, generation_loop+1, self.packet_size, retstep=True)
            else:
                self.time, step = np.linspace(self.time[-1] + step, generation_loop+1, self.packet_size, retstep=True)

            self.amplitude = np.sin(self.time)

            self.time_list.extend(self.time)
            self.amplitude_list.extend(self.amplitude)

            generation_loop += 1

    def plot_data(self):
        plot_loop = 0  # plot loop counter
        while self.running:
            time.sleep(1/self.plot_rate)  # sleep at the same frequency as the plot rate
            if len(self.time_list) > plot_loop+1 * self.plot_slice_width:
                slice_start = int(plot_loop * self.plot_slice_width)
                slice_end = int((plot_loop + 1) * self.plot_slice_width)

                time_data = self.time_list[slice_start:slice_end]
                amplitude_data = self.amplitude_list[slice_start:slice_end]

                self.data_connector.cb_append_data_array(amplitude_data, time_data)

                plot_loop += 1

    def start_app(self):
        self.running = True
        threading.Thread(target=self.generate_data).start()
        threading.Thread(target=self.plot_data).start()


# Start application
app = QApplication(sys.argv)
window = Window()
window.show()
window.start_app()
app.exec()

Let me know if this sample code doesn't work for you and I can adjust it as needed

Feature request (continuation on the previous issue)

On another note, I am trying to incorporate pg.InfiniteLine and while it is possible, a certain amount of hacking is required.

  1. Non-standard data get/set
class InfLine(pg.InfiniteLine):
    def getData(self):
        x, y = self.getPos()
        print(f'{x=}, {y=}')
        return [x], [y]

    def setData(self, x, y):
        print(f'{x=}, {y=}')
        self.setPos((x[0], y[0]))
  1. Coming back to offsets and crop_left_offset_to_data
class LiveAxisRange:
    ...
    def get_x_range(self, data_connector, tick: int) -> List[float]:
        ...
        x, _ = data_connector.plot.getData()
        final_range = self._get_range(axis_range, tick, (self.offset_left, self.offset_right))
        offset_x = data_connector.plot.pos().x()
        final_range[0] += offset_x
        final_range[1] += offset_x

offset_x == x # in InfiniteLine case

somehow, for roll_on_tick=0 in the LiveLinePlot case, it is 0
What is pos()? and why are you saying that position is offset?
It is a bit counterintuitive to say that position is an offset, if data = [54, 72], then offsetting by either min or max of it is ~doubling the range.

Finally found where pos(self) is defined - deep in https://pyqtgraph.readthedocs.io/en/latest/_modules/pyqtgraph/graphicsItems/GraphicsItem.html#GraphicsItem

And still didn't manage to get to the end of it:

    def pos(self):
        return Point(self._qtBaseClass.pos(self))

So I had to hack it further:

    def pos(self):
        p = SimpleNamespace()
        p.x = lambda: 0
        p.y = lambda: 0
        return p

So this is to get InfiniteLine working, however, the behaviour seems confusing to me in the simple line case as well.

Great library, by the way. Saved a lot of headaches with pyqtgraph not working out of the box.

Crosshair label not formatted

Not sure if its a bug or simply requires proper formatting on my part.
Using bottom_axis = LiveAxis("bottom", **{Axis.TICK_FORMAT: Axis.TIME})
the X crosshair is displayed in raw unformatted epoch time.

Can you suggest a way to format the X crosshair label when using tick format Time?

thank you

Poetry Update

Sorry to bother you again, but would it be possible to update poetry so this will work with Python 3.11?

How to clear data from DataConnector?

First off, cool project, I appreciate it!

I was trying to clear a graph that already had some existing data with a particular DataConnector that has a finite max_points, but I've tried setting the data using empty lists and it keeps complaining that NoneTypes are not subscriptable.

After reading the code a bit, I tried to clear the data with cb_set_data using 2 empty deques with my desired maxlen like this:

self.data_connector.cb_set_data(deque(maxlen=self.max_samples), deque(maxlen=self.max_samples))

But it still complained about the same problem.

Am I missing a way to clear plot data?

Question, possible issue

crop_offset_to_data.py

It seems to me, that offset_left only has an impact if roll_on_tick>1. What I need is to roll on every tick, but to still have nice padding, which is equal to max points. In other words, I do not want any wiggly features but to have a maximum refresh and view move rate.

Any way to do it?

Question: If using "Promoted Widget", How to add LivePlotWidget(title=...., axisItems=......, **kwargs)

I don't normally use a promoted widget but thought I would try it out in QT Designer.
Normally I create the widget manually.
If it's promoted and created in the QT Designer how do I add,
LivePlotWidget(title="Chart Title", axisItems={'bottom': bottom_axis}, **kwargs)

I can add title with .setLabels
I can add axisItems with .setAxisItems

Those are done with pyqtgraph options.
How do I add ** kwargs that recognize the pglive crosshairs?

Can it all be done with a one liner like I normally do with a widget created manually?

I know you're busy. Thanks for looking.

ValueError: operands could not be broadcast together with shapes (2,) (0,)

Hello, It's been awhile and working fine until I upgraded today to Ubuntu 22.04.3 LTS Jammy
Reinstalled Pglive and Pyqtgraph
No program changes have been made and now have an error when charts are updating.

Traceback (most recent call last):
File "/home/chromebox/.local/lib/python3.10/site-packages/pglive/sources/live_mixins.py", line 45, in slot_roll_tick
self.plot_widget.slot_roll_tick(data_connector, tick)
File "/home/chromebox/.local/lib/python3.10/site-packages/pglive/sources/live_plot_widget.py", line 215, in slot_roll_tick
final_x_range = self.x_range_controller.get_x_range(data_connector, tick)
File "/home/chromebox/.local/lib/python3.10/site-packages/pglive/sources/live_axis_range.py", line 30, in get_x_range
axis_range = [0, data_connector.plot.data_tick(ax=0)]
File "/home/chromebox/.local/lib/python3.10/site-packages/pglive/sources/live_categorized_bar_plot.py", line 126, in data_tick
if self.x_data == []:
ValueError: operands could not be broadcast together with shapes (2,) (0,)

Horizontal Bar chart with categories

Hello,

I have successfully been using PGlive for awhile now and love it.

Can PGlive do Horizontal Bar chart with categories like below?

Barchart

If so can you add some details to accomplish this?
Categories on the Y-axis and keep the time on the X-axis.

Thanks for a great charting app!

"cb_append_data_point" leads to runtime error if no existing points are present

I initialize a LiveLinePlot, which is passed to a DataConnector for later updating. On the first iteration where I try to add a datapoint through the connecter via cb_append_data_point I receive the following error:

/home/user/.local/lib/python3.10/site-packages/pyqtgraph/debug.py:128: RuntimeWarning: Ignored exception:
Traceback (most recent call last):
  File "/home/user/path/pysideGUI.py", line 1101, in <module>
    app.exec()
  File "/home/user/.local/lib/python3.10/site-packages/pglive/sources/live_plot_widget.py", line 165, in paintEvent
    return super().paintEvent(ev)
  File "/home/user/.local/lib/python3.10/site-packages/pyqtgraph/widgets/GraphicsView.py", line 137, in paintEvent
    return super().paintEvent(ev)
  File "/home/user/.local/lib/python3.10/site-packages/pyqtgraph/debug.py", line 128, in w
    printExc('Ignored exception:')
  --- exception caught here ---
  File "/home/user/.local/lib/python3.10/site-packages/pyqtgraph/debug.py", line 126, in w
    func(*args, **kwds)
  File "/home/user/.local/lib/python3.10/site-packages/pyqtgraph/graphicsItems/PlotCurveItem.py", line 905, in paint
    p.drawLines(*self._getLineSegments())
TypeError: QPainter.drawLines() takes exactly one argument (0 given)
  printExc('Ignored exception:')

I've found that checking for the presence of data in the x or y variable in the DataConnector and adding the first datapoint twice if there is none prevents the error from appearing. E.g.:

if len(connector.x) < 1:
  *add extra datapoint*
*add datapoint like normal*

It seems like there just needs to be an additional check somewhere(?)

Using:
Python 3.10
pglive 0.5.5

version 0.4.4 - after cb_set_data, x,y view range is not auto set. whereas it works perfectly in 0.3.3

Dear Sir,
I have been using pglive 0.3.3 and very much impressed with your work. Thank you very much for developing the module, it really simplifies the development effort to making pyqtgraph live. I use pglive for plotting live stock quote (just a live line plot, i have also tested candleplot too).

problem : I have recently updated the version to 0.4.4 and my previously working code is not usable now. I use livelineplot, and cb_set_data and cb_append_data_point to load initial data and append live data respectively. In the ver0.3.3, when the initial set of historical data is loaded using cb_set_data, the x,y axis view is is properly set and can see the plot (even if live data is unavailable). Whereas in the ver0.4.4, possibly because of introducing the x and y live axis controller, once initial data is set using cb_set_data , the plot view is blank. Note,I use datetime axis on X. Once cb_set_data command is issued, the x axis defaults to epoch (1970) and y axis is 0 to1. I am unable to autorange even by clicking the 'A' button of pyqtgraph which is on the bottom left.

However, once the live data arrives, the plot shows up in the view box. Please let me know the method to enable x,y auto range during normal conditions (i.e, prior to the arrival of live data). I need to view historical data sometimes, when the live tick is not available. Actually, I would like to know the autorange command just like we use for pg.PlotWidget so that i can enable it as and when the view changes. I do not want to use pg.PlotWidget commands like setXrange, setLimits etc beacuse it interferes with pglive auto range features during live tick plotting.

Support for "connect" attribute of pyqtgraph PlotDataItem/PlotCurveItem?

Per the pyqtgraph documentation it's possible to specify the connectivity of data points on a line plot via the PlotDataItem:

connect supports the following arguments:

- ‘all’ connects all points.- 
- ‘pairs’ generates lines between every other point.- 
- ‘finite’ creates a break when a nonfinite points is encountered.- 
- If an ndarray is passed, it should contain N int32 values of 0 or 1. Values of 1 indicate that the respective point will be connected to the next.- 
- In the default ‘auto’ mode, PlotDataItem will normally use ‘all’, but if any nonfinite data points are detected, it will automatically switch to ‘finite’.

The connect arg is also found in the PlotCurveItem.setData() function.

Is this supported in pglive? I haven't found anything for it so far.

Tick strings on the bottom axis overlaps with its label

Bottom axis tick strings do not seem to account for the drawing of axis labels. This could be recreated by changing line

win = LivePlotWidget(title="Vertical Bar Plot @ 100Hz")

to:

win = LivePlotWidget(title="Vertical Bar Plot @ 100Hz", labels={'bottom': ("hello"), 'left': ("hello")})

in vertical_bar_plot.py of examples. Here is what it looks like:

x-axis overlap

This does not seem to be a problem with other axes, just the bottom one.

TypeError: ufunc 'isfinite' not supported for the input types

I have several charts plotting data from several remote sources.
If the remote data generator reboots some of the remote resources come back online faster than others.
The source that generates the below error takes up to a minute longer than the rest.
The other charts seem to restart charting without a noticeable effect.

I dont know how to handle this error.
A try except block in the chart update does not work as expected.

Any Ideas?

Traceback (most recent call last):
File "/home/chromebox/.local/lib/python3.10/site-packages/pglive/sources/live_mixins.py", line 35, in slot_new_data
self.setData(x, y, **kwargs)
File "/home/chromebox/.local/lib/python3.10/site-packages/pyqtgraph/graphicsItems/PlotDataItem.py", line 819, in setData
self.updateItems( styleUpdate = self.property('styleWasChanged') )
File "/home/chromebox/.local/lib/python3.10/site-packages/pyqtgraph/graphicsItems/PlotDataItem.py", line 865, in updateItems
dataset = self._getDisplayDataset()
File "/home/chromebox/.local/lib/python3.10/site-packages/pyqtgraph/graphicsItems/PlotDataItem.py", line 1034, in _getDisplayDataset
data_range = self._datasetMapped.dataRect()
File "/home/chromebox/.local/lib/python3.10/site-packages/pyqtgraph/graphicsItems/PlotDataItem.py", line 84, in dataRect
self._updateDataRect()
File "/home/chromebox/.local/lib/python3.10/site-packages/pyqtgraph/graphicsItems/PlotDataItem.py", line 58, in _updateDataRect
selection = np.isfinite(self.y) # We are looking for the bounds of the plottable data set. Infinite and Nan are ignored.
TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

Question: Autoscale plots when legend item is turned off

I cant determine if this is a pyqtgraph function or PGlive.

A graph with multiple plots and a legend.
If you click an item in the legend box its plot is turned off in the graph. (its still collecting data)

What I have is three plots with what can be large variations in Y axis values.
I was hoping to autorange the remaining plots when a plot is turned off from the legend.
For example below. Turn off Watts and have Volts and Amps auto scale for best viewable resolution.
legend-plots

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.