I just had a quick look at the PColorMeshItem, and I don't think it deals 
with nonlinear transforms either.

On Monday, January 23, 2023 at 9:16:53 PM UTC-5 Patrick wrote:

> Hi,
>
> I might be wrong, but I don't think ImageItems work with logarithmic axes. 
> They are simple a bitmap image that gets drawn over a rectangular area, and 
> the QTransform (
> https://doc.qt.io/qtforpython/PySide6/QtGui/QTransform.html) which is 
> applied is a simple affine transform that won't apply logarithmic 
> stretching.
> Perhaps you could try rendering with a PColorMeshItem (
> https://pyqtgraph.readthedocs.io/en/latest/api_reference/graphicsItems/pcolormeshitem.html)
>  
> instead? It might be a little more complex and slower to render, but since 
> it renders as a series of polygons, I think it may respect the logarithmic 
> coordinates.
>
> Patrick
> On Tuesday, 24 January 2023 at 5:44:34 am UTC+10:30 [email protected] 
> wrote:
>
>> (pyqtgraph vers 0.13.1)  
>>
>> I have an application that generates a spectrogram.  I use scipys 
>> spectrogram method, and generate the plot with...
>>
>> my_plotitem = pg.PlotItem()
>>
>> f, t, Sxx = scipy.signal.spectrogram( data, Fs=fs)
>> my_transform = QtGui.QTransform()
>> yscale = f[-1]/Sxx.shape[1]
>> xscale = t[-1]/Sxx.shape[0]
>> my_transform.scale(xscale, yscale)
>>
>> my_image = pg.ImageItem()
>> my_image.setTransform(my_transform)
>>
>> my_image.setImage(Sxx)
>> my_plotitem.addItem(my_image)
>>
>> my_plotitem.setLogMode(x=False, y=True)
>>
>> This works great, but I would like to have the y-axis (the frequencies) 
>> to be a log scale.  I tried using the plotitems setLogMode method... but it 
>> just changes the tick labels (incorrectly) and doesn't change the plot at 
>> all.  the image on the left is with a linear y-axis, the one on the right 
>> is after setting same image to setLogMode(x=False, y=True).  Note that the 
>> correct range for the y-axis is 0 to 50.
>>
>> [image: linear.png][image: log.png]
>>
>> I've searched around and can't find anything. What is the correct way to 
>> do this?
>>
>> J
>>
>

-- 
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/487bf4f2-51d1-4587-9ab0-5d69e2c0dee9n%40googlegroups.com.

Reply via email to