Open cunyap opened 4 years ago
I'm not sure what you mean when you say it gett cut off. Can you post a screen shot that demonstrates the issue?
About the second question: not directly but you can add it to a pg.GraphicsLayoutWidget
and then add this pg.GraphicsLayoutWidget
to a QGridLayout
.
More detailed explanation: the ColorLegendItem
inherits from pg.GraphicsWidget
which, in turninherits from QGraphicsWidget
. It does not inherit from QWidget
and therefore cannot be added to a QGridLayout
. A pg.GraphicsLayoutWidget
does inherit from QWidget
and therefore can be added to a QGridLayout
.
For more info read Organization of Plotting Classes of the PyQtGraph documentation.
Also see my UML diagram below:
Hi,
Thanks for the prompt answer. I realized that my image has in general a very sparse histogram and thatit has a very narrow distributio. From your code documentation I now found out that if I set histHeightPercentile=100
the full histogram is shown.
Cut off or clipped histogram with histHeightPercentile=99
fixed with histHeightPercentile=100
However it might still be useful to have the height of the histogram user definable for cases where one would like to visualize it a bit bigger.
Thanks for the diagram, I have it now in a pg.GraphicsLayoutWidget
in a QGridLayout
but somehow this column 1 takes up much more space that column 0 with the image and column 2 with the button. I know there are spacers or one can specify a column span but this seams to be ignored and there seams to be some expanding policy or sth on the ColorLegendItem
or pg.GraphicsLayoutWidget
such that it gets displayed so wide compared to the rest. Any hint why this could be?
O yeah. Indeed the histHeightPercentile=100
solves the issue.
My guess is that the the expanding policy is from the pg.GraphicsLayoutWidget
. Perhaps you can change it or use the setColumnStretch
method of the QGridLayout
.
However, the purpose of the pg.GraphicsLayoutWidget
is to combine multiple plots and/or plot elements into a grid, similar to what a QGridLayout
does for regular widgets. Therefore I strongly recommend to put both your plot item and the ColorLegendItem into a single pg.GraphicsLayoutWidget
. See the demo.py
program for an example.
Hi,
Really nice project. Thanks a lot. I have a small question regarding showHistogram=True. Whenever I want to show the histogram of an 8bit image it gets cut off and is not shown fully. Is there a parameter to change the histogram height or the canvas the colorbar is in?
Also is there a way to add it to a QGridLayout instead of pg.GraphicsLayoutWidget()?
Thanks, Andreas