[R-sig-Geo] Question on histograms from Raster and RasterVIS packages

Robert J. Hijmans r.hijmans at gmail.com
Wed Nov 19 16:14:03 CET 2014


Nuno,

> The "hist" function from the raster package uses a maximum of 100 000
> values for generating the histogram

That is the default, but you do not have to use that. Did you read the
help file??

?raster::hist

Shows that you can set the "maxpixels" to any number you want. E.g.

maxpixels=Inf

if you want them all.

With very large raster you may run out of memory. If that happens,
then you can create the data for a histogram yourself by using the
function 'freq', perhaps after 'reclassify' (and then probably
'barplot').

Robert






On Tue, Nov 18, 2014 at 9:56 AM, Nuno Sá <nunocesardesa at gmail.com> wrote:
> Hello!
>
> My aim is to add a "Median" or a "Mean" line to an histogram plot in R.
>
> The problem is the following:
>
> The "hist" function from the raster package uses a maximum of 100 000
> values for generating the histogram but allows me to edit the plot, so I
> can easily add a line within the plot using abline.
>
> The "histogram" function in rasterVIS uses all my dataset but does not
> allow editing of the plot area, so I cannot use the abline function to add
> this line (or I do not know how to do it).
>
> If you have an alternative or a solution to work around this, I am all hears
>
> Thank you for any help in advance!
> Ciao!
> --
>
> Nuno César de Sá
> +351 91 961 90 37
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list