Discussion:
[pyqtgraph] How to make "top" and "bottom" axis not show same range
Luka Drmic
2018-11-29 11:24:15 UTC
Permalink
Hello.

As shown on image below i have two plots, one showing an image, and the
other one for displaying data under LineROI on the image plot.

[image: MultipleAxisQuestion.png]
Also as shown on the image i would like to make one of the x axis show
range displayed as x1, and the other one show range displayed as x2.

Currently translate and scale line trace graph to be aligned with segment
marked x1, and i would like to align "bottom" axis with x1, and "top" axis
with x2.

Current way of doing things. Each time a ROI has moved i call the following
method.

data = self.displayed_data_set
img = self.plot_elements["img"]
selected = self.line_segment_roi["ROI"].getArrayRegion(data, img)
line_trace_graph = self.plot_elements["line_trace_graph"]
new_plot = line_trace_graph.plot(selected, pen=(60, 60, 60), clear=True)
point = self.line_segment_roi["ROI"].getSceneHandlePositions(0)
_, scene_coords = point
coords = self.line_segment_roi["ROI"].mapSceneToParent(scene_coords)
new_plot.translate(coords.x(), 0)

point1 = self.line_segment_roi["ROI"].getSceneHandlePositions(0)
_, scene_coords = point1
start_coords = self.line_segment_roi["ROI"].mapSceneToParent(scene_coords)
point2 = self.line_segment_roi["ROI"].getSceneHandlePositions(1)
_, scene_coords = point2
end_coords = self.line_segment_roi["ROI"].mapSceneToParent(scene_coords)

scale = end_coords.x() - start_coords.x()
num_of_points = (len(selected) - 1) or 1
new_plot.scale(scale/num_of_points, 1)

How to make (one of the) axes show different data ?
Any ides on how to do this ?
--
You received this message because you are subscribed to the Google Groups "pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyqtgraph+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/0ae84f24-7d35-4b37-8f00-edd6e061b1fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...