Exemplo n.º 1
0
 def make_image():
     plt = glw.addPlot(title='Testing colormaps', labels={'left': 'y', 'bottom': 'x'})
     im = pgx.ImageItem()
     im.setLookupTable(pgx.get_colormap_lut())
     x = np.arange(100) - 50
     y = np.arange(110)[:, None] - 55
     z = 5e9*np.exp(-(x**2 + y**2)/100.0)
     im.setImage(z + np.random.random(z.shape))
     plt.addItem(im)
     glw.nextRow()
     return im
Exemplo n.º 2
0
def test_ColorBarItem_auto(qtbot):
    ##
    glw = pg.GraphicsLayoutWidget()
    plt = glw.addPlot(title='Testing colormaps', labels={'left': 'y', 'bottom': 'x'})
    im = pgx.ImageItem()
    im.setLookupTable(pgx.get_colormap_lut())
    x = np.arange(100) - 50
    y = np.arange(110)[:, None] - 55
    z = 5e9*np.exp(-(x**2 + y**2)/100.0)
    im.setImage(z + np.random.random(z.shape))
    plt.addItem(im)
    cb = pgx.ColorBarItem(image=im)
    # cb.setLabel('intensity')
    glw.addItem(cb)
    glw.show()
    # Check changing color map.
    im.setLookupTable(pgx.get_colormap_lut('bipolar'))
    qtbot.addWidget(glw)
Exemplo n.º 3
0
def test_ColorBarItem_manual(qtbot):
    ##
    glw = pg.GraphicsLayoutWidget()
    plt = glw.addPlot(title='Testing colormaps', labels={'left': 'y', 'bottom': 'x'})
    im = pgx.ImageItem()
    im.setLookupTable(pgx.get_colormap_lut())
    x = np.arange(100) - 50
    y = np.arange(110)[:, None] - 55
    z = 5e9*np.exp(-(x**2 + y**2)/100.0)
    im.setImage(z + np.random.random(z.shape))
    plt.addItem(im)
    cb = pgx.ColorBarItem()
    cb.setManual(lut=im.lut, levels=im.levels)
    # cb.setLabel('intensity')
    glw.addItem(cb)
    glw.show()
    ##
    assert np.allclose(cb.axis.range, im.levels)
    qtbot.addWidget(glw)
Exemplo n.º 4
0
def make_image():
    plt=gl.addPlot(labels={'left':'y','bottom':'x'})
    im=pgx.ImageItem()
    im.setLookupTable(pgx.get_colormap_lut())
    plt.addItem(im)
    return im
Exemplo n.º 5
0
import numpy as np
import pyqtgraph as pg
from PyQt5.QtWidgets import QApplication

import pyqtgraph_extensions as pgx

##
app = QApplication([])

glw = pg.GraphicsLayoutWidget()
plt = glw.addPlot(title='Testing colormaps', labels={'left': 'y', 'bottom': 'x'})
im = pgx.ImageItem()
im.setLookupTable(pgx.get_colormap_lut())
x = np.arange(10)
y = np.arange(11)[:, None]
z = x + 1.1 * y
z[3, :] = np.nan
im.setImage(z)
plt.addItem(im)
cb = pgx.ColorBarItem(image=im)
#cb.setManual(lut=im.lut, levels=im.levels)
# cb.setLabel('intensity')
glw.addItem(cb)
glw.show()

app.exec()