How To Plot a Histogram with updated geometry


I want to create histograms which uses a mask - I know how to do this. With the “Analysis” > “Histogram” Tool and then I can use a mask or not. And I want to use my geometry-mask, which I created with the “Polygon drawing tool”.
I recognized that the data, which is used by the histogram or rather the histogram doesn’t change when I change my mask.
I show you my work, so it its better to understand what I mean.

I want to know the values of the marked areas, e.g. the ice floes. Thus I create a histogram.

To demonstrate my problem I draw a new geometry with a lead - which have different values.

I closed my before created histogram an want to calculate a new one, which includes the values of the new geometry as well. I use only one vector data container.

And here you see my problem. It is exactly the same histogram as above without the new geometry. I think it is the histogram of my very first geometry, which I draw with the polygon drawing tool. And there is no possibility to update this histogram. Or I don’t know it. I thought it would update the histogram.

How can I solve my problem?
Thank you. :slight_smile:

Does your “geometry” consist of several polygons at once?
Then it would be no wonder why dark areas are not present to a larger degree. Looking at it I would assume the same proportions of bright and dark pixels for your pink polygons and for the whole image.

Also don’t forget to re-calculate the histogram on (maybe you’ll have to change the number of bins so the symbol becomes active again.

You can also use the statistics tool in order to check if the number of pixels changes using the ROI or not.

It works for me:
The first histogram:

After adding another geometry and pressing re-calculate:

Maybe the change is not huge enough to be visible.
Do you know that you can zoom in into the diagram?
Draw a rectangle from the upper-left to the lower right corner. To zoom out draw the rectangle from right to left.
Or adjust the axis values on the right.

@ABraun I try to re-calculate every time I change something in my geometry. And yes, my geometry consist of several polygons. The Tip with the bin number is great. Thank you.
And now, I used the statistics-tool. And this seems to work very well.

I tested everything a second time, with screen shots, because my histogram doesn’t change.

I draw around one ice floe. And I got the following pics:

And I exported the histogram data with “copy data to clipboard” to a .txt file: Scholle1.txt (21.4 KB)

Then I draw a second ice floe and got the following pics:

The number of pixels of the ROI data in the statistic tool changed. And the histogram as well.

But the histogram in the histogram tool didn’t change. Even if I use the re-calculate tip with changing the bin number. To confirm my feeling that there is something wrong I saved the histogram data in a .txt file as well: Scholle1.txt (21.4 KB) and if you compare these two data-sets you will see that there are exactly the same.

While I was doing all this stuff I noticed the error-sign at the bottom rigth corner in SNAP. The Details are:

java.lang.IllegalArgumentException: Invalid number of points in LinearRing (found 3 - must be 0 or >= 4)
at com.vividsolutions.jts.geom.LinearRing.validateConstruction(
at com.vividsolutions.jts.geom.LinearRing.(
at com.vividsolutions.jts.geom.GeometryFactory.createLinearRing(
at com.vividsolutions.jts.geom.GeometryFactory.createLinearRing(
at org.esa.snap.core.util.AwtGeomToJtsGeomConverter.createLinearRingList(
at org.esa.snap.core.util.AwtGeomToJtsGeomConverter.createPolygon(
at org.esa.snap.ui.product.SimpleFeatureShapeFigure.getGeometryFromShape(
at org.esa.snap.ui.product.SimpleFeatureShapeFigure.setShape(
at com.bc.ceres.swing.figure.interactions.InsertMultiPointFigureInteractor.mouseClicked(
at com.bc.ceres.swing.figure.InteractionDispatcher.mouseClicked(
at java.awt.AWTEventMulticaster.mouseClicked(
at java.awt.AWTEventMulticaster.mouseClicked(
at java.awt.Component.processMouseEvent(
at javax.swing.JComponent.processMouseEvent(
at java.awt.Component.processEvent(
at java.awt.Container.processEvent(
at java.awt.Component.dispatchEventImpl(
at java.awt.Container.dispatchEventImpl(
at java.awt.Component.dispatchEvent(
at java.awt.LightweightDispatcher.retargetMouseEvent(
at java.awt.LightweightDispatcher.processMouseEvent(
at java.awt.LightweightDispatcher.dispatchEvent(
at java.awt.Container.dispatchEventImpl(
at java.awt.Window.dispatchEventImpl(
at java.awt.Component.dispatchEvent(
at java.awt.EventQueue.dispatchEventImpl(
at java.awt.EventQueue.access$500(
at java.awt.EventQueue$
at java.awt.EventQueue$
at Method)
at java.awt.EventQueue$
at java.awt.EventQueue$
at Method)
at java.awt.EventQueue.dispatchEvent(
at org.netbeans.core.TimableEventQueue.dispatchEvent(
[catch] at java.awt.EventDispatchThread.pumpOneEventForFilters(
at java.awt.EventDispatchThread.pumpEventsForFilter(
at java.awt.EventDispatchThread.pumpEventsForHierarchy(
at java.awt.EventDispatchThread.pumpEvents(
at java.awt.EventDispatchThread.pumpEvents(

I don’t know if this belongs to my problem, but it shows up if I only do this kind of things.

If I can copy the whole histogram data out of the statistics tool the problem with the histogram tool wouldn’t bother me this much. But I’m only able to copy the table (upper left corner) to a .cvs file.

EDIT: I uploaded the wrong picture at one point. Just fixed this.

I saw this exception too. But only once while drawing a geometry. I think it is not the cause of the histogram problem.
I also noticed that both histogram images are named Scholle1_histo.png. Did you upload the same image twice?
Every time I try it my histogram gets updated.
I send you a separate message with a location where you can upload the data. So I can try to reproduce it.

Ups. I uploaded one time the false image. I corrected this in my post before. But at the end: the histograms are the same.

For all users.
We have investigated this issue further. But Mara and I haven’t the cause of it.
It was also not able to reproduce it. I don’t doubt Mara, she has this problem but I can’t reproduce.
Has someone else observed it? Maybe some more input from someone else might give a clue.