Commit Graph

327 Commits

Author SHA1 Message Date
Marko Bausch
4052f0dd11 Added context menu option to paramtree 2020-05-22 16:05:52 +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
Ogi Moore
556ba55be3
Merge pull request #1124 from dargor/color_examples
Syntax highlighting for examples.
2020-03-08 07:19:54 -07:00
Gabriel Linder
d0b92349dd
Intercept light/dark modes transitions on MacOS. 2020-03-08 10:34:54 +01:00
Gabriel Linder
412698c8bb
Dark mode support. 2020-03-07 23:02:40 +01:00
Ogi
19ae94765f Skip tests involving loadUi with pyside2 5.14 2020-02-24 23:00:42 -08:00
Gabriel Linder
adba81a8d8
Syntax highlighting for examples. 2020-02-11 11:23:58 +01:00
Ogi Moore
2203933393
Declare scipy optional (#1067)
* Replace use of scipy.random with numpy.random

* Update README to reflect scipy being an optional depenency
2019-11-12 09:02:08 -08:00
Elliott Sales de Andrade
d726a9693e Fix UnboundLocalError in VideoSpeedTest. 2019-09-13 01:07:57 -04:00
Ogi Moore
584c4516f0
Expand CI + pre-commit (#991)
* Initial attempt at extra checks in CI land

* Adding flake8 config

* Adding pre-commit configuration and explanation in CONTRIBUTING.md
2019-08-29 13:56:25 -07:00
2xB
05aa3e9393 Add 'fillOutline' option to draw an outline around a filled area (#999) 2019-08-17 09:57:40 -07:00
Ogi
fe637512b5 Skip GL* examples if on macOS with python2 and qt4 bindings, and update readme 2019-06-25 23:05:38 -07:00
2xB
edf2942010 Replaced usage of deprecated ROI classes in example (#946) 2019-06-21 21:19:02 -07:00
Ogi Moore
0cc4900d7a
Skip some test examples (#937)
* Skip RemoteSpeedTest.py during testing
* Skip `optics_demos.py` test on PySide 1. 2.4  due to documented pyside bug
2019-06-21 08:36:42 -07:00
Ogi
f05ff6fbf9 Restore duplicate entries in examples app, but test_examples does not duplicate tests 2019-06-10 21:20:31 -07:00
Ogi
be0e95ace7 Incorporating requested changes 2019-06-03 20:49:31 -07:00
Ogi
9f66b7dc6e Much better error reporting/tracepacks on examples 2019-06-02 22:16:35 -07:00
Ogi
d2331bde7f Removing duplicate entries 2019-06-01 22:36:29 -07:00
Ogi
5ff409ba4b Move example test code such that pytest is required 2019-06-01 22:36:11 -07:00
Ogi Moore
eb90616ae2
Merge pull request #905 from 2xB/test_exclude_examples
Exclude selected examples from tests (such as HDF5)
2019-05-31 22:28:54 -07:00
Luke Campagnola
52fef555ee
Merge pull request #904 from j9ac9k/take-screenshots
Take screenshots + Show Resolution
2019-05-29 13:12:12 -07:00
2xB
560993e8c5 Exclude selected examples from tests (such as HDF5) 2019-05-29 11:16:09 +02:00
Ogi
f2aeea8964 We support pyside2 don't we? 2019-05-28 22:57:12 -07:00
2xB
a37e877631 Add PyQt5 and PySide2 to test_example.py (#897)
* Add PySide2 to test_example.py

Before, example tests are skipped because no PyQt version was found
2019-05-27 21:07:25 -07:00
Luke Campagnola
2884eef079 Add ViewBoxFeatures to example menu 2018-07-10 05:56:35 -07:00
Luke Campagnola
f8efbec53f Add image hover callback to imageAnalysis example 2018-07-07 00:10:15 -07:00
Luke Campagnola
08349351da Fix QString handling 2018-06-22 17:31:58 -07:00
Luke Campagnola
3fd56eb195 Handle Qt4/5 API difference in filedialog 2018-06-22 17:26:31 -07:00
Luke Campagnola
060d2479f9 minor fixes 2018-06-15 14:18:38 -07:00
Luke Campagnola
69645895c9 flip template line endings 2018-05-24 08:54:31 -07:00
Luke Campagnola
ebc805a45f workaround pyside bug #671 2018-05-23 21:12:16 -07:00
Luke Campagnola
66dcfc7c67 Merge branch 'develop' into pyside2 2018-05-22 15:22:54 -07:00
Luke Campagnola
8da208b914 flip pyside2 template line endings 2018-05-17 09:02:41 -07:00
Luke Campagnola
4d26b4bb20 Fix py3 string handling in scatterplotwidget example 2018-05-09 10:56:01 -07:00
Luke Campagnola
3f0a13d170
Merge pull request #658 from iillyyaa/py3-examples-division
examples: use integer division in indexing
2018-04-25 16:21:37 -07:00
Luke Campagnola
e61bbeda41 Merge branch 'develop' into datatree-arrays 2018-04-25 11:25:57 -07:00
Ilya A. Kriveshko
20bcc39eb1 examples: use integer division in indexing
In python3 / operator produces a float, which is not a valid index.
Replace with // integer division.
2018-03-30 14:51:29 -04:00
Luke Campagnola
043a3b4d6d Better title 2018-03-29 18:30:46 -07:00
Luke Campagnola
1e1ce78a51 Merge branch 'Add_window_title' of https://github.com/Billy4195/pyqtgraph into Billy4195-Add_window_title 2018-03-29 18:30:25 -07:00
Luke Campagnola
840e0ac600
Merge pull request #630 from Billy4195/Refactor
Refactor MultiPlotSpeedTest.py
2018-03-29 18:11:39 -07:00
Luke Campagnola
358b1539ee add reduce import to fractal demo 2018-03-29 08:49:42 -07:00
Luke Campagnola
82afad8366 Fix up Qt.py and deprecate USE_XX variables 2018-02-16 20:42:34 -08:00
Billy Su
afd8a6f423 Replace deprecate class in examples
Using class GraphicsLayoutWidget to replace the deprecated class
GraphicsWindow, cc #631.
2018-02-16 12:21:39 +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
Billy Su
81562b0252 Refactor MultiPlotSpeedTest.py
* Change variable to meaningful name,
* Remove the outdated commented out code.
2018-02-03 11:01:03 +08:00
Billy Su
8a956bfddb Add main window title for the examples 2018-02-02 23:05:56 +08:00
Terekhov
551ccd105c Add an example of using text strings as a custom smbol in ScatterPlotItem 2018-01-29 21:18:26 -05:00
Luke Campagnola
870c047d30
Merge pull request #621 from campagnola/rgb-histogram
Rgb histogram
2018-01-26 08:52:10 -08:00
Luke Campagnola
677d9fa4b4
Merge pull request #597 from campagnola/fractal-demo
Add an interactive fractal demo
2018-01-25 08:59:28 -08:00
Luke Campagnola
0653c8ec59 Add example and test demonstrating spinbox bug 2018-01-24 09:11:42 -08:00