Alternative ScaleBar #1991
Replies: 1 comment
-
Sorry I didn't get to this earlier, I saw your post, but only just now remembered I didn't reply, my apologies 😬
Sounds like that sort of thing is right up the alley of this library, hopefully PyQtGraph has met your needs so far! I haven't ever used ScaleBar; I'm not sure how wide-spread it's used. While it is tempting to recreate from scratch, that often runs into issues involving backwards compatibility. Should a PR be proposed that entirely replaces ScaleBar, a new implementation won't be a deal breaker, but I urge some caution here is all. I wouldn't worry about light weight/heavy-weight, at first thought, I don't differentiate between the two in that way. In terms of comment on side-effects, nothing immediately comes to mind, someone else around these parts may have more import, but I would still recommend trying to modify the existing ScaleBar would be a good starting place; and try and patch up features in there one by one. Also, as most things with plotting libraries, images/screenshots can go a long way too. Sorry I don't have better advice to offer! |
Beta Was this translation helpful? Give feedback.
-
Hello, I like pyqtgraph very much and it is really pleasant to use it for scientific software solutions. I am currently developing HussariX - the software for opening, inspecting and manipulating X-ray data and electronic images from few scanning electron microscopes, and electron µ-probe analizers. For plotting spectral curves I had already sub-classed/customised some
AxisItem
(to hold lower bound, and change only upper bound). Currently I am trying to sort out how to represent the raster image type of data. Scale bar would be nice to have. However,ScaleBar
provided bypyqtgraph
is far from what I would want to have. First of all it is not very scale-able, the whole point to have dynamic scalebar is that it allows to zoom-in and out and shows what scale is. Current implementation sets fixed length of bar, which with strong zoom out makes scalebar to appear unreadable tiny, and with zooming-in it makes scale overfill canvas width (again scale is unreadable).So I was thinking if not to try implement that from scratch, and make it more like
AxisItem
, but paint only single segment. Some code for dynamic scale is already present in theAxisItem
and could be borrowed.That looks good approach also as personally I hate then scale bars (and other info) is being overlain directly on images (most of microscope vendors do that). The downside would be that such "ScaleBar" would be usable not with lightweight
ViewBox
, but heavyweightPlotItem
. For me that would be even better as 1) images has its coordinates, and I plan to plot few images at its coordinates, where ViewBox looks for me to not care for coordinates. (on viewbox imageitem needs to be scaled, where onPlotItem
to place at scale and place can be used calculated bounding box) 2) other type of data will be plotted over (analytical points as Scatter points, which have its x, y positions).I should probably leave
ScaleBar
as is, and implementAxisScaleBar
as new type of class.Could my idea have some not well thought side-effects?
Would something like this be of interest for broader
pyqtgraph
community, or I should keep that for my own use?Looks that issue #1905 addresses the problem with ScaleBar, but there was no PR proposed.
Beta Was this translation helpful? Give feedback.
All reactions