Displaying 20 results from an estimated 600 matches similar to: "ggplot adjust two y-axis"
2023 Nov 24
1
ggplot adjust two y-axis
Hi Sibylle,
For that kind of data with two different scales, I generally use two graphs
that I name gg1 and gg2 and join them using gridExtra::grid.arrange(gg1,
gg2). This way, the red part of your graph is easier to interpret.
Have a nice day,
Charles-?douard
-----Message d'origine-----
De?: R-help <r-help-bounces at r-project.org> De la part de
sibylle.stoeckli at gmx.ch
Envoy??:
2023 Nov 24
1
ggplot adjust two y-axis
Hi,
I don't know the axis mecanism well enough in ggplot but using the original
barplot function you can add an axis on the right using the axis function.
Here is an example:
test <- as.table(matrix(c(2,10,3,11), 2,2))
barplot(test, beside = TRUE, col = scales::brewer_pal(palette = 1)(2))
axis(4, at = c(0, 5, 10), labels = c(0,50,100))
-----Message d'origine-----
De?:
2023 Nov 24
1
ggplot adjust two y-axis
Dear Charles-Edouard
Thanks a lot. Yes indeed barplot sounds excellent.
Unfortunately, the scale of the smaller axis is fixed, even If I am able to
draw to axes. The idea is to expand the scale to the scale to the second
axis for comparison.
F1 <- as.table(matrix(c(50,11,6,17,16,3,1,2237,611,403,240,280,0,0), 2,7))
barplot(F1, beside = TRUE, col = c("blue", "grey"))
2023 Nov 24
1
ggplot adjust two y-axis
Hi,
Just find a scaling factor that would make the two sets of data comparable.
Here I divided the second row by 5 and did the same for the second axis.
Charles-?douard
F1 <- as.table(matrix(c(50,11,6,17,16,3,1,2237,611,403,240,280,0,0), 2,7))
barplot(F1, beside = TRUE, col = c("blue", "grey")) axis(2,
at=c(0,10,20,30,40,50,60, labels=c(0,10,20,30,40,50,60))) axis(4, at =
2018 May 05
1
error in chol.default((value + t(value))/2) : , the leading minor of order 1 is not positive definite
Dear friends - I'm having troubles with nlme fitting a simplified model
as shown below eliciting the error
Error in chol.default((value + t(value))/2) :
? the leading minor of order 1 is not positive definite -
I have seen the threads on this error but it didn't help me solve the
problem.
The model runs well in brms and identifies the used parameters even with
fixed effects for TRT?
2024 Feb 05
2
ggarrange & legend
Dear John Kane
Dear R community
Here my working example
1. Example that is working with legend=?top?. However, as mentioned, the legend is in the middle of the top axis.
mylist<-list(p1, p2)
dev.new(width=28, height=18)
fig1<- ggarrange(plotlist=mylist, common.legend = TRUE, legend="top", labels = c("(A)", "(B)"), font.label = list(size = 18, color =
2024 Feb 05
1
ggarrange & legend
I'm sorry but that is not a working example.
A working example needs to create the plots being used.
For example, stealing some code from
https://rpkgs.datanovia.com/ggpubr/reference/ggarrange.html
#=================================================================
data <https://rdrr.io/r/utils/data.html>("ToothGrowth")df <-
ToothGrowthdf$dose <- as.factor
2024 Feb 05
1
ggarrange & legend
Could you supply us with a MWE (minimal working example)of what you have so
far?
Thanks.
On Mon, 5 Feb 2024 at 05:00, SIBYLLE ST?CKLI via R-help <
r-help at r-project.org> wrote:
> Dear R community
>
> It is possible to adjust the legend in combined ggplots using ggarrange
> with
> be positions top, bottom, left and right.
> My question: Is there a function to change the
2009 Sep 29
2
rbind for a list
Dear All,
I´m using the following code:
all1<-gg2[[1]][[1]]; for(i in 1:48){ all1 <- rbind(all1,gg2[[i]][[1]]) }
to create a new matrix that contains all the matrices in a list called gg2.
gg2 is a list that looks like
>> gg2
[[1]]
[[1]][[1]]
<matrix one>
[[2]]
[[2]][[1]]
<matrix two>
.
.
.
[[48]]
[[48]][[1]]
<matrix 48>
Is there a faster way to do the rbind?
2009 Feb 16
1
Overdispersion with binomial distribution
I am attempting to run a glm with a binomial model to analyze proportion
data.
I have been following Crawley's book closely and am wondering if there is
an accepted standard for how much is too much overdispersion? (e.g. change
in AIC has an accepted standard of 2).
In the example, he fits several models, binomial and quasibinomial and then
accepts the quasibinomial.
The output for residual
2024 Apr 18
2
Import multiple tif raster
Dear community
Dear Ivan
Thanks a lot. The code works now. Solution: direct and full path to the .tif files.
I confused back and forward slash
#first import all files in a single folder as a list
rastlist <- list.files(path = "C:/Users/Sibylle St?ckli/Desktop/NCCS_Impacts_Lot2_2022/InVEST/Species_Input/valpar_bee_presence", pattern='.tif$', all.files= T, full.names= T)
At
2024 Apr 18
1
Import multiple tif raster
Dear Ivan
Thanks a lot.
I tried now to provide the full path. However probably the "?" in the path produces the error, would that be possible?
> #first import all files in a single folder as a list
> rastlist <- list.files(path = "C:\Users\Sibylle St?ckli\Desktop\NCCS_Impacts_Lot2_2022\InVEST\Species_Input\valpar_bee_presence", pattern='.tif$', all.files=
2011 Jul 09
1
Suppressing the labelling of tick marks on ggplot2
Hi,
I have the follow ggplot2 code I am running:
ggplot(data=bb.res.math,aes(x=factor(id.bb),y=bb.math.comb,fill=BB)) + geom_bar() + facet_grid(BB~.) + scale_fill_brewer(pal="Set1") + ylab("Average Student Residual (Math)") + xlab("Student ID")
The number of unique id.bb is 2207 and so my X-axis has a couple of thousands, indistinguishable tick marks that correspond
2024 Aug 16
2
allequal diff
Many thanks Ivan
Use is.na() on getValues() outputs, combine the two masks using the | operator to get a mask of values that are missing in either raster, then negate the mask to choose the non-missing values:
all.equal(getValues(r1)[!mask], getValues(r2)[!mask])
--> what do you mean by use is.na() in getValues(). So I need to call getValues a second time? I suppose you mean to first
2018 Jan 09
3
barplot_add=TRUE
Dear R users
aim
Barplot of insect trap catches (y variable trapcatch) at one specific station (variable FiBL_Hecke) from week 1-52 ( x variable week).
It works well using the function tapply (sum trapcatch per week, males and females not separated), however, I intend to separate the y variable trapcatch in males and females (variable m_w: m and w)
problem
I used the function "add" to
2024 Aug 18
2
allequal diff
Dear Ivan
Thanks a lot for this very nice example.
Is it true that all.equal just compares y values?
Based on this help here I think so and the value I got is the difference for the y-values.
https://www.statology.org/all-equal-function-r/
However, here I see x and y testing?
https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/all.equal
I am actually interested in the x values
2024 Apr 18
1
Import multiple tif raster
? Thu, 18 Apr 2024 11:08:33 +0200
SIBYLLE ST?CKLI via R-help <r-help at r-project.org> ?????:
> > #to check the index numbers of all imported raster list elements
> > allrasters
> list()
> >
> > #call single raster element
> > allrasters[[1]]
> Error in allrasters[[1]] : subscript out of bounds
`allrasters` is an empty list, so it doesn't have a
2010 Oct 27
1
Fwd: as.list
-------- Original-Nachricht --------
Datum: Wed, 27 Oct 2010 15:03:48 +0200
Von: "Sibylle St?ckli" <sibylle.stoeckli at gmx.ch>
An: Rhelp <r-help at r-project.org>
Betreff: as.list
Dear R-users
sorry, here Rcode included (attachment has been removed)
I would like to read a txt file as list, to select rows and columns, and to create barplots.
(1) selection of parameter
2013 Aug 22
1
varpart
Dear R-users
I applied vegan's varpart function to partition the effects of
explanatory matrices. Adj. R square for the unique fraction [a] is
0.25. Does anyone know why the decomposition by hand using rda gives
me a different result for [a] (constrained proportion is 0.32)? I used
cbind() for the conditional fractions, but it should be similar to
condition()?
Thanks very much
2024 Aug 18
2
allequal diff
"Is it true that all.equal just compares y values?"
The following may be a bit more than you may have wanted, but I hope
it is nevertheless useful.
The first place you should go to for questions like this is the Help
system, not here, i.e.
?all.equal
When you do this, you will find that all.equal() is a so-called S3
generic function, which, among other things, means that it works