This allows you to easily create code to toggle lines on or off by setting to the appropriate array if on, or None if off. Currently you have to have 2 seperate setData calls, one with adj and one without
The i-th position of that array used to define if points (i) and (i+1)
were connected, but in master it defines whether points (i-1) and (i) are connected.
This commit reverts to (i) and (i+1) interpretation.
* Fix TickSliderItem: Avoid ghost ticks | Improved customPlot.py code
If `TickSliderItem.setTickValue` was called when a full repaint of the `TickSliderItem` was
not already scheduled, the tick was visible at the old and the new position. This could e.g. be seen
when using the autoscale button in the `customPlot.py` example.
Further, code from `customPlot.py` is improved to make use of `Tick.setVisible` instead of adding and
removing ticks based on their visibility.
* customPlot.py: Explain bool conversion
Co-authored-by: 2xB <2xB@users.noreply.github.com>
* Fix examples\customPlot.py: Not object-oriented
Copy-paste error: I referenced a specific object instead of self. Fixed.
* Fix examples\customPlot.py: Allow calling setTicks more than once
This fixes a bug where TickSliderItem is expected to return ticks.keys() but while it returns ticks.items().
Also: Minor code correction.
* Fix examples\customPlot.py: Avoid scaling differences
Consider padding of TickSliderItem for link between ViewBox and ticks
Co-authored-by: 2xB <2xB@users.noreply.github.com>
* changes to setData and dataRect to handle setting empty data
* simplified named argument check
* tests for clearing PlotDataItem by setData() and setData([],[]), commented out vestigal xClean/yClean
* removed last remains of xClean/yClean
* TickSliderItem: allowRemove property added
Following #744, this PR suggests the addition of a property
`allowRemove` to `TickSliderItem` and therefore also to
`GradientEditorItem`. It sets the default of whether ticks can
be removed by the user and therefore contemplates `allowAdd`.
I would be interested in other opinions on this design decision,
as #744 suggests to reuse `allowAdd` for the prohibition of
tick removal.
I personally suggest this solution, since it does not change
the effect of the current API.
Fix#744
* customPlot.py: Added markers to example using TickSliderItem
* examples\GradientWidget.py: Demonstrate use of allowRemove
Co-authored-by: 2xB <2xB@users.noreply.github.com>
* Fix examples/customPlot.py: mouseDragEvent misses axis argument
Fixes#1277
* customPlot.py: Update methodolgy to disable menu
If there's an argument for this, we should use it
* customPlot.py: Show how to disable axis interaction
* Fix ViewBox: Moving axis in RectMode not implemented => use normal move mode
Grabbing an axis in RectMode leads to the zoom rectangle being displayed
in unreasonable positions. In this case, fall back to normal mode.
* customPlot.py: Only disable right-click zoom for demonstration
In cases where continuous zooming is not wished (e.g. in case of
complicated rebinning after zooming), this might come in handy
and there is no reason not to show it.
Co-authored-by: 2xB <2xB@users.noreply.github.com>
* Fix: TickSliderItem ignores Tick.removeAllowed
This prohibits removing ticks from a `TickSliderItem` if they were set to `tick.removeAllowed=False`.
Test code:
```python3
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore
import numpy as np
app = pg.mkQApp()
class CustomWidget(pg.GraphicsView):
def __init__(self, parent=None, *args, **kargs):
pg.GraphicsView.__init__(self, parent, useOpenGL=False, background=None)
self.item = pg.TickSliderItem(*args, **kargs)
for pos in (0, 0.5, 1):
tick = self.item.addTick(pos)
tick.removeAllowed = False # Possibility 1
# Possibility 2
for tick, value in self.item.listTicks():
tick.removeAllowed = False
self.setCentralItem(self.item)
self.setFixedHeight(31)
w = CustomWidget()
w.show()
app.exec_()
```
* Make 'removeAllowed' regular property of 'Tick'
Co-authored-by: 2xB <2xB@users.noreply.github.com>
* Fix: TickSliderItem method uses function from subclass GradientEditorItem
* Improved code layout
Previously, creating a `GradientEditorItem` lead to 34 executions
of `updateGradient`, with these improvements, only 2 are needed.
Further, removed duplicate code and used signals whenever possible.
Co-authored-by: 2xB <2xB@users.noreply.github.com>
* Emit signal when GraphicScene.addItem() is used
Emit a signal (sigItemAdded) just after adding an item to a scene.
The item object is emited as the only signal argument.
This signal is useful for code that may want to react to newly added
items of a plot.
* Emit signal when GraphicScene.removeItem() is used
Emit a signal (sigItemRemoved) just after removing an item from a scene.
The item object is emited as the only signal argument.
This signal is useful for code that may want to react to removed
items in a plot.
* [SVGExporter] Fix width and height
* [SVGExporter] Fix background color
* [SVGExporter] Remove f-strings
* [Exporter] Fix for QtGui.QGraphicsScene
* Revert "[Exporter] Fix for QtGui.QGraphicsScene"
This reverts commit 5bdd25ea40.
* [test_svg] Fix unit test
* Permit nan, inf, and -inf for float SpinBox
Bounds are enforced against inf and -inf inputs, but not for nan.
* Ensure SpinBox text is updated when out-of-bounds value is entered
* Make inf and nan entry in SpinBox case-insensitive
* Make SpinBox example behave as advertised
* Make non-finite SpinBox values optionally allowed
* Python 2 compatibility
The three parameters "shape, vectors, origin" can't be passed as parameters because they are computed, which raise an error when kwds is passed to affineSlice.
- Parameters now respond to title change in setOpts
- Add Parameter.title()
- Action parameter uses default name/title handling in addition to setting button text (fixes#1320)
* example app now workw with Qt4 and Python2 again
* Example App is now part of the test suite
* Add initExample
* No scary warning when launching examples
* Fix scary examples.__main__ warning
* Use courier new font as its on all platforms
* Remove commented out code
* Add newline
* Updated docs, example app now tested
* Non-relative import for example app
* Proper importing now
* dynamic range limiting in PlotDataItem
* revised version of cynamic range limiting
* replaced == with is operator
* removed unicode +- character, converted to ascii
* code/docstring cleanup
* clean state with changes
* silenced numpy all-NaN warnings
* reverted PlotWidget.py to original
* reverted PlotWidget.py to original
* reverted PlotWidget.py to original
* rewrapped/reformated setDynamicRangeLimits docstring
Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
* LegendItem: Enable customization of label text size and tests
* One more CI
* Remove deleteLater of QAPP in legend item test
* Remove assert statement in setLabelTextSize
* Modify legend test without assertion
* Add a docs build job to CI
* Add sphinxopts to fail on warning
* Test sphinx warning
* Redid ci stage conditionals
* update conf.py to remove deprecation warning
* introduce 3rd stage for proper conditionals
* Attempt to fix malformed table
Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
This commit adds a depth buffer in renderToArray().
This fixes the issue that overlapping objects are rendered incorrectly
when using renderToArray() on a GLViewWidget.
This might be related to issue #743.
* Add "lstep" and "rstep" step Modes
stepMode is currently either True or False. If it is True,
it requires the user to make len(x) = len(y)+1. This is
inconvenient because it makes it difficult to change the
stepMode on a given curve (just as one would change, e.g.,
its color).
This commit extends the current situation by introducing
two more step modes: "lstep" and "rstep", which do not require
passing an extra x value. In turn, this modes associate each
y value to either the left or the right boundary of the step.
For example, the "rstep" mode is handy when plotting "life"
digital signals in which x,y data pairs are appended as they
are read.
This commit does not modify the behaviour in case of stepMode=True
* Replace step mode names: lstep,rstep -> left,right
* Improve docs for stepMode
Reword docstring and add it to PlotDataItem class too
* Document left and right stepModes as added in v 0.12.0
TODO: confirm the exact version number to use here
* Add comments stress the need for "is True"
Some conditional statements in the code regarding stepMode are
done with "is True". This is actually required since other
possible values such as "left" also evaluate as true but should
not be caught.
* Deprecate boolean API for stepMode
Introduce stepMode="mid" as a replacement of stepMode=True,
but keeping full backwards compatibility with the old API.
Adapt docs, examples and tests accordingly.
* Raise ValueError on unsupported stepMode values
* Rename "mid" step mode to "center"
* Remove "added in 0.12.0" note
See https://github.com/pyqtgraph/pyqtgraph/pull/1360#discussion_r502746919
* Add deprecation warning when stepMode=True
Issue a DeprecationWarning if stepMode=True is being passed to the
constructor or setData() of PlotDataItem or PlotCurveItem.
Note: warnings module is imported locally so that it is esier to
remove once this check is no longer needed.
* Fix wrong syntax in last commit
Fix usage of "default" kwarg in dict.get()
* SignalProxy: Correct initialization without slot argument and provide tests
* Add missing slot is None case on disconnect
* Start new tests
* Exception block
* Test no module
* Different signal
* Debugging the signal connect
* Re initialize proxy after disconnect
* Add more test cases for blockSignal
* Change test case for signal count
* Give up for python 2 and pyside
* Exclude for Python 2.7 and PySide
* Convert float to integers in timer start period