[R] lattice subscripts with both condition and group

2024-11-05 Thread Naresh Gurbuxani
How can I use subscripts to draw the last graph with one call to                          function xyplot()?                                                                                                                                                                  Thanks,                  

[R] lattice xyplot with cumsum() function inside

2024-09-28 Thread Naresh Gurbuxani
This code gives unexpected result. library(data.table) library(lattice) set.seed(123) mydt <- data.table(date = seq.Date(as.IDate("2024-01-01"), by = 1, length.out = 50), xgroup = "A", x = runif(50, 0, 1)) mydt <- rbindlist(list(mydt, data.table(date = mydt$date, xgroup = "B", x = runif(50, 0,

Re: [R] lattice log scale labels.

2024-09-05 Thread Gerrit Draisma
Thanks Greg and Bert for solving my problem. This gives what I want: myticks <- 2^(3*(0:11)) mylabels <- parse(text=paste0("2^",log2(myticks))) xyplot(c+t+u~n,data=x,type="b", xlab="Size", ylab="Number of tangles", scales=list(x=list(at=4*(1:9)),y=list(log=2,at=myticks,labels=

Re: [R] lattice log scale labels.

2024-09-05 Thread Bert Gunter
Do the "at" and "labels" components of the "scales" list argument to xyplot not do what you want? Cheers, Bert On Thu, Sep 5, 2024 at 4:05 AM Gerrit Draisma wrote: > Dear R-helpers, > > In the plot below I would like to have labels at positions 2^(3*(0:10)), > and keep the labels in the exponen

[R] lattice log scale labels.

2024-09-05 Thread Gerrit Draisma
Dear R-helpers, In the plot below I would like to have labels at positions 2^(3*(0:10)), and keep the labels in the exponential format. I tried using yscale.components.default. *This* gives the right format of the labels: > yscale.components.default(lim= c(0,30),log=2) $num.limit [

Re: [R] lattice panel layout like cross-tabs, like a 2 x 2 table.

2024-08-30 Thread Deepayan Sarkar
You are thinking of latticeExtra::useOuterStrips. Best, -Deepayan On Sat, 31 Aug 2024 at 02:53, Christopher W. Ryan via R-help < r-help@r-project.org> wrote: > Years ago, I recall creating lattice plots with two binary factors, call > them f1 and f2, as in > > xyplot(y ~ x | f1 + f2, data = dd)

[R] lattice panel layout like cross-tabs, like a 2 x 2 table.

2024-08-30 Thread Christopher W. Ryan via R-help
Years ago, I recall creating lattice plots with two binary factors, call them f1 and f2, as in xyplot(y ~ x | f1 + f2, data = dd) and I made it so the rows had strips on the left with the levels of one factor, and the columns had strips on the top with the levels of the other factor. Sort of lik

Re: [R] lattice densityplot with weights

2023-09-29 Thread Deepayan Sarkar
Yes, the following should (mostly) work: lattice::densityplot(~ x, mydf, groups = name, weights = wt, auto.key = list(space = "inside"), grid = TRUE) I just realised that the 'subdensity' and 'warnWbw' arguments are not passed through by densityplot(), so there is no way to get rid of the cor

Re: [R] lattice densityplot with weights

2023-09-29 Thread Bert Gunter
Unless I misunderstand... See ?panel.densityplot Lattice functions do their work through a host of panel functions, typically passing their ... arguments to the panel functions. panel.densityplot has a weights argument. Cheers, Bert On Fri, Sep 29, 2023 at 3:32 AM Naresh Gurbuxani < naresh_g

[R] lattice densityplot with weights

2023-09-29 Thread Naresh Gurbuxani
density() function in R accepts weights as an input. Using this function, one can calculate density and plot it. Is it possible to combined these two operations in lattice densityplot()? mydf <- data.frame(name = "A", x = seq(-2.9, 2.9, by = 0.2), wt = diff(pnorm(seq(-3, 3, by = 0.2 mydf <

Re: [R] lattice xyplot: how to change the y-axis labels size using yscale.components.subticks on the right side and how to adapt the ticks number

2023-05-31 Thread Laurent Rhelp
I will try to explain in a bit more detail. 1. I want to have the labels on the right with a small size to be able to read them 2. I would like not to have the labels on the left 3.  I would like to be able to choose the number of principal ticks for every sensor. That is to say the value of n

Re: [R] lattice xyplot: how to change the y-axis labels size using yscale.components.subticks on the right side and how to adapt the ticks number

2023-05-30 Thread Deepayan Sarkar
Thanks for the reproducible example. Could you explain what you want in a bit more detail? Does the following do more or less what you want, except that the labels are on the left instead of right? gr <- xyplot(value ~ tindexTOP | sensor , data = df_rhelp , ylab = " "

[R] lattice xyplot: how to change the y-axis labels size using yscale.components.subticks on the right side and how to adapt the ticks number

2023-05-29 Thread Laurent Rhelp
Dear R-Help-list,    I want to display many sensors on the same page so I have to adapt the size of the y-axis labels and I woul like to adapt the number of ticks according to the sensor. I use the yscale.components argument with the function yscale.components.subticks: see the code below. I

Re: [R] lattice xyplot: trouble about the use of yscale.components to start the yscale from zero

2023-01-24 Thread Laurent Rhelp
Thank you very much for the typo !! and the example about the consequences.  I did not know about the option warnPartialMatchDollar = TRUE, I tested it with my mistake it is very effective indeed. This option should be TRUE by default. I edited my mistake but there is still the trouble, the lab

Re: [R] lattice xyplot: trouble about the use of yscale.components to start the yscale from zero

2023-01-22 Thread Deepayan Sarkar
On Sun, Jan 22, 2023 at 6:48 PM Laurent Rhelp wrote: > Dear RHelp-list, > > I want to choice my scale for every panel in a lattice graph according to > the ylim range of every panel, with 10 ticks and with a start from 0. > Also I want to plot a grid >according to the y ticks (I did that

[R] lattice xyplot: trouble about the use of yscale.components to start the yscale from zero

2023-01-22 Thread Laurent Rhelp
Dear RHelp-list,  I want to choice my scale for every panel in a lattice graph according to  the ylim range of every panel, with 10 ticks and with a start from 0. Also I want to plot a grid   according to the y ticks (I did that in the panel argument with the panel.abline function) .  So I deci

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 <-

Re: [R] lattice question

2022-08-12 Thread Bert Gunter
I hit the wrong button, unfortunately, so others beside Naresh and Deepayan can safely ignore my "coda". On Fri, Aug 12, 2022 at 2:29 PM Bert Gunter wrote: > > As a private coda -- as it is unlikely to be of general interest -- > note that it is easy to do this without resorting to the layering >

Re: [R] lattice question

2022-08-12 Thread Naresh Gurbuxani
This is the solution I was looking for. Thanks to Deepayan and Bert for sticking with me. Naresh Sent from my iPhone On Aug 12, 2022, at 8:02 AM, Deepayan Sarkar wrote:  On Thu, Aug 11, 2022 at 9:03 PM Naresh Gurbuxani mailto:naresh_gurbux...@hotmail.com>> wrote: Bert, Thanks for provid

Re: [R] lattice question

2022-08-10 Thread Naresh Gurbuxani
Deepayan, Thanks for providing a solution. While this is close to my goal, I want one more change. The line type (lty) should be the same for long and short. The line type should only change according to “name” group. So the the graph will have two line types (not four as in your solution).

Re: [R] R lattice contourplot: select only specific values

2021-11-17 Thread Luigi Marongiu
Awesome, thanks! On Wed, Nov 17, 2021 at 7:50 PM Bill Dunlap wrote: > > Try using at=c(1.8, 2.8) to specify the contour levels you want (and omit the > cuts= argument). > > -Bill > > On Wed, Nov 17, 2021 at 5:41 AM Luigi Marongiu > wrote: >> >> I have a dataframe of three variables: x, y, z. T

Re: [R] lattice contourplot: how to change line width?

2021-11-17 Thread Luigi Marongiu
Thank you! yes, I thought line width was controlled by some kind of panel function... On Wed, Nov 17, 2021 at 7:06 PM Bert Gunter wrote: > > Your code is unnecessarily complex. > contourplot() will by default use the panel.contourplot() function and pass > down graphical arguments to it. > > So

Re: [R] R lattice contourplot: select only specific values

2021-11-17 Thread Bill Dunlap
Try using at=c(1.8, 2.8) to specify the contour levels you want (and omit the cuts= argument). -Bill On Wed, Nov 17, 2021 at 5:41 AM Luigi Marongiu wrote: > I have a dataframe of three variables: x, y, z. The value of z are: > ``` > > unique(df$z) > [1] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.6 3.0 2.4 2

Re: [R] lattice contourplot: how to change line width?

2021-11-17 Thread Bert Gunter
Your code is unnecessarily complex. contourplot() will by default use the panel.contourplot() function and pass down graphical arguments to it. So this suffices: contourplot(Z ~ X*Y, data = df, cuts = 3, lwd =2) Customization of the panel function appears to be unnecessary for your needs. Bert G

[R] R lattice contourplot: select only specific values

2021-11-17 Thread Luigi Marongiu
I have a dataframe of three variables: x, y, z. The value of z are: ``` > unique(df$z) [1] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.6 3.0 2.4 2.8 ``` I would like to plot the contour where the data get integer values (1.0, 2.0, 3.0) but also highlight where the 1.8 and 2.8 values occurred. Thus, I am plotting

Re: [R] lattice contourplot: how to change line width?

2021-11-17 Thread Luigi Marongiu
sorry, it was easier than expected: just add `lwd` to the main cal. sorry I could not stop the message before checking... On Wed, Nov 17, 2021 at 10:31 AM Luigi Marongiu wrote: > > Hello, > I have generated a contourplot with lattice. How do I set the line > width? I tried with: > ``` > library(l

[R] lattice contourplot: how to change line width?

2021-11-17 Thread Luigi Marongiu
Hello, I have generated a contourplot with lattice. How do I set the line width? I tried with: ``` library(lattice) contourplot(Z ~ X*Y, data = df, cuts = 3, panel=function(x,y,...){ panel.contourplot(lty=1, lwd = 3) }) ``` but did not work... Thank you

Re: [R] R lattice stripplot add median line to data

2019-10-25 Thread PIKAL Petr
Hi See in line > -Original Message- > From: Luigi Marongiu > Sent: Friday, October 25, 2019 1:33 PM > To: PIKAL Petr > Cc: Bert Gunter ; r-help > Subject: Re: [R] R lattice stripplot add median line to data > > Ops, yes now it works. But again it gives a sin

Re: [R] R lattice stripplot add median line to data

2019-10-25 Thread Luigi Marongiu
own3"))), > > > > > strip = function(..., bg) { > > > > > strip.default(..., > > > > > bg = > > > > > trellis.par.get("strip.background")$col[which.packet()]) > > > > > }, > > >

Re: [R] R lattice stripplot add median line to data

2019-10-25 Thread PIKAL Petr
uot;brown3"))), > > > > strip = function(..., bg) { > > > > strip.default(..., > > > > bg = > > > > trellis.par.get("strip.background")$col[which.packet()]) > > > > }, > > > > # add

Re: [R] R lattice stripplot add median line to data

2019-10-25 Thread Luigi Marongiu
v = v[k], h = h[k], > ...) > else panel.abline(a = a, b = b, v = v, h = h, ...) > trellis.unfocus() > } > } > > Cheers > Petr > > > > > -Original Message- > > From: R-help On Behalf Of Bert Gunter > >

Re: [R] R lattice stripplot add median line to data

2019-10-25 Thread PIKAL Petr
er > Sent: Thursday, October 24, 2019 6:23 PM > To: Luigi Marongiu > Cc: r-help > Subject: Re: [R] R lattice stripplot add median line to data > > Yes, it's possible to do about anything in lattice, but you have to learn how > to write custom panel functions, which ta

Re: [R] R lattice stripplot add median line to data

2019-10-24 Thread Bert Gunter
Yes, it's possible to do about anything in lattice, but you have to learn how to write custom panel functions, which takes some effort. If you want to use lattice in this way, you should probably go through Deepayan's book. Here is one way to do what I think you want. Note that it depends on knowi

[R] R lattice stripplot add median line to data

2019-10-24 Thread Luigi Marongiu
Dear all, I am plotting data with lattice's stripplot. Is it possible to add a median line to each cluster? This is the working example: ``` Sample = c("A0", "A0", "A0", "A3", "A3", "A3", "A7", "A7", "A7", "A9", "A9", "A9", "H1", "H1", "H1", "H2", "H2", "H2", "H3", "H3", "

Re: [R] lattice barchart() with two variables

2018-08-24 Thread Rich Shepard
On Fri, 24 Aug 2018, Richard M. Heiberger wrote: color for the legend comes from trellis.par.get You can control that for an individual plot with the par.settings argument. tmp <- data.frame(y=sample(10), group=rep(c("Median", "Maximum"), each=5), year=factor(re

Re: [R] lattice barchart() with two variables

2018-08-24 Thread Rich Shepard
On Fri, 24 Aug 2018, Bert Gunter wrote: For the legend, you can use the full "key" argument for more control. Bert, This I did. For the scales, again, the docs provide the answer: the "at" and "labels" components of "x" component of the scales lists can explicitly control the x -labels,

Re: [R] lattice barchart() with two variables

2018-08-24 Thread Bert Gunter
x -labels, e.g. scales = list( x = list( at = ..., labels = ...)etc. If you are uncomfortable with the R lattice help docs, and you intend to continue to use lattice plots (a good idea; ggplot is an alternative of course), Deepayan has written a book that you might wish to get: http://lm

Re: [R] lattice barchart() with two variables

2018-08-24 Thread Richard M. Heiberger
color for the legend comes from trellis.par.get You can control that for an individual plot with the par.settings argument. tmp <- data.frame(y=sample(10), group=rep(c("Median", "Maximum"), each=5), year=factor(rep(1998:1999, length=10))) barchart(y ~ year, da

Re: [R] lattice barchart() with two variables

2018-08-24 Thread Rich Shepard
On Wed, 22 Aug 2018, Rich Shepard wrote: More when I have results. Almost there. I've read the auto.key section in ?barchart and looked at examples from stackoverflow on the web without seeing my syntax errors. I would like help on two issues: 1. What I want is to have the legend text in

Re: [R] lattice barchart() with two variables

2018-08-22 Thread Rich Shepard
On Wed, 22 Aug 2018, Bert Gunter wrote: groups = Summary.Type, ... in your call will then do the job. As an aside, this is a good example of why you should adhere to this format for data analysis in R. Bert, Progress and retreat. I'm putting this aside for a day or so because I need t

Re: [R] lattice barchart() with two variables

2018-08-22 Thread Rich Shepard
On Wed, 22 Aug 2018, Bert Gunter wrote: (I know that you said your post may already be "out of date", but ...) Bert, Still reading ?xyplot/?barchart. But ?barchart says: "Formally, if groups is specified, then groups along with subscripts is passed to the panel function, ..." which, as I

Re: [R] lattice barchart() with two variables

2018-08-22 Thread Bert Gunter
(I know that you said your post may already be "out of date", but ...) " Despite additional reading of barchart() examples and help pages I'm still missing how to get grouping working and use the years in the dataframe as labels on the x-axis." But ?barchart says: "Formally, if groups is specif

Re: [R] lattice barchart() with two variables

2018-08-22 Thread Rich Shepard
On Wed, 22 Aug 2018, Rich Shepard wrote: Correcting the barchard() command fixed the main issue; getting the second set of bars is still eluding me, but I'll continue working on fixing this. I'll get the years as the x-axis labels rather than year number in sequence from 1 to 29. Despite add

Re: [R] lattice barchart() with two variables

2018-08-22 Thread Rich Shepard
On Wed, 22 Aug 2018, Bert Gunter wrote: See inline. Bert, Will do. Sent a reply before seeing this. More to follow. Thanks, Rich __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help P

Re: [R] lattice barchart() with two variables

2018-08-22 Thread Bert Gunter
See inline. -- Bert On Wed, Aug 22, 2018 at 9:17 AM Rich Shepard wrote: > On Wed, 22 Aug 2018, Bert Gunter wrote: > > > No reproducible example (see posting guide below) so minimal help. > > Hi Bert, > >I thought the header and six data rows of the dataframe plus the syntax > of > the com

Re: [R] lattice barchart() with two variables

2018-08-22 Thread Rich Shepard
On Wed, 22 Aug 2018, Bert Gunter wrote: No reproducible example (see posting guide below) so minimal help. Hi Bert, I thought the header and six data rows of the dataframe plus the syntax of the command I used were sufficient. Regardless, here's the dput() output: structure(list(Year = c(1

Re: [R] lattice barchart() with two variables

2018-08-22 Thread Bert Gunter
No reproducible example (see posting guide below) so minimal help. Remove the quotes from your formula. Why did you think they should be there? -- see ?formula. Read the relevant portions of ?xyplot carefully (again?). You seemed to have missed: "*Primary variables:* The x and y variables should

[R] lattice barchart() with two variables

2018-08-22 Thread Rich Shepard
I've not before created bar charts, only scatter plots and box plots. Checking in Deepayan's book, searching the web, and looking at ?barchart has not shown me the how to get the results I need. The dataframe looks like this: head(stage_heights) Year Med Max 1 1989 91.17 93.32 2 1990

Re: [R] Lattice stacked barplot vertical bars

2017-09-22 Thread Luigi Marongiu
c("yellow", "orange")) > ), > strip = strip.custom(factor.levels = c("Cases","Controls"), > strip.levels=TRUE, > strip.names=FALSE, > par.strip.text = list(cex = 1) > )

Re: [R] Lattice stacked barplot vertical bars

2017-09-22 Thread Duncan Mackay
par.strip.text = list(cex = 1) ) ) Too late to do anything more Regards Duncan Macka -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Luigi Marongiu Sent: Friday, 22 September 2017 21:53 To: r-help Subject: [R] Lattice stacked

[R] Lattice stacked barplot vertical bars

2017-09-22 Thread Luigi Marongiu
Dear all, I have made a barplot using lattice in which the bars are stacked horizontally. I would like to stack them vertically, but if I use the parameter 'horizontal = FALSE' I get the error: 'Error in FUN(X[[i]], ...) : invalid 'type' (character) of argument'. The problem I face is that, in draw

Re: [R] Lattice Histogram Scaling

2017-08-15 Thread Richard M. Heiberger
The original was conditioning the entire histogram, not just the kernel estimate, on bw. I am assuming that the bw in the condition should be bandwidths. What you want is easily done by using the latticeExtra package. This works from a new R session: url <- "http://www.econ.uiuc.edu/~roger/rese

Re: [R] Lattice Histogram Scaling

2017-08-15 Thread Roger Koenker
My apologies, the data can now be found at: url <- "http://www.econ.uiuc.edu/~roger/research/ebayes/velo.d"; x <- scan(url,skip = 1) If I could get each of the histograms to mimic what is produced by hist(x, 100, freq = FALSE) I’ve experimented with xlim, ylim, without success so far... url:

Re: [R] Lattice Histogram Scaling

2017-08-14 Thread Richard M. Heiberger
Your example is not easily reproducible. The REBayes requires Rmosek which requires a system command MOSEK. Please try again with an example using data in base R. Meanwhile, my guess is that you will need to do something like explicitly specifying xlim and ylim so all panels have the same limits.

[R] Lattice Histogram Scaling

2017-08-14 Thread Roger Koenker
I am trying to do some comparisons of density estimators using lattice. The code below attempts to plot the same histogram in each panel and then overplots a kernel estimate with different bandwidths. Finding packet.number() was a bit arduous, but seems to do what I want. My concern now is that cl

Re: [R] Lattice xyplot

2017-05-01 Thread array chip via R-help
Thanks all for the clarification! From: Jeff Newmiller To: r-help@r-project.org; Bert Gunter ; array chip Cc: "r-help@r-project.org" Sent: Monday, May 1, 2017 10:53 AM Subject: Re: [R] Lattice xyplot It is not a question of whether lattice "understands&quo

Re: [R] Lattice xyplot

2017-05-01 Thread peter dalgaard
> On 1 May 2017, at 17:59 , Bert Gunter wrote: > > (Too trivial for the list) ...so you decided to include us only once? >;-) -pd > > I debated saying something similar but decided not to, as polygons can > be drawn e.g. via panel.polygon. > > Cheers, > Bert > > > > > On Mon, May 1, 201

Re: [R] Lattice xyplot

2017-05-01 Thread Bert Gunter
(Too trivial for the list) I debated saying something similar but decided not to, as polygons can be drawn e.g. via panel.polygon. Cheers, Bert On Mon, May 1, 2017 at 8:25 AM, Jeff Newmiller wrote: > It is not a question of whether lattice "understands" the unsorted data... > imagine trying

Re: [R] Lattice xyplot

2017-05-01 Thread Jeff Newmiller
It is not a question of whether lattice "understands" the unsorted data... imagine trying to plot 4 points to form a square instead of a trend line... you would NOT want lattice to sort those points for you. That lattice leaves your data alone gives you more flexibility, even while it adds work

Re: [R] Lattice xyplot

2017-05-01 Thread Duncan Mackay
groups=id, aspect = "fill", type = c("p", "l"), xlab = "Time", ylab = "Y") Regards Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England Armidale NSW 2351 Email: home: mac...@northnet.com.au -Original M

Re: [R] Lattice xyplot

2017-05-01 Thread Bert Gunter
Yes. type = "l" connects the points in the order given in the data, so if the x's are not already ordered, the plots will be different after ordering the x's. e.g. > x <- c(3,1,2,4,6,5) > y <- 11:16 > xyplot(y~x. type = "l") As for why ... that's just the way it was designed. You can always ord

[R] Lattice xyplot

2017-05-01 Thread array chip via R-help
Dear all, I am new to lattice, so would appreciate anyone's help on the questions below. I am using xyplot to plot some trend in my dataset. Using the example dataset attached, I am trying to plot variable "y" over variable "time" for each subject "id": dat<-read.table("dat.txt",sep='\t',header=

Re: [R] lattice graph with free scales and reversed axis values

2016-11-05 Thread Naresh Gurbuxani
This worked very well for me. Thanks, Naresh From: P Tennant Sent: Saturday, November 5, 2016 7:57 PM To: Naresh Gurbuxani Cc: R-help@r-project.org Subject: Re: [R] lattice graph with free scales and reversed axis values Hi Naresh, You could calculate the

Re: [R] lattice graph with free scales and reversed axis values

2016-11-05 Thread P Tennant
Hi Naresh, You could calculate the ranges explicitly and then supply to scales(): holdRange <- vector('list', length(unique(my.df$name))) for(i in 1:length(holdRange)){ holdRange[[i]] <- rev(range(my.df$x[my.df$name==unique(my.df$name)[i]])) } holdRange # [[1]] # [1] -5.052890 -9.967

Re: [R] lattice graph with free scales and reversed axis values

2016-11-05 Thread David Winsemius
> On Nov 5, 2016, at 3:59 PM, Naresh Gurbuxani > wrote: > > I want to draw a lattice graph where different panels have different ranges > AND the order of values is reversed. I am struggling to achieve both at the > same time. Can you help? > > Thanks, > Naresh > > # Create dummy data for

Re: [R] lattice: control panel extent on device

2016-10-25 Thread Duncan Mackay
University of New England Armidale NSW 2351 Email: home: mac...@northnet.com.au -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ben Tupper Sent: Tuesday, 25 October 2016 23:53 To: r-help Subject: [R] lattice: control panel extent on device Hello, I am drawing a

Re: [R] lattice: control panel extent on device

2016-10-25 Thread Ben Tupper
Thanks, Bert. I have used latticeExtra for layering graphics. I'm not sure how I would use it to align graphics rather superimposing them. I shall look into the the custom panel plot but that is very new territory for me. Ben > On Oct 25, 2016, at 9:13 AM, Bert Gunter wrote: > > Write a cu

[R] lattice: control panel extent on device

2016-10-25 Thread Ben Tupper
Hello, I am drawing a levelplot and an xyplot on a single device as shown in the runnable example below. I would like the x axes to align - that is for them to cover the same extent left-to-right on the device. How do I go about doing that? ### # START ### library(lattice) d <- dim(vo

Re: [R] Lattice equivalent to ggplot function

2016-10-24 Thread Carlos Ortega
Hi, Yes, it is available in "latticeExtra" package in function "panel.smoother()". Thanks, Carlos Ortega www.qualityexcellence.es 2016-10-24 15:13 GMT+02:00 Sébastien Bihorel : > Hi, > > The ggplot2 includes the very convenient stat_summary function to summarize > y variable data and plot this

[R] Lattice equivalent to ggplot function

2016-10-24 Thread Sébastien Bihorel
Hi, The ggplot2 includes the very convenient stat_summary function to summarize y variable data and plot this summary statistic in a y vs x graph. I need to implement similar functionality in a lattice-based framework. Googling this topic using keywords like lattice, equivalent, stat_summary, did

Re: [R] Lattice xyplot(): adding a legend [RESOLVED]

2016-10-20 Thread Rich Shepard
On Thu, 20 Oct 2016, David Winsemius wrote: Why are you creating this factor? The `date` column has the desirable properties associated with the "Date" class. Axis labeling will be correct. David, et al.: Because originally I mis-understood the parameters; it's gone now. rainbyday2 <- xyp

Re: [R] Lattice xyplot(): adding a legend

2016-10-20 Thread David Winsemius
> On Oct 20, 2016, at 9:20 AM, Rich Shepard wrote: > > On Wed, 19 Oct 2016, David Winsemius wrote: > >> I am getting annoyed, exhausted, and frustrated reading code like that. >> Never, ever, ... ever, use the "$" operator in a formula. Use the 'data' >> argument and the 'formula' as they are s

Re: [R] Lattice xyplot(): adding a legend

2016-10-20 Thread Bert Gunter
1. Your par(), opar() business is junk -- lattice displays do not use or modify these. See ?trellis.par.set . 2. You do *not* need rain$ in your formula with the data=rain argument; you *do* need it in the at argument and elsewhere. The data argument only controls where the variables in the formul

Re: [R] Lattice xyplot(): adding a legend

2016-10-20 Thread Rich Shepard
On Wed, 19 Oct 2016, David Winsemius wrote: I am getting annoyed, exhausted, and frustrated reading code like that. Never, ever, ... ever, use the "$" operator in a formula. Use the 'data' argument and the 'formula' as they are supposed to be used. David, I apologize for annoying, exhaustin

Re: [R] Lattice xyplot(): adding a legend

2016-10-19 Thread David Winsemius
> On Oct 19, 2016, at 4:04 PM, Rich Shepard wrote: > > On Wed, 19 Oct 2016, Rich Shepard wrote: > >> I did read that but mis-applied what I read. Tried auto.key but that did >> not work as desired. Now I know to learn how to apply 'key'. > > Almost there after another careful reading Section

Re: [R] Lattice xyplot(): adding a legend

2016-10-19 Thread Duncan Mackay
Mackay Sent: Thursday, 20 October 2016 16:11 To: R Subject: Re: [R] Lattice xyplot(): adding a legend Hi Rich Without an example to check I think you need to fill in the arguments for par.settings eg par.settings = list(plot.symbol = list(c("black","red","dark green&quo

Re: [R] Lattice xyplot(): adding a legend

2016-10-19 Thread Duncan Mackay
rsity of New England Armidale NSW 2351 Email: home: mac...@northnet.com.au -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Rich Shepard Sent: Thursday, 20 October 2016 10:05 To: r-help@r-project.org Subject: Re: [R] Lattice xyplot(): adding a legend O

Re: [R] Lattice xyplot(): adding a legend

2016-10-19 Thread Rich Shepard
On Wed, 19 Oct 2016, Rich Shepard wrote: I did read that but mis-applied what I read. Tried auto.key but that did not work as desired. Now I know to learn how to apply 'key'. Almost there after another careful reading Section 9.2.3 ff in the book. Here's the command to produce the plot: ra

Re: [R] Lattice xyplot(): adding a legend

2016-10-19 Thread Rich Shepard
On Wed, 19 Oct 2016, David Winsemius wrote: The `legend` function is used with base graphics plotting (as is the par function). David, And that's how I used it before so it is the wrong template for this plot. Mea culpa! I think you might first read ?Lattice since it makes reference to th

Re: [R] Lattice xyplot(): adding a legend

2016-10-19 Thread David Winsemius
> On Oct 19, 2016, at 10:48 AM, Rich Shepard wrote: > > After reading ?xyplot and pages 161-162 in Deepayan's book I'm still not > getting the syntax correct to add a legend to a scatterplot. The data are > attached as filename rain.dput. > > Without the legend (and testing interactively) the

[R] Lattice xyplot(): adding a legend

2016-10-19 Thread Rich Shepard
After reading ?xyplot and pages 161-162 in Deepayan's book I'm still not getting the syntax correct to add a legend to a scatterplot. The data are attached as filename rain.dput. Without the legend (and testing interactively) the data plot but not the legend. Sourcing the script opens the dis

Re: [R] Lattice barchart legend with panel.barchart

2016-07-27 Thread Duncan Mackay
2) ) ) Regards Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England Armidale NSW 2351 Email: home: mac...@northnet.com.au -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Seth Bigelow Sent: Thursday, 28 July 2016

[R] Lattice barchart legend with panel.barchart

2016-07-27 Thread Seth Bigelow
I have constructed a barchart that requires a panel call, but the panel reduces the facsimiles of bars in the legend to small colored circles. You can see this behavior in the following example: Titan <- as.data.frame(Titanic) titanpanel <- function(x,y,...){ panel.barchart(x,y,...) } barchart(C

Re: [R] lattice strip.custom in plot for multiple groups

2015-12-18 Thread David Winsemius
> On Dec 18, 2015, at 12:22 PM, Luigi Marongiu wrote: > > Dear all, > I am plotting the count of some data subdivided in different groups. > the variables i am using are: > A = tests performed > B = positive/negative results (but in this case the results are all > positive, so all 1) > C = multi

[R] lattice strip.custom in plot for multiple groups

2015-12-18 Thread Luigi Marongiu
Dear all, I am plotting the count of some data subdivided in different groups. the variables i am using are: A = tests performed B = positive/negative results (but in this case the results are all positive, so all 1) C = multiple (1) or single (0) test applied D = count of instances E = cases (1) o

Re: [R] Lattice Package in R: Is it possible to develop an interactive “scatterplot/network”?

2015-10-29 Thread Bert Gunter
You need to go back and read an R tutorial (e.g. the Intro to R one that ships with R) about how functions pass ... arguments. Your customPanel2 function does not use the ... argument passed to it, so what you are trying to do by including it? Beyond that, I do not have the patience to go through

[R] Lattice Package in R: Is it possible to develop an interactive “scatterplot/network”?

2015-10-28 Thread Luck Buttered
I am developing an interactive scatterplot so that when the user rolls over a data point, a label is displayed. However, I would also like to add edges between certain data points. I am successful at developing the interactive scatterplot using several libraries, including grid, gridSVG, lattice,

Re: [R] [lattice::xyplot] Using (panel:.)abline with panel.superpose?

2015-10-07 Thread Duncan Mackay
Forgot to send to list -Original Message- From: Duncan Mackay [mailto:dulca...@bigpond.com] Sent: Thursday, 8 October 2015 08:44 To: 'Szumiloski, John' Subject: RE: [R] [lattice::xyplot] Using (panel:.)abline with panel.superpose? Hi John I only got grid lines on your # c

[R] [lattice::xyplot] Using (panel:.)abline with panel.superpose?

2015-10-07 Thread Szumiloski, John
Dear useRs, I recently had a query concerning how to customize the graphics parameters in lattice::xyplot to change not only the color but also the pch symbols, lty and lwd line parameters, etc., within each grouping variable in the plot. (https://stat.ethz.ch/pipermail/r-help/2015-July/430285

  1   2   3   4   5   6   7   8   9   10   >