I am trying to determine a way to alter the numbers displayed on ticks of
the axes of an ImageView object showing a PlotItem. However, I'd only like
this change to be shown visually on the axis ticks and not change the
shape, scope, or underlying calculations of the plotted data. As far as I
can tell, manually accessing the axis objects with:
```python
plot = pg.PlotItem()
# Initialize ImageView with the custom PlotItem
view = pg.ImageView(view=plot)
# Access the x-axis (bottom axis) of the PlotItem
x_axis = plot.getAxis('bottom')
# Define custom tick positions and labels
ticks = [(50, '50'), (100, '100'), (150, '150'), (200, '200'), (250, '250')]
# Apply the custom ticks to the x-axis
x_axis.setTicks([ticks])
```
Would alter the X Axis ticks as desired, but would also manipulate data
displayed in the underlying plot as it seems to take into account the axis
object when displaying data.
Basically I would like to know if there's a way to create a visual change
in the displayed axes without changing the underlying axis used to find the
shape of the plot. Since the data I am trying to display will shift
dynamically, I'd like to be able to change these axis ticks dynamically as
well as follows:
```python
import PyQt6
import pyqtgraph as pg
import numpy as np
#Initializing plot item and image view structure
plot = pg.PlotItem()
view = pg.ImageView(view=plot)
view.imageItem.setImage(np.ones((2048,2048), dtype=np.uint8) *
255,autoRange=False)
#Depending on user interaction that image content will be changed
if (event_happens):
view.imageItem.setImage(new_image_content, autoRange=False)
## Here I would like I way to change the displayed numbers on the axes
of the ImageView object without affecting the displayed data
```
Please let me know if I need to offer further clarification of my question.
Thank you
On Tuesday, September 10, 2024 at 12:03:48 PM UTC-7 [email protected]
wrote:
> Hey Andrew,
>
> I'm sorry, I'm unable to determine what you mean by "changing anything
> about the axes". Could you post sample code demonstrating what you're
> trying to do?
>
> Best,
> - Martin
>
> On Fri, Sep 6, 2024 at 10:05 AM Andrew More <[email protected]> wrote:
>
>> I'd like to find a way to manually change the displayed values on the
>> axes of a PlotItem without changing any aspect of how the data in the
>> PlotItem is displayed. As far as I can tell, changing anything about the
>> axes necessitates also shifting the values of the data so it displays
>> properly, but I'd like to avoid this. Is there a way 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 [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/pyqtgraph/a75051e6-d0ee-448b-a73f-d1e51b417c7an%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/pyqtgraph/a75051e6-d0ee-448b-a73f-d1e51b417c7an%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyqtgraph/9805a769-8a7f-4d61-a9cd-48ab36e2a6ben%40googlegroups.com.