Re: [R] lattice: how to use a log scale on the x-axis with the bwplot function

2022-12-11 Thread Deepayan Sarkar
On Sun, Dec 11, 2022 at 11:05 PM Laurent Rhelp wrote: > > Excellent, it works. > > But, may you please explain me how xyplot knows that it has to apply > panel.bwplot on every groups according to the groups factor ? Because > there is only one panel. I introduced the groups argument in order to >

Re: [R] lattice: how to use a log scale on the x-axis with the bwplot function

2022-12-11 Thread Laurent Rhelp
Thank you very much Deepayan, I will see the help of panel.bwplot. Best regards L. Le 11/12/2022 à 18:53, Deepayan Sarkar a écrit : On Sun, Dec 11, 2022 at 11:05 PM Laurent Rhelp wrote: Excellent, it works. But, may you please explain me how xyplot knows that it has to apply panel.bwplot on

Re: [R] lattice: how to use a log scale on the x-axis with the bwplot function

2022-12-11 Thread Laurent Rhelp
Excellent, it works. But, may you please explain me how xyplot knows that it has to apply panel.bwplot on every groups according to the groups factor ? Because there is only one panel. I introduced the groups argument in order to apply the bwplot function only on the values of every group.

Re: [R] lattice: how to use a log scale on the x-axis with the bwplot function

2022-12-11 Thread Deepayan Sarkar
On Sun, Dec 11, 2022 at 2:33 PM Laurent Rhelp wrote: > > I understand the idea but I did not succeed. > > Here is what I tried: > > ## 1.middles of classes calculation > > m <- tapply(DF$x, groups, mean) > > ## 2. create a new factor columns with the levels deduced from > ## the va

Re: [R] lattice: how to use a log scale on the x-axis with the bwplot function

2022-12-11 Thread Laurent Rhelp
Indeed, I have to clarify my problem. I have to display  my physical measurements in a log-log representation. I can do that with xyplot from the lattice package. But I would like to show the dispersion of my measurement. So I wanted to use the bwplot function but it is not possible because the

Re: [R] lattice: how to use a log scale on the x-axis with the bwplot function

2022-12-11 Thread Bert Gunter
There can be **no log scale** for the x axis, only labels, if x is a factor (Groups). If what you mean is that there are no tick marks o the x-axis, they can be added in my code in the scales list (for my reprex with 5 levels of group): scales = list( alternating = 1 ## ticls only on b

Re: [R] lattice: how to use a log scale on the x-axis with the bwplot function

2022-12-11 Thread Laurent Rhelp
Ok for the labels but the x-axis is not displayed in log scale ? Le 10/12/2022 à 22:36, Bert Gunter a écrit : > ... and here's a version where the x variable is different than y. > It's basically the same. > > > set.seed(123) > y <- runif(40,min=0, max= 10) > x <- seq(0,10, length = 40) > ## 5

Re: [R] lattice: how to use a log scale on the x-axis with the bwplot function

2022-12-11 Thread Laurent Rhelp
I understand the idea but I did not succeed. Here is what I tried: ## 1.    middles of classes calculation m <- tapply(DF$x, groups, mean) ## 2. create a new factor columns with the levels deduced from ## the values of the middles of the classes ## DF$m <- DF$groups levels(DF$m) <

Re: [R] lattice: how to use a log scale on the x-axis with the bwplot function

2022-12-10 Thread Bert Gunter
... and here's a version where the x variable is different than y. It's basically the same. set.seed(123) y <- runif(40,min=0, max= 10) x <- seq(0,10, length = 40) ## 5 equally spaced groups labeled by log10 of the center ## of the intervals xrng <- range(x) eps <- .0001*c(-1,1)*diff(xrng) ## see

Re: [R] lattice: how to use a log scale on the x-axis with the bwplot function

2022-12-10 Thread Bert Gunter
If Deepayan's suggestion does not suit and especially *if* I understand what you want to do correctly, then it seems to me that it is straightforward to create the groups and group labels manually: ## in verbose detail to hopefully improve clarity set.seed(123) ## for reprex y <- runif(40,min=0,

Re: [R] lattice: how to use a log scale on the x-axis with the bwplot function

2022-12-10 Thread Deepayan Sarkar
Log-scales for the "factor" variable in bwplot() is not allowed. You could, however, use the panel function panel.bwplot() with xyplot(num ~ num). The potential problem with that is the box widths, which panel.bwplot() will not know how to compute. See if the following gives you a reasonable star

[R] lattice: how to use a log scale on the x-axis with the bwplot function

2022-12-10 Thread Laurent Rhelp
Dear R-Help list,    I would like to use bwplot from the lattice package with a log scale both on the x-axis and the y-axis but I do not know how to do that because I do not know how to change the factor x-axis in a numeric x-axis.  Here is my example: library(lattice) # the mock data y <-