[R] bitmap .tif in colors

Lauri Nikkinen lauri.nikkinen at iki.fi
Wed Feb 18 16:35:51 CET 2009


Thanks Prof Ripley, now I understood.

tiff(filename = "volc.tif", width=600, height=400, compression =
"none", bg = "white", res = 300, pointsize=3)
par(mar=c(3,3,2,2), cex=1)
image(t(volcano)[ncol(volcano):1,], xaxt="n", yaxt="n")
axis(1, at=seq(0, 1, 0.1), cex.axis=0.8, tick=T)
axis(2, at=seq(0, 1, 0.1), cex.axis=0.8, tick=T)
dev.off()

Regards,
Lauri

2009/2/18 Prof Brian Ripley <ripley at stats.ox.ac.uk>:
> On Wed, 18 Feb 2009, Lauri Nikkinen wrote:
>
>> Thanks. I upgraded to R 2.8.1 and tried
>>
>> tiff(filename = "volc.tif", width=600, height=400, compression =
>> "none", bg = "white", res = 300)
>> image(t(volcano)[ncol(volcano):1,])
>> dev.off()
>>
>> but this produces error
>>
>> Error in plot.new() : figure margins too large
>>
>> How this should be modified to produce a decent-sized graph?
>
> Well, thae is a 2" by 1.3" image, so the pointsize is way too large.
> Increase the dimensions or decrease the resolution or decreaase the
> pointsize.
>
> (As a warning, there was a 'grid' bug that affected some versions of tiff,
> png etc in 2.8.0 and 2.8.1 when plotting lattice plots at non-default
> resolutions.  The NEWS item is
>
>    o   grid-based plots no longer reset the base text size to the
>        default 96dpi in cairo-based bitmap devices.
>
> for 2.8.1 patched.  But that produces too small not too large text.)
>
>>
>> Regards,
>> Lauri
>>
>> 2009/2/18 Uwe Ligges <ligges at statistik.tu-dortmund.de>:
>>>
>>>
>>> Lauri Nikkinen wrote:
>>>>
>>>> Hello,
>>>>
>>>> How to produce .tif graphic in colors using bitmap function?
>>>>
>>>> e.g this produces figure in grayscale
>>>>
>>>> bitmap(file="volc.tif", type = "tifflzw", res = 300)
>>>> image(t(volcano)[ncol(volcano):1,])
>>>> dev.off()
>>>
>>> Why not upgrade R and use the tiff() device?
>>>
>>> Uwe Ligges
>>>
>>>
>>>
>>>
>>>> I'm using Windows XP and ghostscript.
>>>>
>>>>> R.Version()
>>>>
>>>> $platform
>>>> [1] "i386-pc-mingw32"
>>>>
>>>> $arch
>>>> [1] "i386"
>>>>
>>>> $os
>>>> [1] "mingw32"
>>>>
>>>> $system
>>>> [1] "i386, mingw32"
>>>>
>>>> $status
>>>> [1] ""
>>>>
>>>> $major
>>>> [1] "2"
>>>>
>>>> $minor
>>>> [1] "7.1"
>>>>
>>>> $year
>>>> [1] "2008"
>>>>
>>>> $month
>>>> [1] "06"
>>>>
>>>> $day
>>>> [1] "23"
>>>>
>>>> $`svn rev`
>>>> [1] "45970"
>>>>
>>>> $language
>>>> [1] "R"
>>>>
>>>> $version.string
>>>> [1] "R version 2.7.1 (2008-06-23)"
>>>>
>>>> ______________________________________________
>>>> R-help at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide
>>>> http://www.R-project.org/posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> --
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>




More information about the R-help mailing list