Commit Graph

86 Commits

Author SHA1 Message Date
Ogi Moore d455da9aec Use Qt6 Enum Namespace
This namespace appears to be valid in PySide2/PyQt5 5.12+ so we may as
well migrate to the newer namespace ourselves.
2021-06-08 21:23:49 -07:00
Fernando Bordignon 7dc4823cc6
Update symbols documentation and inverted up and down arrows of scatterplotitem (#1747) 2021-04-29 19:34:19 -07:00
Ogi Moore 314121192a Use math module for isfinite or isnan for scalars
Various places in the library attempt to check if scalars are finite
via numpy methods, which are intended to be used on numpy arrays.  Using
the math module equivalent functions on scalars is significantly faster.

In a few places, I also use numpy methods explicitly (np.all vs. all)
2021-04-23 22:43:57 -07:00
Ogi Moore c4a1cf11a1 Use clip_array or clip_scalar instead of np.clip
Significant performance issues have been identified with np.clip
and thus clip_array was created to speed up the operation.  In addition
clip_scalar was created to clip a scalar value between two other values
this commit replaces many uses of np.clip from operating on scalars to
using clip_scalar instead
2021-04-23 11:53:00 -07:00
Ogi Moore 5a08650853
Improve target item - incorporate bits from PR 313 (#1318)
Overhaul TargetItem based on @lesauxvi 's PR #313
2021-04-10 22:42:44 -07:00
lidstrom83 6519734932
Deprecate unused/unnecessary modules (#1576)
* Deprecate ordereddict module

* Import OrderedDict from collections module instead of pgcollections

* Deprecate pgcollections module

* Deprecate lru_cache module

A simpler recipe exists from the standard library using OrderedDict.

* Deprecate pil_fix module

* Python 3.7 compatibility fix

* Avoid or suppress deprecation warnings in tests
2021-02-15 09:52:06 -08:00
Ogi Moore ff71b6be6b Add actual deprecation warnings 2021-02-11 21:34:02 -08:00
lidstrom83 d7668f91b3
Fix ScatterPlotItem performance regression (#1569)
* Fix ScatterPlotItem performance regression

* Add hover benchmark to ScatterPlotSpeedTest.py

* Removed a performance regression from GraphicsView

* Removed some tests failing due to the last commit
2021-02-11 08:36:52 -08:00
lidstrom83 aed2382e38
Correct id-based keying of scatter plot pixmap cache (#1564)
* Correct id-based keying of scatter plot pixmap cache

Note: naively using the id function results in non-unique keys.

Alternatively, we could serialize the Qt objects and use these in the key. This would provide protection from the user mutating these later, but at a cost to performance.

* Make id attribute private

* Access class variable instead of instance
2021-02-09 13:58:15 -08:00
Ogi Moore 2e1514d711
Cache scatter-plot items by hashable properties (#1560)
* Cache scatter-plot items by hashable properties

* use qpainterpath boundingRect+elementCount for key
2021-02-08 10:59:51 -08:00
KIU Shueng Chuan 10530568f0 ScatterPlotItem.py: use non _USE_QRECT codepath for PySide6
verified by using ScatterPlotSpeedTest.py that PySide6 benefits from this.
2021-01-15 12:47:13 +08:00
lidstrom83 3af23725ca
Scatter Plot Improvements (#1420)
* Added hovering demo to ScatterPlot example

* Use Qt's serialization for SymbolAtlas.symbolMap keys

Yields significant performance improvements when updating the scatter plot's options. See e.g. the plot hover example.

* Further optimized scatter plot picking

* Fix ScatterPlot example tool tip

* Clean up while I'm here

* Compatibility

* Some simple optimizations for ScatterPlotItem

Speedups for ScatterPlotSpeedTest.py:
~50% without pxMode
~ 0% pxMode with useCache
~30% pxMode without useCache

* ~3x speedup in scatter plot speed test with pxMode

* More optimization low-hanging fruit for the scatter plot

* Removed hover example to lazily pass tests

* Avoid segfault

* Re-add hover example to ScatterPlot.py

* Switch to id-based keying for scatter plot symbol atlas

- Use cases exist where serialization-based keying is a significant bottleneck, e.g. updating without atlas invalidation when a large variety pens or brushes are present.
- To avoid a performance hit, the onus is on the user to carefully reuse pen and brush objects.

* Optimized caching in scatter plot hovering example

* Fixed and optimized scatter plot hovering example

* Minor scatter plot optimization

* Cleanup

* Store hovered points in a set for the hovering example

* Keep a limited number symbol atlas entries around for future reuse

* Added a docstring note to remind the user to reuse QPen and QBrush objects for better performance

* Tidied up hovering example

* Typo

* Avoid unnecessary atlas rebuilds

* Refactored SymbolAtlas

* Efficient appending to SymbolAtlas

* SymbolAtlas rewrite

* Cleanup and profiling

* Add randomized brushes to speed test

* Add loc indexer to ScatterPlotItem

* Profile ScatterPlotItem.paint to identify bottlenecks

* Reuse targetRect to improve paint performance

* Readability improvements (opinionated)

* Only need to set x and y of targetRect

- w and h can stay set to 0 (not entirely sure why)
- this is a bit faster than setting all of x, y, w, h

* Minor renaming

* Strip off API changes and leave to another PR

* Renaming

* Compatibility

* Use drawPixmap(x, y, pm, sx, sy, sw, sh) signature to avoid needing to update QRectFs

* Use different drawing approaches for each Qt binding for performance reasons

* Fix a bug introduced two commits ago

Incidentally, I think there is a similar bug in the main branch currently.

* Minor performance and readability improvements

* Strip out source and target QRectF stuff

* Bring source and target QRectF stuff back in a less coupled way

* Leave deprecating getSpotOpts for another PR

* Compatibility fix

* Added docstrings and use SymbolAtlas__len__ where possible

* Fix export issue

* Add missing import

* Add deprecation warnings

* Avoid using deprecated methods

* Fix and cleanup max spot size measurements

* Make creation of style opts entries explicit

* Add hovering API to ScatterPlotItem

* Compatibility

* Marshal pen and brush lists in setPen and setBrush

* Fixed platform dependent bug
2020-12-16 11:07:39 -08:00
lidstrom83 0dacc57e02
Emit event with mouse clicks for some items (#1414)
Harmonizes behavior with PlotCurveItem.
2020-10-22 11:17:59 -07:00
Dennis Göries 55a9e19e43
ScatterItem: Fix name setting (#1405) 2020-10-20 20:02:53 -07:00
rafael fbf1a2fe18
ScatterPlotItem: Make + and x symbols thicker
This is something we're overriding in Orange3 (biolab/orange3#5007), as we change the symbols' alpha_value to show selected symbols. The default + and x symbols are too thin to show a noticeable change in alpha_value.

But I thought you might agree that the symbols look nicer this way.
2020-10-01 12:57:04 +02:00
Ogi 001d91c2f2 Implement PR160 - clear current SpotItems 2020-06-11 22:56:20 -07:00
Ogi Moore 12a7c449f1
Give ability to hide/show individual spots (#1245)
Co-authored-by: dlidstrom <lidstrom83@gmail.com>
2020-06-10 23:31:39 -07:00
Ogi Moore dbdd5d9a39
Peque scatter symbols (#1244)
* Added arrow symbols for the ScatterPlotItem

* Fixed arrows rotation in scatter plots

* Added new symbols to example

Co-authored-by: Miguel Sánchez de León Peque <msdeleonpeque@gmail.com>
2020-06-10 23:03:43 -07:00
Daniel Hrisca 6194245322
improve SymbolAtlas.getSymbolCoords and ScatterPlotItem.plot performance (#1198) 2020-05-29 23:08:40 -07:00
Daniel Hrisca f7364f52b3
improve SymbolAtlas.getSymbolCoords performance (#1184)
* remote legacy work-around for old numpy errors

* forgot to remove the numpy_fix import

* require numyp >= 1.8.0

* improve performance of updateData PlotCurveItem (saves about 2us per call)

* improve ScatterPlotItem performance
2020-05-04 13:42:03 -07:00
Paul Müller 2a01c3848a
fix wrong offset when drawing symbol 2019-11-25 14:14:15 +01:00
boylea b1b2f4662b Fixed image scatter plot export bug (#88) 2019-11-19 20:03:15 -08:00
Matt Liberty c52382c3b9 Moved emits after all method state updates since PySide2 immediately executes signals.
Pull request #907 addressed a specific case where a signal was emitted before a state update.
If an application's slot then calls back into the instance, the instance was in an inconsistent
state.  This commit audits and fixes similar issues throughout the pyqtgraph library.  This
commit fixes several latent issues:

* SignalProxy: flush -> sigDelayed -> signalReceived would have incorrectly resulted in timer.stop().
* ViewBox: resizeEvent -> sigStateChange -> background state
* ViewBox: setRange -> sigStateChange -> autoranging not updated correctly
* ViewBox: updateMatrix -> sigTransformChanged -> any _matrixNeedsUpdate = True -> ignored
* Parameter: Child may have missed state tree messages on insert or received extra on remove
* GraphicsView: updateMatrix -> sigDeviceRangeChanged/sigDeviceTransformChange -> before propagated to locked viewports.
2019-06-01 16:28:23 -04:00
Luke Campagnola 66dcfc7c67 Merge branch 'develop' into pyside2 2018-05-22 15:22:54 -07:00
Luke Campagnola d1794e4e96
Merge pull request #526 from kokokostation/develop
Added essential if.
2018-04-25 16:26:52 -07:00
Luke Campagnola 434d2b8c71 Merge branch 'develop' into scatterplotwidget-updates 2018-04-25 11:16:17 -07:00
Ales Erjavec b3a579fd00 ScatterPlotItem: Fix a GC memory leak due to numpy issue 6581 2018-03-29 12:23:59 +02:00
Luke Campagnola 96a3d216e2 Make it easier to track data in and out of scatterplotwidget 2018-03-15 11:59:45 -07:00
Luke Campagnola 82afad8366 Fix up Qt.py and deprecate USE_XX variables 2018-02-16 20:42:34 -08:00
Luke Campagnola 46f10f24f8 Merge branch 'develop' of https://github.com/maxpeng/pyqtgraph into maxpeng-develop 2018-02-15 18:30:12 -08:00
Terekhov b6838eb8c4 Use symbol id for a key in SymbolAtlas
Add test on a custom symbol for ScatterPlotItem.
In PyQt5 QPainterPath is not hashable anymore which causes SymbolAtlas to
fail accept it as a custom symbol, use id instead.
2018-01-28 18:10:39 -05:00
Alexander Manakov 72a7157538 Added essential if. 2017-08-04 13:56:37 +03:00
Luke Campagnola e0e0877168 Add documentation 2017-05-01 10:22:27 -07:00
Luke Campagnola 24116342c2 Add option to set composition mode for scatterplotitem 2017-05-01 09:43:16 -07:00
Max Peng 8bdc19be75 update to support pyside2 2016-09-25 00:16:36 +08:00
Luke Campagnola f988f0522d Merge branch 'new_markers' into develop 2016-02-14 23:16:47 -08:00
Luke Campagnola d308d45153 avoid numpy warnings when indexing with floats 2016-01-30 12:20:05 -08:00
lesauxvi 905a541253 new markers 2016-01-15 09:17:52 +01:00
Luke Campagnola 0976991efd Import from python2_3 for all uses of basestring, cmp, and xrange 2015-05-19 09:29:55 -04:00
Luke Campagnola 1fe5976e19 Merge branch 'pyqt5' into develop
Conflicts:
	examples/parametertree.py
	pyqtgraph/Qt.py
	pyqtgraph/graphicsItems/FillBetweenItem.py
	pyqtgraph/graphicsItems/InfiniteLine.py
	pyqtgraph/imageview/ImageView.py
2015-02-28 11:46:41 -05:00
compass 478a3b1aa4 Fix some bugs in PyQt5 2015-01-17 00:21:33 +08:00
Luke Campagnola 021addcf0e Merge remote-tracking branch 'nicolaisi/ntj01' into develop 2014-10-25 14:24:15 -04:00
Luke Campagnola 6c6ba8454a Added unit tests 2014-10-25 13:01:10 -04:00
Luke Campagnola cfb4384a3b Merge remote-tracking branch 'nicolaisi/brush' into scatterplot-fix 2014-10-25 12:58:51 -04:00
Nicholas Tan Jerome 7356126c3d added "mask" key check on setPen as well
Signed-off-by: Nicholas Tan Jerome <nicholas.jerome@kit.edu>
2014-10-17 11:18:12 +02:00
Nicholas Tan Jerome 884df4934a fixed a keyerror when passing a list into setBrush
- https://groups.google.com/forum/#!topic/pyqtgraph/xVyCC2f7gVo

Signed-off-by: Nicholas Tan Jerome <nicholas.jerome@kit.edu>
2014-10-17 10:57:36 +02:00
Nicholas Tan Jerome 6cc0f5e33d fixed the Pen None property.
- https://groups.google.com/forum/#!topic/pyqtgraph/t6cl1CevlB0

Signed-off-by: Nicholas Tan Jerome <nicholas.jerome@kit.edu>
2014-10-16 12:23:32 +02:00
Luke Campagnola 753ac9b4c4 Squashed commit of the following:
commit ca3fbe2ff9
Author: Luke Campagnola <luke.campagnola@gmail.com>
Date:   Thu Aug 7 08:41:30 2014 -0400

    Merged numerous updates from acq4:
    * Added HDF5 exporter
    * CSV exporter gets (x,y,y,y) export mode
    * Updates to SVG, Matplotlib exporter
    * Console can filter exceptions by string
    * Added tick context menu to GradientEditorItem
    * Added export feature to imageview
    * Parameter trees:
        - Option to save only user-editable values
        - Option to set visible title of parameters separately from name
        - Added experimental ParameterSystem for handling large systems of
            interdependent parameters
        - Auto-select editable portion of spinbox when editing
    * Added Vector.__abs__
    * Added replacement garbage collector for avoiding crashes on multithreaded Qt
    * Fixed "illegal instruction" caused by closing file handle 7 on OSX
    * configfile now reloads QtCore objects, Point, ColorMap, numpy arrays
    * Avoid triggering recursion issues in exception handler
    * Various bugfies and performance enhancements
2014-08-07 09:03:26 -04:00
Luke Campagnola 01d629396a Catch overflows from Point.length()
Merge branch 'release-0.9.8.1' into develop
2014-04-03 13:15:55 -04:00
Luke Campagnola c9c2160856 more cleanups
added simple test
2014-01-18 19:13:39 -05:00