add extra default colormap to image histogram - pg.HistogramLUTItem()

51 views
Skip to first unread message

RC

unread,
Apr 24, 2017, 9:48:31 AM4/24/17
to pyqtgraph
Hey Guys

I can create an image and then use pg.HistogramLUTItem() to show the histogram of the image. When you click on the context menu of the histogram you have a list of 8 or so default colormaps which you can click on the change the image colours. I wish to add my own to this list. Does anyone know how to do this? I cant seem to find the context menu to edit.

Thanks for any help

Sebastian Höfer

unread,
Apr 25, 2017, 7:46:27 AM4/25/17
to pyqtgraph
Hi RC,

what you're looking for is in the file pyqtgraph\graphicsItems\GradientEditorItem.py
The default gradients get defined at the top of the file, the menu is created in the constructor of the GradientEditorItem(). You can add your own by adding a list with (position, RGBA-value) tuples there.

Cheers
Sebastian

RC

unread,
May 16, 2017, 10:21:17 AM5/16/17
to pyqtgraph
Thanks again Sebastian

That is what I needed. Sorry for not replying sooner but I working on something else and I didnt get an automatic email

Cheers

RC

RC

unread,
May 16, 2017, 12:44:14 PM5/16/17
to pyqtgraph
Hi Sebastian

I think I am still missing something. I added a test colourmap to this but it doesnt appear in my pg.imageitem by default. Has this anything to do with me using imageitem rather than imageview for my plot? Here you can see in the picture below that the available colourmaps have not changed even though i added one where you suggested. I think i am missing the step to add it to the plot




Thanks again for your help
Auto Generated Inline Image 1

RC

unread,
May 17, 2017, 7:00:08 AM5/17/17
to pyqtgraph

Hi Sebastian

I was able to find another of your posts which talked about adding matplotlib to an image view (https://www.mail-archive.com/pyqt...@googlegroups.com/msg00230.html) which I was able to modify to do what I needed.

Thanks so much Sebastian. This was really beginning to start to annoy me and now its fixed.

Cheers David
Reply all
Reply to author
Forward
0 new messages