Opened 9 years ago

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

Download all attachments as: .zip

Change History (16)

by richardc, 9 years ago

Attachment: dhistogram.png added

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

comment:1 by martinl, 9 years ago

Keywords: d.histogran added

comment:2 by martinl, 9 years ago

Keywords: d.histogram added; d.histogran removed

comment:3 by martinl, 8 years ago

Milestone: 7.0.07.0.5

by lazaa, 8 years ago

Attachment: patch2463 added

It seems it works with this patch.

comment:4 by annakrat, 8 years ago

In 68488:

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

by wenzeslaus, 8 years ago

Attachment: histogram_sin_row.png added

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

comment:5 by wenzeslaus, 8 years ago

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())"

by lazaa, 8 years ago

Attachment: sin_decimals.png added

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

comment:6 by lazaa, 8 years ago

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.

by lazaa, 8 years ago

Attachment: histoXlabels.diff added

x labels decimal point condtion changed

comment:7 by lazaa, 8 years ago

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 by annakrat, 8 years ago

In 68953:

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

comment:9 by annakrat, 8 years ago

In 69195:

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

comment:10 by annakrat, 8 years ago

In 69196:

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

comment:11 by annakrat, 8 years ago

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