Opened 5 years ago

Closed 3 years ago

#2463 closed defect (fixed)

d.histogram x-axis numbering incorrect

Reported by: richardc Owned by: grass-dev@…
Priority: normal Milestone: 7.0.5
Component: Display Version: svn-releasebranch70
Keywords: d.histogram Cc:
CPU: x86-32 Platform: Linux

Description

Generating histogram by clicking on icon in Map Display generates a histogram with incorrect numbering along x-axis.

File type: FCELL Range: min = 0 max = 158.3026

pls see image posted in past: http://osgeo-org.1560.x6.nabble.com/file/n5024823/x_axis_histogram_ticks.jpg

Richard

GRASS version: 7.0.0svn GRASS SVN Revision: 62228 Build Date: 2014-10-12 Build Platform: i686-pc-linux-gnu GDAL/OGR: 1.9.2 PROJ.4: 4.9.0 GEOS: 3.4.2 SQLite: 3.7.9 Python: 2.7.3 wxPython: 2.8.12.1 Platform: Linux-3.2.0-31-generic-pae-i686-with-LinuxMint?-13-maya

Attachments (5)

dhistogram.png (30.3 KB) - added by richardc 5 years ago.
This is current screenshot from GRASS version: 7.0.0svn GRASS SVN Revision: 62228
patch2463 (419 bytes) - added by lazaa 3 years ago.
It seems it works with this patch.
histogram_sin_row.png (43.4 KB) - added by wenzeslaus 3 years ago.
Histogram of r.mapcalc "sinr = sin(row())"
sin_decimals.png (31.9 KB) - added by lazaa 3 years ago.
Histogram for [-1, 1] range with digits after decimal point
histoXlabels.diff (564 bytes) - added by lazaa 3 years ago.
x labels decimal point condtion changed

Download all attachments as: .zip

Change History (16)

Changed 5 years ago by richardc

Attachment: dhistogram.png added

This is current screenshot from GRASS version: 7.0.0svn GRASS SVN Revision: 62228

comment:1 Changed 5 years ago by martinl

Keywords: d.histogran added

comment:2 Changed 5 years ago by martinl

Keywords: d.histogram added; d.histogran removed

comment:3 Changed 3 years ago by martinl

Milestone: 7.0.07.0.5

Changed 3 years ago by lazaa

Attachment: patch2463 added

It seems it works with this patch.

comment:4 Changed 3 years ago by annakrat

In 68488:

d.histogram: fix tick labels, see #2463, author Adam Laza

Changed 3 years ago by wenzeslaus

Attachment: histogram_sin_row.png added

Histogram of r.mapcalc "sinr = sin(row())"

comment:5 Changed 3 years ago by wenzeslaus

With data in range [-1, 1] generated by

r.mapcalc "sinr = sin(row())"

I get histogram with only zeros on x axis:

Histogram of r.mapcalc "sinr = sin(row())"

Changed 3 years ago by lazaa

Attachment: sin_decimals.png added

Histogram for [-1, 1] range with digits after decimal point

comment:6 Changed 3 years ago by lazaa

I found the problem. Digits after decimal points are displeyd only if (max - min) <= 1.0. In this case max - min = 2.0. I can easily fix it with abs() but maybe we should discuss what is the right condition to decide when display decimal number and when only rounded value.

Changed 3 years ago by lazaa

Attachment: histoXlabels.diff added

x labels decimal point condtion changed

comment:7 Changed 3 years ago by lazaa

I changed the condition to if ((double)(tic_every * (range_dmax - range_dmin) / nsteps) < 1.0) and tested it on several raster maps. Results look good.

comment:8 Changed 3 years ago by annakrat

In 68953:

d.histogram: fix x axis labels for small numbers, see #2463

comment:9 Changed 3 years ago by annakrat

In 69195:

d.histogram: fix x axis labels for small numbers, see #2463 (merge from trunk, r68953)

comment:10 Changed 3 years ago by annakrat

In 69196:

d.histogram: fix x axis labels for small numbers, see #2463 (merge from trunk, r68953)

comment:11 Changed 3 years ago by annakrat

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.