

Hi R users,
I have a maybe strange problem.
Normaly I do image.plot() with x,y coordinates and add=T and if I have some NA values in my data matrix z, the color will be transparent of these pixels.
But now I have a disorted coordinate system and x,y are a matrix. It works also fine, but now NA values are white colored and not transparent anymore.
It is problematic if I have a secondary information underlying.
Is there any solution for this stuff?
Thanks!
best regards


This may be device and OS dependent, so please provide the information
requested in the posting guide, at a minimum the output of sessionInfo(). A
small reproducible example is also necessary.
Sarah
On Tuesday, July 10, 2012, Chris82 wrote:
> Hi R users,
>
> I have a maybe strange problem.
>
> Normaly I do image.plot() with x,y coordinates and add=T and if I have some
> NA values in my data matrix z, the color will be transparent of these
> pixels.
>
> But now I have a disorted coordinate system and x,y are a matrix. It works
> also fine, but now NA values are white colored and not transparent anymore.
>
> It is problematic if I have a secondary information underlying.
>
> Is there any solution for this stuff?
>
> Thanks!
>
> best regards
>
> 
> View this message in context:
> http://r.789695.n4.nabble.com/imageplottransparenttp4635976.html> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] <javascript:;> mailing list
> https://stat.ethz.ch/mailman/listinfo/rhelp> PLEASE do read the posting guide
> http://www.Rproject.org/postingguide.html> and provide commented, minimal, selfcontained, reproducible code.
>

Sarah Goslee
http://www.stringpage.comhttp://www.sarahgoslee.comhttp://www.functionaldiversity.org [[alternative HTML version deleted]]
______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/rhelpPLEASE do read the posting guide http://www.Rproject.org/postingguide.htmland provide commented, minimal, selfcontained, reproducible code.


On 10/07/2012 13:41, Sarah Goslee wrote:
> This may be device and OS dependent, so please provide the information
> requested in the posting guide, at a minimum the output of sessionInfo(). A
> small reproducible example is also necessary.
I think not. My guess is it is part of a package which we were not told
('fields'), and this is the programmed behaviour in its two subcases.
But we'd need reproducible code (including which package) to be sure.
If this is fields, read ?poly.image.
>
> Sarah
>
> On Tuesday, July 10, 2012, Chris82 wrote:
>
>> Hi R users,
>>
>> I have a maybe strange problem.
>>
>> Normaly I do image.plot() with x,y coordinates and add=T and if I have some
>> NA values in my data matrix z, the color will be transparent of these
>> pixels.
>>
>> But now I have a disorted coordinate system and x,y are a matrix. It works
>> also fine, but now NA values are white colored and not transparent anymore.
>>
>> It is problematic if I have a secondary information underlying.
>>
>> Is there any solution for this stuff?
>>
>> Thanks!
>>

Brian D. Ripley, [hidden email]
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
______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/rhelpPLEASE do read the posting guide http://www.Rproject.org/postingguide.htmland provide commented, minimal, selfcontained, reproducible code.


Hello,
hiere is a small reproducible example.
All z.i which are NA should be transparent at the plot, but they are white colored.
### Example image.plot regular x,y grid ###
x < seq(2,2.9,0.1)
y < seq(42,42.9,0.1)
z < matrix(seq(5,4.9,0.1),nrow=10)
image.plot(x,y,z)
### overplotting by a irregular grid ####
x.i < matrix(c(2.434842,2.436714,2.438593,2.440477,2.442368,2.472929,2.474831,2.476739,2.478654,2.480574,2.511019,2.512950,2.514888,2.516832,2.518782,2.549111,2.551072,2.553039,2.555012,2.556992,2.587205,2.589195,2.591192,2.593195,2.595204),nrow=5,byrow=T)
y.i < matrix(c(42.24368,42.28684,42.33005,42.37330,42.41660,42.24392,42.28708,42.33028,42.37354,42.41683,42.24415,42.28732,42.33052,42.37378,42.41707,42.24439,42.28756,42.33076,42.37402,42.41732,42.24464,42.28780,42.33101,42.37426,42.41756),nrow=5,byrow=T)
z.i < matrix(seq(10,14,1),nrow=5)
z.i[z.i< 0] < NA
image.plot(x.i,y.i,z.i, col=terrain.colors(20),add=T)


On 20120713 06:07, Chris82 wrote:
> Hello,
>
> hiere is a small reproducible example.
>
> All z.i which are NA should be transparent at the plot, but they are white
> colored.
>
>
> ### Example image.plot regular x,y grid ###
>
> x < seq(2,2.9,0.1)
> y < seq(42,42.9,0.1)
>
> z < matrix(seq(5,4.9,0.1),nrow=10)
>
> image.plot(x,y,z)
>
>
> ### overplotting by a irregular grid ####
>
> x.i <
> matrix(c(2.434842,2.436714,2.438593,2.440477,2.442368,2.472929,2.474831,2.476739,2.478654,2.480574,2.511019,2.512950,2.514888,2.516832,2.518782,2.549111,2.551072,2.553039,2.555012,2.556992,2.587205,2.589195,2.591192,2.593195,2.595204),nrow=5,byrow=T)
> y.i <
> matrix(c(42.24368,42.28684,42.33005,42.37330,42.41660,42.24392,42.28708,42.33028,42.37354,42.41683,42.24415,42.28732,42.33052,42.37378,42.41707,42.24439,42.28756,42.33076,42.37402,42.41732,42.24464,42.28780,42.33101,42.37426,42.41756),nrow=5,byrow=T)
>
>
> z.i < matrix(seq(10,14,1),nrow=5)
>
> z.i[z.i< 0] < NA
>
> image.plot(x.i,y.i,z.i, col=terrain.colors(20),add=T)
You still haven't told us what package you're using but,
like Professor Ripley, I assume that it's the fields package.
I believe that package uses a default of "white" for
missing values. You can reset that with the argument
'transparent.color' as in:
image.plot(x.i,y.i,z.i, col=terrain.colors(20), add=TRUE,
transparent.color = "transparent")
Peter Ehlers
______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/rhelpPLEASE do read the posting guide http://www.Rproject.org/postingguide.htmland provide commented, minimal, selfcontained, reproducible code.

