False color plots #2091
felixvoigt
started this conversation in
Ideas
Replies: 1 comment
-
Hello, ImageItem has a def pyqt_plot_fc(F,x_min,x_max,y_min,y_max,p): # F is the array to plot in false colors. x_min, x_max, y_min, y_max describe the borders of image range.
img = pg.ImageItem(F)
p.addItem(img) # p is a PlotItem
img.setRect(x_min, y_min, x_max-x_min, y_max-y_min)
cmap = pg.colormap.get("viridis")
lut = cmap.getLookupTable(0.0,1.0,512) # equally-spaced lookup table of RGB(A) values created by interpolation
img.setLookupTable(lut) In the near future (#2090), that could be further simplified to: def pyqt_plot_fc(F,x_min,x_max,y_min,y_max,p): # F is the array to plot in false colors. x_min, x_max, y_min, y_max describe the borders of image range.
img = pg.ImageItem(F)
p.addItem(img) # p is a PlotItem
img.setRect(x_min, y_min, x_max-x_min, y_max-y_min)
img.setColorMap("viridis") |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
some weeks ago I started using pyqtgraph to display spectrograms. The reason I was choosing pyqtgraph was its higher speed compared to matplotlib.pyplot. And finally I was able to achieve a similar plot with pyqtgraph as formerly was generated by an ax.contourf command of matplotlib.pyplot a factor 1000 faster.
However my spectrograms consist of severals small spectrograms parts, which have to be combined. This turned out to be not too easy to achieve. In pyqtgraph I used a false color display of the plots, which is similar but not the same as a contour plot.
Here I give an example how to combine several false color plots to a complete image. Functions like
plot_fc_backgr
andpyqt_plot_fc
could be useful in pyqtgraph in my opinion. What do you think?(The functions have to be converted to classes in an object oriented style and proper input arguments and keyword arguments still have to be chosen.)
Regards
feli_x
Example code is attached as file:
plot_fc_github.txt
Beta Was this translation helpful? Give feedback.
All reactions