Commit Graph

1239 Commits

Author SHA1 Message Date
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
Kenneth Lyons
a703155a21 Replace default list arg with None 2020-04-11 20:15:00 -07:00
2xB
be1ed14bd0 pg.mkQApp: Pass default application name to Qt, added documentation 2020-04-12 00:43:16 +02:00
Ogi Moore
6f4048596b
Merge pull request #1156 from 2xB/2xb-fix-1155
SVGExporter: Correct image pixelation.
2020-04-09 07:52:46 -07:00
2xB
71636e3518 Fix: Update axes after data is set 2020-04-08 17:11:20 +02:00
2xB
1e81f3dad0 SVGExporter: Correct image pixelation. 2020-04-08 01:14:36 +02:00
Ogi Moore
88931bc4a5
Merge pull request #1152 from ixjlyons/fnanfix-test
Fnanfix test
2020-04-03 18:39:10 -07:00
Kenneth Lyons
988e5c1222 Test makeARGB with nans 2020-04-03 17:56:38 -07:00
Jan Kotanski
6f34da586d remove second nanMask = np.isnan(data) 2020-04-03 17:56:38 -07:00
Jan Kotanski
daeacad71f Make nanMask compatible with 3D data 2020-04-03 17:56:11 -07:00
Jan Kotanski
61967bd7f7 add nanfix 2020-04-03 17:49:34 -07: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
7cbc703449
Merge pull request #1151 from ixjlyons/imageexporter-tests
ImageExporter py2-pyside fix with test
2020-04-03 09:46:45 -07:00
Kenneth Lyons
3ba76475d4 Added ImageExporter test for py2-pyside fix 2020-04-03 09:30:23 -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
f61d38ba8b
Merge pull request #1110 from jkotan/nextafter2
fix for makeARGB error after #955
2020-03-06 13:32:11 -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
Unknown
6985be2a6f replaced incompatible string construction 2020-03-01 17:46:01 +01: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
7199a4f4ce deepcopy(dict) does not necessarily preserve insertion order 2020-02-28 14:25:34 -08:00
Ognyan Moore
3195ed4c8f Skip some tests on pyside2 2020-02-26 10:06:02 -08:00
Ogi
19ae94765f Skip tests involving loadUi with pyside2 5.14 2020-02-24 23:00:42 -08:00
Ogi
428af4950d unskip py3 tests, weakref works fine in a list 2020-02-24 23:00:09 -08:00
Ognyan Moore
f0d1c4eda1 Skipping problematic test on py2/qt4/linux 2020-02-24 22:30:27 -08:00
Xinfa Joseph Zhu
660ac675f1 Fix typo bug 2020-01-09 15:23:49 -06:00
Jan Kotanski
65d2ac58e0 fix for nextafter 2020-01-08 21:19:09 +01:00
Kenneth Lyons
61104cd43c Fix small oversight in LegendItem 2019-12-24 10:04:31 -08:00
Ogi Moore
db483f8ec2
Merge pull request #1082 from pyqtgraph/revert-360-develop
Redo "Allow MetaArray.__array__ to accept an optional dtype arg"
2019-11-25 06:52:44 -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
Ognyan Moore
ef4ca9e9ea Incorporated correction luke suggested 2019-11-21 08:46:25 -08:00
Ogi Moore
770ce06dc1
Revert "Allow MetaArray.__array__ to accept an optional dtype arg" 2019-11-21 08:42:44 -08:00
Ogi Moore
78e218fe6c
Merge pull request #360 from nfirvine/develop
Allow MetaArray.__array__ to accept an optional dtype arg
2019-11-20 22:17:18 -08:00
Ogi Moore
71c4807559 fix dict eq() checks 2019-11-20 21:54:56 -08:00
Ogi Moore
477feb777b import h5py.highlevel is deprecated, use import h5py instead 2019-11-20 21:54:56 -08:00
Luke Campagnola
a8529e48f3 faster keys comparison 2019-11-20 21:54:56 -08:00
Luke Campagnola
7cb27594a5 fix dict keys comparison 2019-11-20 21:54:56 -08:00
Luke Campagnola
542f4b446b Add eq() support for comparing dict, list, tuple 2019-11-20 21:54:56 -08:00
Luke Campagnola
e58b7d4708 minor correction 2019-11-20 21:54:56 -08:00
Luke Campagnola
c484c86417 don't modify info from v1 files, move info correction to hdf reading 2019-11-20 21:54:56 -08:00
Paul B. Manis
ae61d3582e Py2/3 MetaArray adjustments, first pass 2019-11-20 21:54:56 -08: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
rwalroth
455fdc2a2a Allowed actions to diplay title instead of name (#1069)
ActionParameterItem changed so that if there is
a title it will be displayed, otherwise displays name.
2019-11-19 20:05:45 -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