Commit Graph

825 Commits

Author SHA1 Message Date
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
Ognyan Moore
6ed8a405fe Address FutureWarning about implicit float to int conversions 2020-02-28 14:27:10 -08:00
Ognyan Moore
f0d1c4eda1 Skipping problematic test on py2/qt4/linux 2020-02-24 22:30:27 -08:00
Kenneth Lyons
61104cd43c Fix small oversight in LegendItem 2019-12-24 10:04:31 -08:00
Paul Müller
2a01c3848a
fix wrong offset when drawing symbol 2019-11-25 14:14:15 +01:00
Paul Müller
b02ada024b
fix error on SVG export of scatter plots: KeyError: 'resolutionScale' 2019-11-23 13:10:49 +01:00
SamSchott
c0ae44bc2d Nicer legend (#958)
* More customizable and nicer legend.

- Give kwargs for legend frame and background colors instead of hard-coded values.
- Reduce spacing for more compact legend
- Give separate kwarg `labelTextColor`.
- New method to clear all legend items.
- New methods to get and change `offset` relative to the legend's parent.
- Horizontal instead of tilted lines for legend pictures.
2019-11-19 21:42:31 -08:00
SamSchott
c95ab570b1 set color of tick-labels separately (#841) 2019-11-19 20:43:27 -08:00
boylea
b1b2f4662b Fixed image scatter plot export bug (#88) 2019-11-19 20:03:15 -08:00
Paul Müller
267a0af8e7 Reset currentRow and currentCol on clear (#1076) 2019-11-19 08:21:36 -08:00
Daniel Hrisca
15a1f5af94 improve performance of updateData PlotCurveItem (saves about 2us per call) (#1079)
* improve performance of updateData PlotCurveItem (saves about 2us per call)
2019-11-19 08:14:53 -08:00
Kenneth Lyons
faef56c3e7 Qulogic py3 fixes (#1073)
* py3k: Remove reduce calls.

* py3k: Remove compatibility sortList function.

Sorting by key has existed since Python 2.4.

* Remove unnecessary sys.path manipulation.

This file doesn't have any __main__ code to run anyway.

* Use context manager
2019-11-12 08:45:42 -08:00
Kenneth Lyons
f5e25622a7 Validate min/max text inputs in ViewBoxMenu (#1074) 2019-11-12 08:36:16 -08:00
Ales Erjavec
a65b8c91f7 Add simple test for setEnableMenu 2019-11-06 10:59:51 +01:00
Ales Erjavec
50cf2f561f Move common code to _applyEnableMenu 2019-11-06 10:58:00 +01:00
Ales Erjavec
a84953530f Fix: setEnableMenu in ViewBox 2019-10-28 14:30:22 +01:00
Agamemnon Krasoulis
f2740f7e69 Fix typo in documentation (#1062) 2019-10-22 09:45:45 -07:00
2xB
ed6586c7dd Removed unnecessary enlargement of bounding box (#1048) 2019-09-30 09:15:03 -07:00
Kenneth Lyons
61ec73a741 Close windows at the end of test functions (#1042)
* Close windows at the end of test functions

* Can't show window deletion warning during interpreter shutdown
starting
2019-09-27 13:37:40 -07:00
Kenneth Lyons
b7f1aa88cd Cast to int after division 2019-09-22 17:03:30 -07:00
Kenneth Lyons
c94b1cb99e Always update transform when setting angle of a TextItem (#970)
* Always update transform when setting angle of a TextItem

* Add test to check TextItem.setAngle

* Relax test a bit but still check that setAngle has an effect

* Add docstring to setAngle

* Remove unneeded numpy testing function imports
2019-09-13 22:04:48 -07:00
2xB
061a30e827 Correctly include SI units for log AxisItems (#972) 2019-09-12 21:58:49 -07:00
2xB
bfd36dc203 Prevent element-wise string comparison (code by @flutefreak7) (#1024) 2019-09-12 21:30:39 -07:00
2xB
8309b53014 Fix: Reset ParentItem to None on removing from PlotItem/ViewBox (#1031) 2019-09-12 21:00:38 -07:00
Jindřich Makovička
bbc11b96a9 Configurable GridItem tick spacing and pen color (#101) 2019-09-12 14:50:43 -07:00
2xB
b7b431de8d FIX: Curves are automatically set visible when one is deleted (#987)
* Do not automatically set all curves visible

* Improved array iteration in PlotItem.updateDecimation
2019-08-17 20:36:34 -07:00
2xB
d77ad273c7 Fix: Item on ViewBox causes duplicate paint calls (#1017)
* Fix: Item on ViewBox causes duplicate paint calls

* Assure call of ViewBox.updateMatrix on resizeEvent

* Fix: Disable autorange on "ViewBox.setRange" before updateAutoRange is called
(Called via updateViewRange -> update -> prepareForPaint)
2019-08-17 11:52:45 -07:00
2xB
05aa3e9393 Add 'fillOutline' option to draw an outline around a filled area (#999) 2019-08-17 09:57:40 -07:00
2xB
08c0de768b Warn if visible GraphicsView is garbage collected (#942)
* Warn if visible window is garbage collected

* (Py)Qt does not rely on Python GC

* Only warn if deleted widget has no parents (if it is a standalone window)

* Hide windows when closing

* Only implement GraphicsView.__del__ if it does not prevent circular reference garbage collection
2019-08-16 22:32:06 -07:00
Ogi Moore
750ec5a1f9
Merge pull request #996 from kevinanewman/patch-1
Update LegendItem.py
2019-08-16 21:19:18 -07:00
Ogi Moore
b7a3237361
Merge pull request #1010 from Axel-Jacobsen/develop
BarGraphItem CSV/image export
2019-08-16 20:42:58 -07:00
Ogi Moore
9bb82a8af2
Merge pull request #1015 from 2xB/always_nparray
Always convert PlotDataItem data to NumPy array
2019-08-16 20:29:06 -07:00
2xB
8d2c16901b Merge master into develop (#981)
* Information is spelled with an r, even in comments
2019-08-16 20:16:01 -07:00
2xB
abd028436a Always convert PlotDataItem data to NumPy array 2019-08-08 16:58:28 +02:00
Axel Jacobsen
18661cab0d BarGraphItem CSV export and documentation 2019-08-06 09:32:43 -07:00
Kevin Newman
6648db031e
Update LegendItem.py
Propose adding a clear() method (or equivalent) for easier legend re-use with dynamically updated plots...
2019-07-17 08:37:16 -04:00
Luke Campagnola
138fdd0af2 relax image comparison for failing windows test (#979)
relax image comparison for failing windows test
2019-07-02 06:57:45 -04:00
Luke Campagnola
cff9cfa98d Reduce test window size for OSX compatibility 2019-07-01 19:00:18 -07:00
Ogi Moore
04114fa126
Merge pull request #968 from ecejeff/unit-label-fix
Fix for AxisItem using old scale to create label
2019-07-01 07:01:05 -07:00
Ogi Moore
18bfee3462
Merge pull request #333 from ombschervister/legend_fix
fix legendItem drag
2019-06-27 14:44:55 -07:00
Jeffrey Nichols
d9f0da5a7c
Fix for AxisItem using old scale to create label 2019-06-27 14:45:37 -04:00
Ogi Moore
82d690e08d
Merge pull request #321 from espdev/fix-issue316
Fixing the border rect overlapping for ViewBox and GraphicsLayout
2019-06-26 22:33:21 -07:00
fake-name
8fa6410382 Moar dumb typos. I managed to totally bugger up the rebase. 2019-06-24 14:14:04 -07:00
fake-name
14925b7fe3 Gah, forgot to add this. 2019-06-24 14:11:54 -07:00
fake-name
3f71276ac3 Fix more mkPen invocations that got added for some reason. 2019-06-24 14:02:19 -07:00
fake-name
18999c2ca1 Consolidate to simpler get is not none check. 2019-06-24 14:01:53 -07:00
Connor Wolf
17e90af36c Avoid constructing shadow pens when no shadow pen is set
Basically, profiling has pointed me to the fact that a fair bit of code time is spent in `setShadowPen()` (actually, it's in `mkPen()`, which `setShadowPen()` calls), even when no shadow pen is specified.

In my application, I'm calling `pyqtgraph.PlotDataItem.setdata()`, which calls through PlotDataItem->setData, PlotDataItem->updateItems. At some point in the call stack, the default value for `shadowPen` is being inserted into the kwargs, which then causes the specious calling of setShadowPen.

Anyways, if we check if shadowPen is a value other then none, this doesn't happen.
2019-06-24 14:01:17 -07:00
Sam Schott
d870a34359 add a test for clipping 2019-06-24 14:49:32 +01:00
Eugene Prilepin
1955ae024c Fix: object has no attribute 'border' 2019-06-24 16:36:23 +03:00
Eugene Prilepin
001390c160 Bugfix: GraphicsLayout border drawing
- Fixed border overlapping (issue #316)
2019-06-24 16:21:00 +03:00
Eugene Prilepin
b491f82006 Bugfix: ViewBox border drawing
- Fixed border overlapping (issue #316)
- Added new method ViewBox.setBorder to complete API
2019-06-24 16:21:00 +03:00
Sam Schott
262004e2ec Merge remote-tracking branch 'upstream/develop' into patch-3 2019-06-24 13:54:08 +01:00
Sam Schott
f23889d594 only use np.searchsorted quicker method fails 2019-06-24 13:53:00 +01:00
Ogi Moore
053fca6e83
Revert "_updateMaxTextSize to reduce text size when no longer needed (#838)" (#957)
This reverts commit 0ba07300e1.
2019-06-23 21:41:20 -07:00
SamSchott
0ba07300e1 _updateMaxTextSize to reduce text size when no longer needed (#838)
Currently `_updateMaxTextSize ` will increase the current space required for axis labels, if necessary, but not decrease it when the extra space is no longer needed. The proposed change will release no longer needed space again.
2019-06-23 18:10:35 -07:00
Daniel Hrisca
297e1d95a5 avoid double call to mkPen when creating PlotCurveItem objects (#817)
* avoid double call to mkPen when creating PlotCurveItem objects

* avoid unnecessary calls to mkPen in paint
2019-06-23 17:30:40 -07:00
SamSchott
3e7cace746 tickSpacing bug fix (#836)
Fixed a bug where `tickSpacing()` would return `None` if `style['maxTickLevel'] < 2`, resulting in the axis not being drawn.
2019-06-23 17:27:16 -07:00
SamSchott
1b6537b241 Curve fill: draw line around patch (#922) 2019-06-23 17:07:55 -07:00
Ben Mathews
dea8a86dfd Fixes https://github.com/pyqtgraph/pyqtgraph/issues/950 (#951)
Moving a scale handle on a ROI object does not fire a sigRegionChangeStarted signal.  This patch adds the signal emit to handleMoveStarted().
2019-06-23 17:05:11 -07:00
2xB
e510971d71 RotateFree handle now rotates freely (Code by alguryanow) (#952) 2019-06-23 17:01:32 -07:00
2xB
781e129725 Fix deprecation warning of multi-dimensional tuples (#947) 2019-06-21 21:18:12 -07:00
Ogi Moore
132f417f72
Merge pull request #935 from 2xB/addLine-fix70
PlotItem.addLine now accepts 'pos' and 'angle' parameters
2019-06-20 09:18:57 -07:00
Janez Demšar
9b8ef188a5 Fix incorrect clipping of horizontal axis when stopAxisAtTick is set (#932)
Horizontal axis are clipeed incorrectly because the code always takes
the vertical coordinate of the span even if the axis is horizontal.
2019-06-19 22:07:57 -07:00
2xB
04baa6eef7
addLine now accepts 'pos' and 'angle' parameters
The issue and this solution are discussed in issue https://github.com/pyqtgraph/pyqtgraph/issues/70.
2019-06-20 04:37:09 +02:00
2xB
4a592ef10e
Prevent element-wise string comparison
Issue #835 shows that comparing `bins`, which may be a numpy array, with a string `'auto'` leads to element-wise comparison, because the `==` operator for numpy arrays is used. With this commit, potential array and string are switched, so the `==` operator for strings is used, which does no element-wise comparison.
2019-06-17 19:10:32 +02:00
Ogi Moore
3482a8436c
Merge pull request #914 from j9ac9k/fix-lastScene-signal-reference
Fix attribute lookup reference
2019-06-09 18:24:58 -07:00
Ogi Moore
172120106d
Merge pull request #861 from ixjlyons/errorbaritem-set-path
Set path attr in case ErrorBarItem initialized without data
2019-06-09 09:23:36 -07:00
Kenneth Lyons
c5126dc26f Update test name. Cleanup unused imports. 2019-06-09 09:12:01 -07:00
Kenneth Lyons
0c84234612 Add a test for ErrorBarItem 2019-06-08 19:57:53 -07:00
Ogi
9f7a4423af Fix attribute lookup reference 2019-06-07 15:06:59 -07:00
Kenneth Lyons
1839c5ef59
More concise visibility setting logic 2019-06-07 13:32:25 -07:00
Kenneth Lyons
a2fb00633a DeMorgans the logic for better readability. 2019-06-07 00:00:30 -07:00
Kenneth Lyons
654b76e6a3 Handle setting/clearing data a little more robustly. 2019-06-06 23:57:34 -07:00
Kenneth Lyons
501ad4f082 Only set visible when ErrorBarItem has something to draw. 2019-06-06 23:45:28 -07: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
Ogi Moore
e7cbc12491
Merge pull request #813 from danielhrisca/axisitem_tweak
AxisItem performance improvements
2019-05-31 22:16:46 -07:00
Ogi Moore
99480dd184
Merge pull request #907 from jetperch/develop
Fixed ViewBox.updateViewRange to apply transformation sooner
2019-05-31 21:05:29 -07:00
Ogi Moore
1616e99b3a Fix docstring warning 2019-05-30 14:40:39 -07:00
Ogi
2df71abfec We support pyside2 don't we? 2019-05-30 14:40:39 -07:00
Matt Liberty
b3c0bf635d Fixed ViewBox.updateViewRange so that transformation is updated for sigXRangeChanged and sigYRangeChanged in PySide2. 2019-05-29 20:02:00 -04:00
Ogi Moore
4b26519fef Move Desktop Resolution info print statement to test.py 2019-05-29 13:07:08 -07:00
Ogi
aa63c07523 Show available desktop resolution 2019-05-28 22:57:12 -07:00
Kenneth Lyons
deab37d533 Try to import from collections.abc for Python 3.3+ (#887)
* Try to import from collections.abc for Python 3.3+
2019-05-25 16:25:49 -07:00
Ogi Moore
c71083fff8
Merge pull request #767 from jimofthecorn/develop
fixed bug in graphicsItems/ImageItem.py: degenerate images (max==min)
2019-05-23 23:33:27 -07:00
Ogi Moore
e338447c37
Merge pull request #771 from 2xB/logscale_noruntimewarning
No warning for arrays with zeros in logscale
2019-05-23 23:24:03 -07:00
Ogi Moore
66604593c1
Merge pull request #814 from danielhrisca/enforce_enableMenu
enforce enableMenu in ViewBox
2019-05-23 23:22:52 -07:00
Ogi Moore
9ca9ae3911
Merge pull request #815 from ZanSara/develop
Fix issue #811
2019-05-23 22:44:19 -07:00
Ogi Moore
4a76fff11a
Merge pull request #417 from termim/PlotDataItem_clear
In PlotDataItem.clear() use corresponding curve.clear() and scatter.clear()
2019-05-23 21:52:50 -07:00
Kenneth Lyons
2817b95c93 Set path attr in case ErrorBarItem initialized without data 2019-05-03 18:45:15 -07:00
MingZZZZZZZZ
b773b020a5
Update LegendItem.py 2019-03-25 18:02:04 -04:00
SamSchott
365c13fedc
Clipping: don't assume that x-values have uniform spacing
Do not assume that x-values have uniform spacing -- this can cause problems especially with large datasets and non-uniform spacing (e.g., time-dependent readings from an instrument).

Use `np.searchsorted` instead to find the first and last data index in the view range. This only assumes that x-values are in ascending order. This prevents potentially too strong clipping.
2019-03-14 22:41:10 +00:00
Thomas A Caswell
0649ff8f3c
MNT: do not use 'is not' on literal
py38 raises a SyntaxWarning on this
2019-02-14 16:41:06 -05:00
Thomas A Caswell
4fe90bb215
MNT: escape docstrings that have rst escaping in them 2019-02-14 16:39:45 -05:00
Thomas A Caswell
691da09eb0
MNT: do not use 'is' with literals, use ==
py3.8 gives a syntax warning on this
2019-02-14 16:36:02 -05:00
danielhrisca
82d2b757e4 speed up AxisItem __init__ 2019-01-18 10:32:10 +02:00
Sara Zanzottera
e4681b7201 Fix issue #811 2019-01-17 11:19:16 +01:00
danielhrisca
5a53539be0 enforce enableMenu in ViewBox 2019-01-16 17:04:59 +02:00
danielhrisca
b575b56edf avoid calling setLabel repeatedly for AxisItem 2019-01-16 16:44:00 +02:00
MingZZZZZZZZ
7e09022e67
add legend for bar graph items 2018-12-21 01:45:00 -05:00
Luke Campagnola
2e69b9c5e6 Add changelog entry and credit for previous PR 2018-11-09 07:18:36 -08:00
Luke Campagnola
753c291bcd
Merge pull request #446 from WFrsh/develop
Included matplotlib 2.0 colormaps
2018-11-09 07:08:39 -08:00