Commit Graph

825 Commits

Author SHA1 Message Date
Ogi Moore
45e0464163
Merge pull request #1493 from pijyoi/fastinv
invert QTransform using adjoint() and determinant()
2021-01-12 21:05:46 -08:00
KIU Shueng Chuan
3a342b50e2 Revert "Add cache for mapRectFromView"
This reverts commit 55e1f2c520.
2021-01-13 12:43:51 +08:00
Dennis Göries
2affe322ec
PlotItem: Fix enableMenu setting when passing a viewbox (#1496)
* PlotItem: enableMenu setting when passing a viewbox
2021-01-12 20:34:14 -08:00
Julius Juodakis
386dcf8180
setSpan broke LinearRegionItem (#1488) (#1491) 2021-01-06 14:54:33 -08:00
Dennis Göries
b622e22877
LegendItem: Make ItemSample customizable (#1404)
* LegendItem: Introduce itemStyles and provide ToggleItem

Show example

* Minor cleanup of the legend item and test

* Make ItemSample customizable

* Remove example modifications

* Changes for sampleType according to review
2021-01-04 21:02:08 -08:00
Hanwant
e209be20e5
Use log modulus transform for y axis log scaling (#1476)
* Use log modulus transform for y axis log scaling

* Update log modulus to use eps and retain behaviour around -1 < x < 1

* Update setLogMode Dosctring

* Update setLogMode docString

Co-authored-by: Hanwant <admin@madigan.tech>
2021-01-04 19:27:03 -08:00
Lee Tirrell
64e04e3120
Fix #798 (#1487) 2021-01-03 14:28:40 -08:00
miranis
c5c41b9090
zero-step in np.arange (#1468) 2020-12-17 22:48:55 -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
Marko Toplak
1847bfcf97
Remove ViewBox.childGroup ItemClipsChildrenToShape flag (#1458)
The flag was set on ItemClipsChildrenToShape to solve the issue of #316
"A GraphicsItem object overlaps the ViewBox border line" at Luke Campagnola's
suggestion to solve further issues that @espdev had. Luke wisely
commented that this approach needs extensive testing.

We tested it. It broke PDF export in Orange. :)

A solution to #316 was merged in PR #321, which was refined from the discussion
in #316. I am not sure that, given rest of #321, the ItemClipsChildrenToShape
was really needed. Even without modifications to ChildGroup I did not
see any border problems (but I could replicate them in pre-#321 pyqtgraph).

Removing this flag fixes (and unneeded supporting code) fixes PDF export
regression in Orange while borders still seem a-OK.
2020-12-09 22:45:21 -08:00
Tom Mudway
ca7b4580fa
Added option to use "None" for adj in setData
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
2020-12-07 17:55:51 -05:00
2xB
433b061e81
Fix TickSliderItem: Avoid ghost ticks | Improved customPlot.py code (#1459)
* 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>
2020-11-26 22:28:03 -08:00
Ogi Moore
d2255228ba
resolve ordering of issues presented in #1322 (#1456) 2020-11-23 12:12:14 -08:00
Matt Liberty
a3fbd18239
Clipped AxisItem tick value labels to prevent drawing artifacts #732 (#1447) 2020-11-21 00:46:31 -08:00
Ogi Moore
71a92a6fd2
Fix autosize not taking to correct range with TextItem in view (#1435)
* Removing first call to updateMatrix in resizeEvent
2020-11-21 00:02:32 -08:00
Julius Juodakis
0e816f1dbe
InfiniteLine caching calls merged (fixes #1450) (#1452) 2020-11-20 21:27:55 -08:00
Nils Nemitz
6c14204682
Fix set empty (#1446)
* 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
2020-11-18 09:31:28 -08:00
2xB
020b7077cb
TickSliderItem: allowRemove property added (#1442)
* 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>
2020-11-16 16:18:26 -08:00
2xB
c359d5fad9
Fix ViewBox axis zoom in RectMode and examples/customPlot.py (#1443)
* 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>
2020-11-16 14:27:40 -08:00
2xB
75048c473b
TickSliderItem: Use Tick.removeAllowed (#1441)
* 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>
2020-11-16 11:54:46 -08:00
2xB
01aee93a16
Fix: TickSliderItem method uses function from subclass GradientEditorItem (#1439)
* 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>
2020-11-16 10:56:58 -08:00
ernierock
98c01a3667
Update GridItem.py (#1423)
Bug in GridItem.setTextPen() : on line 49 **kargs should be **kwargs. setTextPen does not work (until this simple fix is applied)
2020-11-06 14:04:34 -08:00
Toussaic
ae4522109e
User-defined keywords of getArrayRegion (#1416)
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.
2020-10-26 22:04:38 -07:00
lidstrom83
0dacc57e02
Emit event with mouse clicks for some items (#1414)
Harmonizes behavior with PlotCurveItem.
2020-10-22 11:17:59 -07:00
Ogi Moore
27ca1747f1
Call GraphicsItem.viewTransformChanged() (#1413)
* Call GraphicsItem.viewTransformChanged()

* Needed to apply to labels too
2020-10-22 11:17:33 -07:00
Dennis Göries
55a9e19e43
ScatterItem: Fix name setting (#1405) 2020-10-20 20:02:53 -07:00
Nils Nemitz
65e90faec5
dynamic range limiting in PlotDataItem (#1140)
* 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>
2020-10-18 22:34:41 -07:00
Julius Juodakis
39f9c6a6aa
caching for viewRect of LinearRegionItem to reduce CPU load (#1391)
* caching for boundaryRect of LinearRegionItem

* caching viewRect at GraphicsItem
2020-10-18 16:42:40 -07:00
Dennis Göries
b5de577c28
LegendItem: Enable customization of label text size and tests (#1397)
* 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
2020-10-15 10:56:34 -07:00
Ogi Moore
5eb671217c
Docs should have no warnings on pcolormeshitem (#1400) 2020-10-15 10:12:36 -07:00
Kenneth Lyons
1f76ac0e2c
Add a docs build job to CI (#1328)
* 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>
2020-10-15 08:43:23 -07:00
Dennis Göries
3b6eb02520
AxisItem: Account for empty strings in the visibility of text and units (#1367)
* Rebase

* make the tests work

* add test and rather more cleanup

* Cleanup for axisitem visibility test

* Another cleanup in test axis item
2020-10-14 20:40:54 -07:00
Ogi Moore
9413dc8005
Disable mouse rate limiting (#1399) 2020-10-13 22:33:00 -07:00
Carlos Pascual
23a46b5fb9
Add "left" and "right" step Modes (#1360)
* 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()
2020-10-13 08:52:07 -07:00
Ogi Moore
4946a57987
Merge pull request #1382 from dgoeries/code-quality-legend
LegendItem: A bit auto flake8
2020-10-12 22:28:00 -07:00
Ogi Moore
3f7a9bb642
Merge pull request #1273 from edumur/develop
Implemented pColorMeshItem
2020-10-12 09:24:10 -07:00
Etienne Dumur
5ab0cef017 Solve artifacts issues
Add a parameter "antialiasing".
Remove profiler
Add pyqtgraph mkPen
2020-10-12 12:45:13 +02: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
Dennis Goeries
6dc0b2c16d LegendItem: A bit auf auto flake8 2020-09-26 14:09:21 +02:00
Etienne Dumur
bd51fa7c87 Clean code, improve boundingRect 2020-09-23 09:27:23 +02:00
Kenneth Lyons
a90c443b7a
Fix PlotItem.setAxisItems (#1376)
* Fix PlotItem.setAxisItems

- Use extend so visibleAxes remains a flat list.
- More robust logic for detecting adding an AxisItem instance to
  mulitple plots and suggest a workaround in the error message.

* Simplify membership check

* Add test for PlotItem setAxisitem logic
2020-09-22 20:25:02 -07:00
Kenneth Lyons
e78e9c256d Consolidate and fix downsample factor computation in ImageItem 2020-09-20 22:06:00 -07:00
Kenneth Lyons
3ea32ff447
Merge pull request #1374 from ixjlyons/test-warnings-cleanup
Test warnings cleanup
2020-09-20 14:52:49 -07:00
Megan Kratz
46f8f1633f fix for log scaling being broken -- log was being taken twice, resulting in nan. Now it's only being taken once 2020-09-10 19:20:12 -04:00
Kenneth Lyons
9fdaffaf7d
Merge pull request #1336 from ales-erjavec/fixes/arrow-item-parent-arg
Fix an error in ArrowItem constructor when passed a parent=... argument
2020-08-17 21:07:18 -07:00
Ales Erjavec
3d391d46e3 Add parent to ArrowItem's constructor signature 2020-08-17 09:27:23 +02:00
Ales Erjavec
52717fa8b7 Rename test 2020-08-17 09:25:37 +02:00
Kenneth Lyons
ab13cd450e
Merge pull request #1331 from LocutusOfBorg/new-sip
sip: switch to new PyQt5 api import, with fallback to the old impleme…
2020-08-15 12:45:05 -07:00
Kenneth Lyons
c8fc221e81
Merge pull request #1334 from termim/PlotCurveItem
More data validity checks in PlotCurveItem
2020-08-03 15:14:07 -07:00
Kenneth Lyons
7504f2ba27
Merge pull request #1326 from ixjlyons/doc-multiplotitem
Improve docs for MultiPlotWidget and MultiPlotItem
2020-08-01 17:19:18 -07:00
Ales Erjavec
a9049f1d4d Pop the 'parent' arg from ArrowItem opts parameter dict
If not, then an `KeyError: 'Invalid arrow style option "parent"'`
 is raised in setStyle.
2020-07-28 10:01:15 +02:00
Mikhail Terekhov
471d7415ee PlotCurveItem.dataBounds: more checks for empty range 2020-07-27 15:50:34 -04:00
Mikhail Terekhov
1ad3eacb78 PlotCurveItem.boundingRect: check for None returned from self.dataBounds 2020-07-27 15:50:26 -04:00
Gianfranco Costamagna
32a79f18a4 sip: switch to new PyQt5 api import, with fallback to the old implementation if not found.
Also calls to setapi are not needed anymore, so use them only with the old implementation.

See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=966045
for reference
2020-07-27 14:52:07 +02:00
Luke Campagnola
abfac52c34
Merge pull request #1321 from campagnola/revert-plotcurveitem-changes
Revert plotcurveitem changes from 18999c
2020-07-21 06:43:06 -07:00
Etienne Dumur
85378004ef Correct Pyside bug 2020-07-20 09:36:14 +02:00
Kenneth Lyons
c0da4c545e Improve docs for MultiPlotWidget and MultiPlotItem 2020-07-19 14:28:58 -07:00
angulartist
5765b0d4c2 Enhancement: [Issue/812]: remove unused import 2020-07-19 19:16:58 +02:00
angulartist
58aa9306df Enhancement: [Issue/812]: just pass plotArgs keyword arguments 2020-07-19 19:16:07 +02:00
angulartist
ae4483bfaa Enhancement: [Issue/812]: MultiPlotItem handles pen (QPen) as a keyword argument 2020-07-19 15:58:13 +02:00
Luke Campagnola
b031a0a235 Revert changes from 18999c - these incorrectly change the API.
Also tidy up a little
2020-07-18 23:41:35 -07:00
Dennis van Gils
603e1b98bc Fix line width not being set 2020-07-16 21:13:33 +02:00
Etienne Dumur
2822790087 Correct Python 2 compatibilities and improve comments 2020-07-15 10:32:29 +02:00
Kenneth Lyons
d70e870a44
Merge pull request #1309 from ibrewster/polylineroifix
Properly retain and use hoverPen argument in _PolyLineSegment
2020-07-13 21:28:06 -07:00
Kenneth Lyons
b058d032d1 Fix some warnings 2020-07-13 21:09:31 -07:00
Luke Campagnola
f015f0879e TargetItem fix + performance improvements
- avoid extra work when setLabelAngle would have no effect
- fix errors from bad parent transform (usually the displaying widget has not been given a size yet)
2020-07-13 16:37:29 -07:00
Luke Campagnola
cb48ec94b7 performance fix for histogramlutitem
setImageItem is now able to detect trival color gradients like gradientChanged has previously.
2020-07-13 16:25:43 -07:00
Israel Brewster
3878ab6946 Properly retain and use hoverPen argument in PolyLineSegment function of PolyLineROI 2020-07-13 12:10:49 -08:00
Luke Campagnola
993871b1ae InfinifteLine.setPos add support for array arg 2020-07-13 12:51:03 -07:00
Luke Campagnola
6a5e7cfee5 ArrowItem performance
- Avoid updates that would have no effect
- Raise exception on invalid arguments to setStyle
2020-07-06 01:27:43 -07:00
Luke Campagnola
268d25c125 TextItem performance
Avoid expensive work if textitem is not visible, or when setPlainText / setHtml would have no effect.
2020-07-06 00:24:13 -07:00
Luke Campagnola
ac417a6567 py3 fixes 2020-07-05 22:52:15 -07:00
Ogi Moore
da15f09479
Merge pull request #1289 from ksunden/dai_si_prefix
Disable autoSIPrefix for DateAxisItem by default
2020-07-05 10:50:54 -07:00
Kyle Sunden
a4dbcfb1e1 Disable autoSIPrefix for DateAxisItem by default
When adding a label, it adds the offset for the epoch seconds, (1e09), which is not helpful for date axes
2020-07-03 17:02:58 -05:00
Etienne Dumur
eb6a93d26e Modify syntax to pass error 2020-06-29 18:28:52 +02:00
Etienne Dumur
52c607de64 Revert "Modify syntax to pass error"
This reverts commit 09a0311fa8.
2020-06-29 18:27:37 +02:00
Etienne Dumur
09a0311fa8 Modify syntax to pass error 2020-06-29 18:21:15 +02:00
Kenneth Lyons
3cf2845743
Improve control over ROI/handle pens (#1285)
* Exposed ability to set pens for handles and hovering for ROIs

* Consistent color format for pen creation

* Exposed ability to set pens for handles and hovering for ROIs

* Consistent color format for pen creation

* Add handleHoverPen arg to ROI and rename Handle arg to hoverPen

Co-authored-by: nmearl <nchlsearl@gmail.com>
2020-06-28 22:44:13 -07:00
Kenneth Lyons
8a3d4bab2f Update doc strings to clarify getArrayRegion API for ROI subclasses 2020-06-28 14:39:12 -07:00
Etienne Dumur
667c41d22b PColorMeshItem know require only one 2d array
Allow PColorMeshItem to work with only one 2d array, a regular grid is then assume for the polygons vertices.
Improvement of comments.
2020-06-28 20:32:22 +02:00
Etienne Dumur
919ee54b59 Add edgecolor parameter
Allow user to set the polygons edge color.
2020-06-28 14:50:44 +02:00
Etienne Dumur
d32d61a1e2 Various improvements
Make an example displaying more clearly the Item capability.
Correct few bugs in the Item class.
Improve overall comments.
2020-06-28 14:49:20 +02:00
Ogi Moore
a719a06b8b
Merge pull request #467 from meganbkratz/derivativePlots_cleanup
Add dy/dx and y vs. y` plot modes to context menus from plots.
2020-06-27 12:50:44 -07:00
Ogi Moore
264d63e90e Update PyQt5, PySide2, PySide1 Templates, apply else statement 2020-06-26 23:51:09 -07:00
Etienne Dumur
4e7b8dce17 Update PColorMeshItem.py 2020-06-25 22:41:30 +02:00
Etienne Dumur
cbbd8287ad Remove matplotlib dependencies 2020-06-25 22:07:41 +02:00
Ogi Moore
ce6da3e93f First pass at implementing the diff from PR307 2020-06-24 23:34:17 -07:00
Ogi Moore
302d66dd67
Add tickAlpha to AxisItem Style Options (#1274)
* Add tickAlpha setting to AxisItem style

* reworking setTickAlpha docs, redo logic based on types

Co-authored-by: demonchild2112 <denverlovesyou@gmail.com>
2020-06-24 17:42:28 -07:00
Ogi Moore
43328eb053
Merge pull request #1270 from j9ac9k/implement-pr-403
Implement pr 403
2020-06-24 15:56:59 -07:00
Ogi Moore
b8abd5d02e Don't let axis item reduce space 2020-06-24 15:40:01 -07:00
Ogi Moore
14d5085636
Merge branch 'develop' into derivativePlots_cleanup 2020-06-23 23:03:56 -07:00
Ogi Moore
fd0bbeb9db
Merge pull request #1272 from maxkl/develop
LegendItem: fix clear() not closing widgets
2020-06-23 21:04:35 -07:00
Etienne Dumur
426a70ae60 Implemented pColorMeshItem 2020-06-23 19:59:04 +02:00
Max Klein
78d11f8a71
LegendItem: fix clear() not closing widgets 2020-06-23 17:01:02 +02:00
Ogi Moore
a192707654 Implement PR403-diff 2020-06-22 23:02:48 -07:00
Ogi Moore
1fe3731ec2
Merge branch 'master' into develop 2020-06-22 20:37:55 -07:00
Kenneth Lyons
352a8a425a Add mouse event to PlotCurveItem sigClicked signature 2020-06-19 23:00:02 -07:00
Ogi Moore
0c08adc411
Merge pull request #1257 from VesnaT/tickFont_painter
AxisItem: Make painter (tick) font dependent
2020-06-15 07:54:25 -07:00
Vesna Tanko
ad4f796e32 AxisItem: Make painter tick font dependent 2020-06-15 11:03:50 +02:00
Ogi Moore
362dc93a9d
Merge pull request #1256 from j9ac9k/Implement-PR-317
Implement diff from PR 317
2020-06-13 21:49:33 -07:00
Ogi
8b557af23f Implement diff from PR 317 2020-06-13 21:21:29 -07:00
Ogi Moore
1744bb09a9
Merge pull request #1251 from dearkarm/patch-1
DateAxisItem: Parameterize utcOffset during construction
2020-06-12 22:53:20 -07:00
Ogi Moore
5f5803264b
Merge pull request #1252 from j9ac9k/implement-pr-336
fix-incorrect-tick-text-boundaries-calculation
2020-06-12 22:52:46 -07:00
Karl Georg Bedrich
3a758cac96
NEW options for LegendItem (#395)
* NEW options for LegendItem

* * changed 'drawFrame' into 'frame'
* added **kwargs to plotItem.addLegend
* added (frame=False, colCount=2) in legend example
* more elegant solution for legend.getLabel

* repaired getLabel
ItemSample.item == plotitem

Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
2020-06-12 22:40:20 -07:00
Ogi Moore
cee27b6268 fix-incorrect-tick-text-boundaries-calculation 2020-06-12 22:28:26 -07:00
carmazine
8da7c166c8
Parameterize utcOffset during construction
Allows for control over timezone offset in a simple, optional manner
2020-06-12 22:46:09 +02:00
Ogi
001d91c2f2 Implement PR160 - clear current SpotItems 2020-06-11 22:56:20 -07:00
Ogi Moore
4b484ae46d
Merge pull request #150 from lidstrom83/ViewBox_panning_fix
Speed up ViewBox panning
2020-06-11 22:33:49 -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
Ogi
05f8921555 Implement suggested changes in PR 143 2020-06-10 20:50:04 -07:00
Ogi
2e8dce2fc2 Emit the event with sigClicked in PlotCurveItem 2020-06-10 20:08:34 -07:00
Maurice van der Pot
e18af48b8d
Implement headWidth parameter for arrows (#385)
Although the documentation used to say that specifying tipAngle would
override headWidth, headWidth was never used. The new behaviour is that
tipAngle will be used, with a default value of 25, unless headWidth is
specified.

Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
2020-06-09 22:04:29 -07:00
Ogi Moore
517adc87c0
Merge branch 'master' into develop 2020-06-09 20:56:51 -07:00
Karl Georg Bedrich
2848d451f6
draw connector lines between gradient and region with anti-aliasing (#496)
Co-authored-by: serkgb <serkgb@J873GY1-2.stf.nus.edu.sg>
Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
2020-06-08 23:33:12 -07:00
Ogi
66d8943317 PlotItem doesn't add item if already there 2020-06-08 21:50:29 -07:00
Ogi Moore
5b5749aa0b Revert "changed structure to redefine axis via plotitem.setAxes (#391)"
This reverts commit bb21791c71.
2020-06-07 20:29:28 -07:00
Kenneth Lyons
120d251a25 Minor improvements to LegendItem.
- Adds doc strings for user-facing methods so they appear in the
  documentation.
- Allows PlotItem.addLegend to accept the same arguments as LegendItem
  constructor for convenience.
- Fixes a bug for adding a BarGraphItem (which doesn't have an antialias
  option) to LegendItem
2020-06-06 15:56:01 -07:00
Karl Georg Bedrich
ca9b0c7910
new method 'getAxpectRatio' with code taken from 'setAspectLocked' (#392)
Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
2020-06-01 11:24:18 -07:00
Adam Strzelecki
983cc1695e
Patch/window handling (#468)
* Do not wrap PlotView/ImageView

There is no need to wrap PlotView/ImageView into QMainWindow, since
only purpose of the QMainWindow is some default menu toolbar & menu
handling, that is not used by PyQtGraph anyway.

Moreover, every parent-less Qt widget can become window, so this
change just use PlotView/ImageView as windows, removing extra
complexity, eg. method forwarding, self.win property.

Another benefit of this change, it that these windows get initial
dimensions and titles as they were designed in .ui file.

* Properly cleanup on ImageView.close()

We should not close explicitly child widgets or clear scene, otherwise
Qt will deallocate children views, and cause "wrapped C/C++ object of
type ImageItem has been deleted" error next time we call close()
and/or some other methods.

All children, including self.ui.roiPlot, self.ui.graphicsView will be
closed together with its parent, so there is no need to close them
explicitly.

So the purpose of close it to reclaim the memory, but not to make the existing ImageView object dysfunctional.

* Remove references to plot & image windows after close

PyQtGraph images and plots module list variables are currently holding
references to all plots and image windows returned directly from main
module. This does not seem to be documented however, and causes the Qt
windows to be not released from memory, even if user releases all own
references.

This change removes the references from images/plots list once window
is closed, so when there is no other reference, window and all related
memory is reclaimed.

* Change all UI forms title from Form to PyQtGraph

Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
2020-06-01 11:23:18 -07:00
Karl Georg Bedrich
bb21791c71
changed structure to redefine axis via plotitem.setAxes (#391)
* changed structure to redefine axis via
plotitem.setAxes

* cleanuup

* remove old axesitems before adding new ones

* DEBUGGED plotitem.setAxes
NEW AxisItem.setOrientation (needed by plotitem.setAxes)
show/hide right axes after .setAxes()

Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
2020-06-01 11:12:52 -07:00
Ogi Moore
a27506209b
Merge pull request #393 from radjkarl/gradient
NEW show/hide gradient ticks NEW link gradientEditor to others
2020-05-31 21:03:27 -07:00
Zach Lowry
c903546679
Fix duplicate menus in GradientEditorItem (#444)
* Fix duplicate menus in GradientEditorItem

Add call to ev.accept in Tivk.mouseClickEvent to prevent parent menu from opening on a right click of a Tick.

Co-authored-by: Ogi <ognyan.moore@gmail.com>
2020-05-31 17:39:51 -07:00
ChristophRose
ed009d3779 Check lastDownsample in viewTransformChanged
Add a check in the viewTransformChanged function to only force a rerender when the downsampling factor changed.
Previously simply moving the image around or zooming in/out without changing the downsampling factor would force a complete rerendering of the image, which was very slow with large images. This way, the expensive rerender is only forced if necessary.
2020-05-30 22:15:52 -07:00
Paul Müller
e08ac110f5
pretty-print log-scale axes labels (#1097)
* pretty-print log-scale axes labels

* only pretty-print in python 3
2020-05-30 13:53:38 -07:00
Israel Brewster
949df4da16
Fix aspectRatio and zoom range issues when zooming (#1093)
* Check and enforce view limits in the setRange function

* Check limits when setting aspectRatio

- This change is required due to moving the limit checking out of the updateViewRange function.
- If the original logic remained, aspect ratio could be lost due to "squshing" the requested view into the viewBox

* Add tests for ViewBox zooming limits and aspect ratio

* - Move test code to proper location and fix instantiation of QApplication

Co-authored-by: Israel Brewster <ijbrewster@alaska.edu>
2020-05-30 13:09:09 -07:00
Ogi Moore
2ac1eefeb5
Merge pull request #1173 from 2xB/fix-1136-2
GraphicsLayout: Always call layout.activate() after adding items
2020-05-30 13:04:37 -07:00
Erik Månsson
55e1f2c520 Add cache for mapRectFromView 2020-05-30 16:25:43 +02:00
Daniel Hrisca
6194245322
improve SymbolAtlas.getSymbolCoords and ScatterPlotItem.plot performance (#1198) 2020-05-29 23:08:40 -07:00
Ogi Moore
99c43613f3
Merge pull request #1174 from Ma-Shell/develop
Fixed a possible race condition with linked views
2020-05-29 23:00:10 -07:00
Erik Månsson
369d7a11d2 Fix PixelVectors cache 2020-05-28 23:10:00 +02:00
Kenneth Lyons
5353acdb1c Static paths not used for docs. Fix malformed table in docstring 2020-05-16 10:12:33 -07:00
Kyle Sunden
fb56d3eaa9
Merge pull request #801 from ales-erjavec/remove-address-cache
Remove use of GraphicsScene._addressCache in translateGraphicsItem
2020-05-11 10:38:39 -05:00
Maxim Millen
14075e6223
Added support for plot curve to handle both fill and connect args. (#1188) 2020-05-10 08:42:04 -07:00
Kenneth Lyons
5bebf697b0
Disable remove ROI menu action in handle context menu (#1197) 2020-05-10 08:39:17 -07:00
2xB
720fa5f3c2
DateAxisItem: AxisItem unlinking tests and doc fixed (#1179)
* Added test_AxisItem by @mliberty1

As found in https://github.com/pyqtgraph/pyqtgraph/pull/917

* test_AxisItem: Fit to current implementation

* DateAxisItem: Fix documentation to zoomLevels

zoomLevels is not intended to be set by the user (see discussion in converstation from
https://github.com/pyqtgraph/pyqtgraph/pull/1154/files#diff-aefdb23660d0963df0dff3a116baded8
). Also, `zoomLevelWidths` does currently not exist.
This commit adapts the documentation to reflect that.

* DateAxisItem: Do not publish ZoomLevel

* DateAxisItem testing: Removed unnecessary monkeypatch fixture

Co-authored-by: 2xB <2xB@users.noreply.github.com>
2020-05-05 09:16:07 -07:00
2xB
96be1bd23f
Fix: AxisItem tickFont is defined in two places while only one is used (#1180)
To set the tick font of `AxisItem`s, there are two options:
`setStyle({"tickFont":...})` and `setTickFont(...)`.
The first option sets `AxisItem.style['tickFont']`, the second
sets `self.tickFont`. Only `self.tickFont` is actually used.
This PR replaces all occurrences of the second variable with the first
variable, so both options work again. Also, documentation from
`setStyle` is copied to `setTickFont`.

Co-authored-by: 2xB <2xB@users.noreply.github.com>
2020-05-04 14:58:29 -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
Ales Erjavec
02b7532706 Remove use of GraphicsScene._addressCache in translateGraphicsItem
Use QGraphicsItem.toQGrapicsObject on the item instead.

This probably is not even needed since PyQt 4.9
2020-05-01 13:05:51 +02:00
Lev Maximov
a76d9daec2
Date axis item (#1154)
* Add DateAxisItem

* Change style to camelCase

* Fix missing first tick for negative timestamps

* Add ms precision, auto skipping

Auto skipping allows a zoom level to skip ticks automatically if the
maximum number of ticks/pt is exceeded

* fixes suggested by @goetzc

* workaround for negative argument to utcfromtimestamp on windows

* attachToPlotItem method

* default date axis orientation

* Use new DateAxisItem in Plot Customization example

* attachToPlotItem bugfix

* examples of DateAxisItem

* modified description of customPlot example

* added descriptions to the new examples, reformatted their code, included the first one into utils.py

* typo

* Refactored code for setting axis items into new function

Replaces "DateAxisItem.attachToPlotItem"

* Fix string comparison with ==

* Doc: Slightly more text for DateAxisItem, small improvement for PlotItem

* Make PlotWidget.setAxisItems official

* Fix typo in docstring

* renamed an example

* merge bug fix

* Revert "merge bug fix"

This reverts commit 876b5a7cdb.

* Real bug fix

* support for dates upto -1e13..1e13

* Automatically limit DateAxisItem to a range from -1e12 to 1e12 years

Very large years (|y|>1e13) cause infinite loop, and since nobody
needs time 100 times larger than the age of the universe anyways,
this constrains it to 1e12.

Following suggestion by @axil:
https://github.com/pyqtgraph/pyqtgraph/pull/1154#issuecomment-612662168

* Also catch ValueErrors occuring on Linux before OverfloeErrors

While zooming out, before hitting OverflowErrors, utctimestamp
produces ValueErrors (at least on my Linux machine), so they
are also catched.

* Fix: Timestamp 0 corresponds to year 1970

For large years, x axis labels jump by 1970 years if it is not
accounted for timestamp 0 to be equal to year 1970.

* Fix: When zooming into extreme dates, OSError occurs

This commit catches the OSError like the other observed errors

* Disable stepping below years for dates outside *_REGULAR_TIMESTAMP

2 reasons: First: At least on my Linux machine, zooming into
those dates creates infinite loops. Second: Nobody needs
sub-year-precision for those extreme years anyways.

* Adapt zoom level sizes based on current font size and screen resolution

This is somewhat experimental. With this commit, no longer 60 px are
assumed as width for all zoom levels, but the current font and
display resolution are considered to calculate the width of ticks in
each zoom level. See the new function `updateZoomLevels` for
details.
Before calling this function, overridden functions `paint` and
`generateDrawSpecs` provide information over the current display
and font via `self.fontScaleFactor` and `self.fontMetrics`.

* Meaningful error meassage when adding axis to multiple PlotItems

As @axil noted in the DateAxisItem PR, currently users get a
segmentation fault when one tries to add an axis to multiple
PlotItems. This commit adds a meaningful RuntimeError message
for that case.

* setZoomLevelForDensity: Refactoring and calculating optimal spacing on the fly

* DateTimeAxis Fix: 1970 shows when zooming far out

* Refactoring: Make zoomLevels a customizable dict again

* updated the dateaxisitem example

* Fix: Get screen resolution in a way that also works for Qt 4

This is both a simplification in code and an improvement in backwards compatibility with Qt 4.

* DateAxisItem Fix: Also resolve time below 0.5 seconds

* unix line endings in examples

* DateTimeAxis Fix: For years < 1 and > 9999, stepping broke

Stepping was off by 1970 years for years < 1 and > 9999,
resulting in a gap in ticks visible when zooming out. Fixed by
subtracting the usual 1970 years.

* DateTimeAxis Fix: Zooming out too far causes infinite loop

Fixed by setting default limits to +/- 1e10 years. Should still
be enough.

* improved second dateaxisitem example

* 1..9999 years limit

* DateTimeAxis: Use OrderedDict to stay compatible with Python < 3-6

* DateAxisItem: Use font height to determine spacing for vertical axes

* window title

* added dateaxisitem.rst

* updated index.rst

Co-authored-by: Lukas Heiniger <lukas.heiniger@sed.ethz.ch>
Co-authored-by: Lev Maximov <lev.maximov@gmail.com>
Co-authored-by: 2xB <2xB@users.noreply.github.com>
2020-04-27 11:43:22 -07:00
Marcel Schumacher
a697b5584a Fixed a possible race condition with linked views 2020-04-14 17:24:54 +02:00
2xB
ec66c34fc9 GraphicsLayout: Always call layout.activate() after adding items
Items added to a `GraphicsLayout` only learn their size information
after the internal `QGraphicsGridLayout` recalculates the layout.
This is happening as a slot in the Qt event queue.
Not having updated geometry bounds directly after adding an item
leads to multiple issues when not executing the Qt event loop
in time (see below). This commit fixes that by always calling
`layout.activate()` after adding items, updating item sizes
directly.

This is a follow-up to PR #1167, where introducing a direct call to
`processEvents` was suspected to be able to cause side effects.

Notifying @j9ac9k and @campagnola, as they were involved in #1167.

Fixes #8
Fixes #1136
2020-04-14 02:00:49 +02:00
2xB
71636e3518 Fix: Update axes after data is set 2020-04-08 17:11:20 +02:00
lcmcninch
a5dd549be1
Pass showAxRect keyword arguments to setRange to allow caller to set padding, etc. (#1145)
Co-authored-by: Luke McNinch <lucas.c.mcninch.civ@mail.mil>
2020-04-03 15:33:21 -07:00
Kenneth Lyons
db67a256a9
Miscellaneous doc fixups (#1142)
* Miscellaneous doc cleanup

* Moved dockarea up a level (like flowchart, parametertree). Removed extraneous parametertree doc
2020-04-03 10:06:25 -07:00
Ogi Moore
a8d1a84870
Merge pull request #1063 from ales-erjavec/view-box-enable-menu-fix
Fix: AttributeError in ViewBox.setEnableMenu
2020-03-06 16:16:14 -08:00
Ogi Moore
93f8ee9f0a
Merge pull request #1111 from JoeXinfa/add-label
Add name label to GradientEditorItem
2020-03-06 15:30:57 -08:00
Ogi Moore
5cd19ba7a0
Merge pull request #1139 from SamSchott/patch-1
Bug fix in LegendItem for `setPen`, `setBrush` etc
2020-03-06 11:26:48 -08:00
SamSchott
3509d79c0f
bug fix for setPen, setBrush, ...
Fixes a bug where `setPen`, `setBrush` and `setLabelTextColor` would fail because they call `LegendItem.paint` without a pen. They should instead call `LegendItem.update`.
2020-03-06 15:02:39 +00:00
Ogi
3158c5b4db Use int() instead of .__int__() 2020-02-29 14:38:19 -08:00