Hi to all
I hope you can help me.
# I'm trying to plot the following ratio data with standard error bars
(horizontal).
ratioBiomass <- c(1.327, 0.865, 1.900, 0.992, 1.469, 1.381, 1.230,1.269,
2.411, 1.288, 1.861, 0.714, 1.341, 1.362, 1.065, 2.374)
SEratio <- c(19.28, 5.04, 0.01, 0.01, 0.90, 0.02, 0.002, 11.37,
0.004, 0.29, 0.003, 0.13, 0.21, 0.52, 1.66, 14.57)
Species <- c("C. exoletus","C. rupestris","D.
sargus","D. vulgaris","G.
xanthocephalus","L. bergylta","Mugilidae
n.id.","N. puber","O.
vulgaris","P. pilicornis","S. salpa","S.
cabrilla","S. bailloni","S.
melops","S. roissali","T. delaisi")
Commercial.Value <-
c("Non-Target","Non-Target","Target","Target","Non-Target","Target","Target","Target","Target","Non-Target","Target","Target","Non-Target","Non-Target","Non-Target","Non-Target")
dfInOutBiom2 <- data.frame
(ratioBiomass ,SEratio ,Species ,Commercial.Value)
#I tried a segplot which I think is the most adequate function to what I
need but I can't do it in black and white:
plotBiomRatio2 <- segplot(reorder(factor(Species), ratioBiomass ) ~ (-
SEratio ) +
SEratio , data = dfInOutBiom2,col="black",level =
Commercial.Value,
colorkey= TRUE, draw.bands = FALSE, centers = Biomass, ends
"both",xlim=range(-SEratio +0.5, SEratio +0.5), scales=list(cex=1.2,x
list(tck = -1),y= list(font
3,tck=-1)),cex=1.2,ylab=list(font=2,cex=1.2),xlab=list(font=2,cex=1.2),
pch=c(1,1,19,19,1,19,19,19,19,1,19,19,1,1,1,1), lwd=3, panel function(...) {
panel.abline(v = 1, lty = 3, lwd=2)
panel.segplot(...)
})
plotBiomRatio2
Can you help me to print this plot in black and white, please?
Many thanks in advance.
Barbara
[[alternative HTML version deleted]]
Hello,
Try the following.
#---------- this is new
colfun <- colorRampPalette(c("black", "white"))
cols <- colfun(nrow(dfInOutBiom2))
#---------- end
plotBiomRatio2 <- segplot(
reorder(factor(Species), ratioBiomass) ~ (-SEratio ) + SEratio,
data = dfInOutBiom2,
#-------------- this changed
col = cols,
level = NULL,
colorkey = list(col = cols),
#-------------- end
draw.bands = FALSE,
centers = ratioBiomass,
ends = "both",
xlim = range(-SEratio + 0.5, SEratio + 0.5),
scales = list(cex=1.2, x=list(tck = -1), y=list(font = 3, tck = -1)),
cex = 1.2,
xlab = list(font=2, cex=1.2),
ylab = list(font=2, cex=1.2),
pch = c(1,1,19,19,1,19,19,19,19,1,19,19,1,1,1,1),
lwd = 3,
panel = function(...){
panel.abline(v = 1, lty = 3, lwd=2)
panel.segplot(...)
})
plotBiomRatio2
Hope this helps,
Rui Barradas
Em 10-09-2012 17:59, barbara costa escreveu:> Hi to all
> I hope you can help me.
>
> # I'm trying to plot the following ratio data with standard error bars
> (horizontal).
>
>
> ratioBiomass <- c(1.327, 0.865, 1.900, 0.992, 1.469, 1.381, 1.230,1.269,
> 2.411, 1.288, 1.861, 0.714, 1.341, 1.362, 1.065, 2.374)
> SEratio <- c(19.28, 5.04, 0.01, 0.01, 0.90, 0.02, 0.002, 11.37,
> 0.004, 0.29, 0.003, 0.13, 0.21, 0.52, 1.66, 14.57)
> Species <- c("C. exoletus","C. rupestris","D.
sargus","D. vulgaris","G.
> xanthocephalus","L. bergylta","Mugilidae
n.id.","N. puber","O.
> vulgaris","P. pilicornis","S. salpa","S.
cabrilla","S. bailloni","S.
> melops","S. roissali","T. delaisi")
> Commercial.Value <-
>
c("Non-Target","Non-Target","Target","Target","Non-Target","Target","Target","Target","Target","Non-Target","Target","Target","Non-Target","Non-Target","Non-Target","Non-Target")
>
> dfInOutBiom2 <- data.frame
> (ratioBiomass ,SEratio ,Species ,Commercial.Value)
>
>
> #I tried a segplot which I think is the most adequate function to what I
> need but I can't do it in black and white:
>
> plotBiomRatio2 <- segplot(reorder(factor(Species), ratioBiomass ) ~ (-
> SEratio ) +
> SEratio , data = dfInOutBiom2,col="black",level =
Commercial.Value,
> colorkey= TRUE, draw.bands = FALSE, centers = Biomass, ends >
"both",xlim=range(-SEratio +0.5, SEratio +0.5), scales=list(cex=1.2,x
> list(tck = -1),y= list(font >
3,tck=-1)),cex=1.2,ylab=list(font=2,cex=1.2),xlab=list(font=2,cex=1.2),
> pch=c(1,1,19,19,1,19,19,19,19,1,19,19,1,1,1,1), lwd=3, panel >
function(...) {
> panel.abline(v = 1, lty = 3, lwd=2)
>
> panel.segplot(...)
> })
> plotBiomRatio2
>
> Can you help me to print this plot in black and white, please?
>
> Many thanks in advance.
> Barbara
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
To exclude the color key use
plotBiomRatio2 <- segplot(
reorder(factor(Species), ratioBiomass) ~ (-SEratio ) + SEratio,
data = dfInOutBiom2,
col = "black",
level = NULL,
#-------------- this changed
colorkey = FALSE,
#-------------- end
draw.bands = FALSE,
centers = ratioBiomass,
[...etc...]
Rui Barradas
Em 10-09-2012 23:07, barbara costa escreveu:> Hi Rui,
> I'd really need the plot only in black so I ran the following code
using
> your suggestion (with col="black)", but I'm getting the color
scale at
> the right side of the plot anyway.
> Do you have any idea how to exclude this.
> Thanks a lot again,
> Barbara
>
>
> plotBiomRatio2 <- segplot(Species ~ - SEratio +
> SEratio , data = dfInOutBiom2,col = "black",level = NULL,
colorkey
> = list(col = "black"), draw.bands = FALSE, centers =
ratioBiomass, ends > "both",xlim=range(min(- SEratio -1.5),max(
SEratio +1.5)),
> scales=list(cex=1.2,x = list(tck = -1),y= list(font >
3,tck=-1)),cex=1.2,ylab=list(font=2,cex=1.2),xlab=list(font=2,cex=1.2),
> pch=c(1,1,19,19,1,19,19,19,19,1,19,19,1,1,1,1), lwd=3, panel >
function(...) {
> panel.abline(v = 1, lty = 3, lwd=2)
>
> panel.segplot(...)
> })
> plotBiomRatio2
>
>
>
>
>
> On 10 September 2012 21:04, Rui Barradas <ruipbarradas at sapo.pt>
wrote:
>
>> Hello,
>>
>> Try the following.
>>
>>
>> #---------- this is new
>> colfun <- colorRampPalette(c("black", "white"))
>> cols <- colfun(nrow(dfInOutBiom2))
>> #---------- end
>>
>>
>> plotBiomRatio2 <- segplot(
>> reorder(factor(Species), ratioBiomass) ~ (-SEratio ) + SEratio,
>> data = dfInOutBiom2,
>> #-------------- this changed
>> col = cols,
>> level = NULL,
>> colorkey = list(col = cols),
>> #-------------- end
>> draw.bands = FALSE,
>> centers = ratioBiomass,
>> ends = "both",
>> xlim = range(-SEratio + 0.5, SEratio + 0.5),
>> scales = list(cex=1.2, x=list(tck = -1), y=list(font = 3, tck =
-1)),
>> cex = 1.2,
>> xlab = list(font=2, cex=1.2),
>> ylab = list(font=2, cex=1.2),
>> pch = c(1,1,19,19,1,19,19,19,19,1,**19,19,1,1,1,1),
>> lwd = 3,
>>
>> panel = function(...){
>> panel.abline(v = 1, lty = 3, lwd=2)
>> panel.segplot(...)
>> })
>> plotBiomRatio2
>>
>> Hope this helps,
>>
>> Rui Barradas
>>
>> Em 10-09-2012 17:59, barbara costa escreveu:
>>
>>> Hi to all
>>> I hope you can help me.
>>>
>>> # I'm trying to plot the following ratio data with standard
error bars
>>> (horizontal).
>>>
>>>
>>> ratioBiomass <- c(1.327, 0.865, 1.900, 0.992, 1.469, 1.381,
1.230,1.269,
>>> 2.411, 1.288, 1.861, 0.714, 1.341, 1.362, 1.065, 2.374)
>>> SEratio <- c(19.28, 5.04, 0.01, 0.01, 0.90, 0.02, 0.002,
11.37,
>>> 0.004, 0.29, 0.003, 0.13, 0.21, 0.52, 1.66, 14.57)
>>> Species <- c("C. exoletus","C.
rupestris","D. sargus","D. vulgaris","G.
>>> xanthocephalus","L. bergylta","Mugilidae
n.id.","N. puber","O.
>>> vulgaris","P. pilicornis","S.
salpa","S. cabrilla","S. bailloni","S.
>>> melops","S. roissali","T. delaisi")
>>> Commercial.Value <-
>>>
c("Non-Target","Non-Target","**Target","Target","Non-Target",**
>>>
"Target","Target","Target","**Target","Non-Target","Target",**
>>>
"Target","Non-Target","Non-**Target","Non-Target","Non-**Target")
>>>
>>> dfInOutBiom2 <- data.frame
>>> (ratioBiomass ,SEratio ,Species ,Commercial.Value)
>>>
>>>
>>> #I tried a segplot which I think is the most adequate function to
what I
>>> need but I can't do it in black and white:
>>>
>>> plotBiomRatio2 <- segplot(reorder(factor(**Species),
ratioBiomass ) ~
>>> (-
>>> SEratio ) +
>>> SEratio , data = dfInOutBiom2,col="black",level
>>> Commercial.Value,
>>> colorkey= TRUE, draw.bands = FALSE, centers = Biomass, ends
>>> "both",xlim=range(-SEratio +0.5, SEratio +0.5),
scales=list(cex=1.2,x >>> list(tck = -1),y= list(font >>>
3,tck=-1)),cex=1.2,ylab=list(**font=2,cex=1.2),xlab=list(**
>>> font=2,cex=1.2),
>>> pch=c(1,1,19,19,1,19,19,19,19,**1,19,19,1,1,1,1), lwd=3, panel
>>> function(...) {
>>> panel.abline(v = 1, lty = 3, lwd=2)
>>>
>>> panel.segplot(...)
>>> })
>>> plotBiomRatio2
>>>
>>> Can you help me to print this plot in black and white, please?
>>>
>>> Many thanks in advance.
>>> Barbara
>>>
>>> [[alternative HTML version deleted]]
>>>
>>> ______________________________**________________
>>> R-help at r-project.org mailing list
>>>
https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>>> PLEASE do read the posting guide http://www.R-project.org/**
>>> posting-guide.html
<http://www.R-project.org/posting-guide.html>
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>