Re: [R] plot(aov, which=1) with different labels?

2024-06-20 Thread Duncan Murdoch
On 2024-06-20 2:01 a.m., DynV Montrealer wrote: I need to do a non-English report including the red line from plot(aov, which=1), which I don't know how to reproduce. I'm thinking that if I replace the labels that it would be good (so no English remains). What I have so far is almost what I need,

[R] plot(aov, which=1) with different labels?

2024-06-19 Thread DynV Montrealer
I need to do a non-English report including the red line from plot(aov, which=1), which I don't know how to reproduce. I'm thinking that if I replace the labels that it would be good (so no English remains). What I have so far is almost what I need, the only thing that needs to change is what's rig

Re: [R] Plot for 10 years extrapolation

2023-10-28 Thread varin sacha via R-help
Dear Rui, I really thank you a lot for your precious R help. It is exactly what I was trying to do! Once more, many thanks! Best, Sacha Le vendredi 27 octobre 2023 à 09:36:18 UTC+2, Rui Barradas a écrit : Às 19:23 de 26/10/2023, varin sacha via R-help escreveu: > Dear R-Experts, >

Re: [R] Plot for 10 years extrapolation

2023-10-27 Thread Rui Barradas
Às 19:23 de 26/10/2023, varin sacha via R-help escreveu: Dear R-Experts, Here below my R code working but I don't know how to complete/finish my R code to get the final plot with the extrapolation for the10 more years. Indeed, I try to extrapolate my data with a linear fit over the next 10 yea

Re: [R] Plot for 10 years extrapolation

2023-10-26 Thread Bert Gunter
Incidentally, if all you wanted to do was plot fitted values, the predict method is kinda overkill, as it's just the fitted line from the model. But I assume you wanted to plot CI's/PI's also, as the example illustrated. -- Bert On Thu, Oct 26, 2023 at 1:56 PM Bert Gunter wrote: > > from ?predic

Re: [R] Plot for 10 years extrapolation

2023-10-26 Thread Bert Gunter
from ?predict.lm: "predict.lm produces a vector of predictions or a matrix of predictions and bounds with column names fit, lwr, and upr if interval is set. " ergo: predict(model, dfuture, interval = "prediction")[,"fit"] ## or [,1] as it's the first column in the returned matrix is your vector

[R] Plot for 10 years extrapolation

2023-10-26 Thread varin sacha via R-help
Dear R-Experts, Here below my R code working but I don't know how to complete/finish my R code to get the final plot with the extrapolation for the10 more years. Indeed, I try to extrapolate my data with a linear fit over the next 10 years. So I create a date sequence for the next 10 years and

Re: [R] Plot to a device and examine the plot?

2023-10-15 Thread Shu Fai Cheung
Thanks for the suggestion. I believe it is exactly what I need. I will try this function. Thanks! Regards, Shu Fai On Mon, Oct 16, 2023 at 3:39 AM Paul Murrell wrote: > > Hi > > You could also look at dev.capture(), depending on which screen device > you are using. > > Paul > > On 16/10/23 05:24

Re: [R] Plot to a device and examine the plot?

2023-10-15 Thread Shu Fai Cheung
Thanks a lot for introducing these functions! I am not aware of them but it seems that they can help me to do what I want to do. Regards, Shu Fai Regards, Shu Fai Cheung (張樹輝) On Mon, Oct 16, 2023 at 12:24 AM Duncan Murdoch wrote: > > On 15/10/2023 12:05 p.m., Shu Fai Cheung wrote: > > Let me

Re: [R] Plot to a device and examine the plot?

2023-10-15 Thread Paul Murrell
Hi You could also look at dev.capture(), depending on which screen device you are using. Paul On 16/10/23 05:24, Duncan Murdoch wrote: On 15/10/2023 12:05 p.m., Shu Fai Cheung wrote: > Let me clarify my question: > > plot.new() > polygon(c(.5, .5, .75, .8), c(.25, .3, .4, .5)) > > If t

Re: [R] Plot to a device and examine the plot?

2023-10-15 Thread Duncan Murdoch
On 15/10/2023 12:05 p.m., Shu Fai Cheung wrote: Let me clarify my question: plot.new() polygon(c(.5, .5, .75, .8), c(.25, .3, .4, .5)) If the device is an on-screen device, can I check whether a particular area has anything drawn on it, or, to be precise, whether the color of a particular area

Re: [R] Plot to a device and examine the plot?

2023-10-15 Thread Shu Fai Cheung
Let me clarify my question: plot.new() polygon(c(.5, .5, .75, .8), c(.25, .3, .4, .5)) If the device is an on-screen device, can I check whether a particular area has anything drawn on it, or, to be precise, whether the color of a particular area has all pixels equal to the background color. That

Re: [R] Plot to a device and examine the plot?

2023-10-15 Thread Shu Fai Cheung
Sorry that I did not make my question clear enough. If the device is file based (e.g., a PNG file), then I believe I can do that, by using functions that can inspect an image. This is the solution I originally wanted to try. However, it requires creating a file in the process. I would like to see

Re: [R] Plot to a device and examine the plot?

2023-10-15 Thread Jeff Newmiller via R-help
This question is not clear to me. What is it you hope to retrieve from the device? Note that the type of device in your example is system-dependent. The content in a png() would be different than the content in a win.graph() device. On October 15, 2023 8:04:00 AM PDT, Shu Fai Cheung wrote: >H

[R] Plot to a device and examine the plot?

2023-10-15 Thread Shu Fai Cheung
Hi All, I want to inspect the content of a plot generated by another function. For example: plot.new() polygon(c(.5, .5, .75, .8), c(.25, .3, .4, .5)) A polygon will be drawn. If I do not know what has been done to generate the plot, is it possible to query the content in the active device? Re

Re: [R] overlay shaded area in base r plot

2023-09-19 Thread Marc Girondot via R-help
Dear Ani, A solution using my CRAN package HelpersMG; note that yellow is a difficult color to manage correct overlay. It is easier to use red. mean1 <- c(122.194495954369, 118.955256282505, 115.540991140893, 113.116216840647,   111.24053267553, 109.827890459103, 108.523652505026, 107.03318302

Re: [R] overlay shaded area in base r plot

2023-09-19 Thread ani jaya
Thank you very much for the solution. Absolutely will try this to see which one produces better plot. On Tue, Sep 19, 2023, 18:17 Jan van der Laan wrote: > Shorter/simpler alternative for adding a alpha channel > > adjustcolor("lightblue", alpha = 0.5) > > > So I would use something like: > > >

Re: [R] overlay shaded area in base r plot

2023-09-19 Thread Jan van der Laan
Shorter/simpler alternative for adding a alpha channel adjustcolor("lightblue", alpha = 0.5) So I would use something like: # Open new plot; make sure limits are ok; but don't plot plot(0, 0, xlim=c(1,20), ylim = range(c(mean1+sd1, mean2+sd2, mean1-sd1, mean2-sd2)), type="n", las=1, xla

Re: [R] overlay shaded area in base r plot

2023-09-19 Thread ani jaya
Thank you very much for the help. Turn out I can use 'density' to differentiate the overlaid area. On Tue, Sep 19, 2023, 16:16 Ivan Krylov wrote: > В Tue, 19 Sep 2023 13:21:08 +0900 > ani jaya пишет: > > > > polygon(c(1:20,20:1),c(mean1[1:20]+sd1[1:20],mean1[20:1]),col="lightblue") > > > polygo

Re: [R] overlay shaded area in base r plot

2023-09-19 Thread Ivan Krylov
В Tue, 19 Sep 2023 13:21:08 +0900 ani jaya пишет: > polygon(c(1:20,20:1),c(mean1[1:20]+sd1[1:20],mean1[20:1]),col="lightblue") > polygon(c(1:20,20:1),c(mean1[1:20]-sd1[1:20],mean1[20:1]),col="lightblue") > polygon(c(1:20,20:1),c(mean2[1:20]+sd2[1:20],mean2[20:1]),col="lightyellow") > polygon(c(1:

[R] overlay shaded area in base r plot

2023-09-18 Thread ani jaya
),c(mean2[1:20]+sd2[1:20],mean2[20:1]),col="lightyellow") polygon(c(1:20,20:1),c(mean2[1:20]-sd2[1:20],mean2[20:1]),col="lightyellow") lines(mean1,lty=1,lwd=2,col="blue") lines(mean2,lty=1,lwd=2,col="yellow") what i want is like in this source, but using

Re: [R] plot level, velocity, acceleration with one x axis

2023-05-31 Thread Deepayan Sarkar
box(col='grey') > > axis(1) > > > > Best, > > Wolfgang > > > That's exactly what I needed. > > > Thanks, Spencer > > > > >> -Original Message- > >> From: R-help [mailto:r-help-boun...@r-project.org] On Behal

Re: [R] plot level, velocity, acceleration with one x axis

2023-05-31 Thread Spencer Graves
X.[, 3], ylab='accel (%)', axes=FALSE) axis(2) box(col='grey') axis(1) Best, Wolfgang That's exactly what I needed. Thanks, Spencer -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Spencer Graves Sent: Wednesday, 31 Ma

Re: [R] plot level, velocity, acceleration with one x axis

2023-05-31 Thread Viechtbauer, Wolfgang (NP)
box(col='grey') axis(1) Best, Wolfgang >-Original Message- >From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Spencer Graves >Sent: Wednesday, 31 May, 2023 17:45 >To: Eric Berger >Cc: r-help >Subject: Re: [R] plot level, velocity, acceleration wit

Re: [R] plot level, velocity, acceleration with one x axis

2023-05-31 Thread Spencer Graves
On 5/31/23 9:20 AM, Eric Berger wrote: I sent you an updated response to deal with the redundant copies of the x-axis. Re-sending. par(mfrow=c(3,1)) plot(DAX.[, 1], log='y', ylab='DAX', xaxt="n") plot(DAX.[, 2], ylab='vel (%)', xaxt="n") plot(DAX.[, 3], ylab='accel (%)') I got that. Th

Re: [R] plot level, velocity, acceleration with one x axis

2023-05-31 Thread Eric Berger
I sent you an updated response to deal with the redundant copies of the x-axis. Re-sending. par(mfrow=c(3,1)) plot(DAX.[, 1], log='y', ylab='DAX', xaxt="n") plot(DAX.[, 2], ylab='vel (%)', xaxt="n") plot(DAX.[, 3], ylab='accel (%)') On Wed, May 31, 2023 at 4:27 PM Spencer Graves wrote: > > > >

Re: [R] plot level, velocity, acceleration with one x axis

2023-05-31 Thread Spencer Graves
On 5/30/23 10:23 AM, Eric Berger wrote: What if you just precede these commands as follows: par(mfrow=c(3,1)) plot(DAX.[, 1], log='y', ylab='DAX') plot(DAX.[, 2], ylab='vel (%)') plot(DAX.[, 3], ylab='accel (%)') Most of the space is consumed with two extraneous copies of the axis. We

Re: [R] plot level, velocity, acceleration with one x axis

2023-05-31 Thread Eric Berger
Slight modification to have the xaxt ticks and labels only appear on the bottom chart par(mfrow=c(3,1)) plot(DAX.[, 1], log='y', ylab='DAX', xaxt="n") plot(DAX.[, 2], ylab='vel (%)', xaxt="n") plot(DAX.[, 3], ylab='accel (%)') On Tue, May 30, 2023 at 6:23 PM Eric Berger wrote: > > What if you j

Re: [R] plot level, velocity, acceleration with one x axis

2023-05-30 Thread Eric Berger
What if you just precede these commands as follows: par(mfrow=c(3,1)) plot(DAX.[, 1], log='y', ylab='DAX') plot(DAX.[, 2], ylab='vel (%)') plot(DAX.[, 3], ylab='accel (%)') On Tue, May 30, 2023 at 5:45 PM Spencer Graves wrote: > > > > On 5/30/23 8:48 AM, Eric Berger wrote: > > I am a bit confuse

Re: [R] plot level, velocity, acceleration with one x axis

2023-05-30 Thread Spencer Graves
On 5/30/23 8:48 AM, Eric Berger wrote: I am a bit confused as to what you are trying to achieve - and even if I could guess it is not clear what the interpretation would be. head(DAX) 1628.75 1613.63 1606.51 1621.04 1618.16 1610.61 Including the leading NA's, what would be the 6 leading te

Re: [R] plot level, velocity, acceleration with one x axis

2023-05-30 Thread Eric Berger
I am a bit confused as to what you are trying to achieve - and even if I could guess it is not clear what the interpretation would be. > head(DAX) 1628.75 1613.63 1606.51 1621.04 1618.16 1610.61 Including the leading NA's, what would be the 6 leading terms of the 3 series that you want to plot, a

Re: [R] plot level, velocity, acceleration with one x axis

2023-05-30 Thread Spencer Graves
On 5/30/23 6:16 AM, Eric Berger wrote: My code assumes that DAX is a ts object, as in your original post. On Tue, May 30, 2023 at 2:06 PM Eric Berger wrote: Untested but why not a <- cbind(log(DAX), exp(diff(log(DAX))), exp(diff(diff(log(DAX) colnames(a) <- c("logDAX", "vel", "accel")

Re: [R] plot level, velocity, acceleration with one x axis

2023-05-30 Thread Eric Berger
My code assumes that DAX is a ts object, as in your original post. On Tue, May 30, 2023 at 2:06 PM Eric Berger wrote: > > Untested but why not > > a <- cbind(log(DAX), exp(diff(log(DAX))), exp(diff(diff(log(DAX) > colnames(a) <- c("logDAX", "vel", "accel") > plot(a) > > > On Tue, May 30, 2023

Re: [R] plot level, velocity, acceleration with one x axis

2023-05-30 Thread Eric Berger
Untested but why not a <- cbind(log(DAX), exp(diff(log(DAX))), exp(diff(diff(log(DAX) colnames(a) <- c("logDAX", "vel", "accel") plot(a) On Tue, May 30, 2023 at 1:46 PM Spencer Graves wrote: > > > > On 5/29/23 2:37 AM, Eric Berger wrote: > > How about this: > > > > a <- cbind(AirPassengers,

Re: [R] plot level, velocity, acceleration with one x axis

2023-05-30 Thread Spencer Graves
On 5/29/23 2:37 AM, Eric Berger wrote: How about this: a <- cbind(AirPassengers, diff(log(AirPassengers)), diff(diff(log(AirPassengers colnames(a)[2:3] <- c("percent increase", "acceleration") plot(a, xlab="year", main="AirPassengers") My real problem is more difficult: I'm analyzi

Re: [R] plot level, velocity, acceleration with one x axis

2023-05-29 Thread Spencer Graves
On 5/29/23 2:37 AM, Eric Berger wrote: How about this: a <- cbind(AirPassengers, diff(log(AirPassengers)), diff(diff(log(AirPassengers colnames(a)[2:3] <- c("percent increase", "acceleration") plot(a, xlab="year", main="AirPassengers") That's it. Thanks. sg HTH, Eric On Mon, May

Re: [R] plot level, velocity, acceleration with one x axis

2023-05-29 Thread Eric Berger
How about this: a <- cbind(AirPassengers, diff(log(AirPassengers)), diff(diff(log(AirPassengers colnames(a)[2:3] <- c("percent increase", "acceleration") plot(a, xlab="year", main="AirPassengers") HTH, Eric On Mon, May 29, 2023 at 7:57 AM Spencer Graves wrote: > > Hello, All: > > >

[R] plot level, velocity, acceleration with one x axis

2023-05-28 Thread Spencer Graves
Hello, All: I want to plot level, velocity, and acceleration in three panels with only one x axis. The code below does this using "layout". However, I want the three plot areas to be of equal size, and this won't do that: If I stretch the plot vertically, the relative sizes of the three

Re: [R] Plot R graphs in aws

2023-04-23 Thread Hasan Diwan
Alternatively, you can put R-studio server on AWS by going to https://www.louisaslett.com/RStudio_AMI/. -- H On Thu, 20 Apr 2023 at 04:58, Duncan Murdoch wrote: > On 20/04/2023 7:43 a.m., Naresh Gurbuxani wrote: > > In my Amazon Web Services (AWS) account, I use R via emacs launched from > termi

Re: [R] Plot R graphs in aws

2023-04-20 Thread Duncan Murdoch
On 20/04/2023 7:43 a.m., Naresh Gurbuxani wrote: In my Amazon Web Services (AWS) account, I use R via emacs launched from terminal. While R computations work well, viewing graphs is inconvenient. I am not able to use screen device. I can send graphs to a png or pdf file, then open the file.

[R] Plot R graphs in aws

2023-04-20 Thread Naresh Gurbuxani
In my Amazon Web Services (AWS) account, I use R via emacs launched from terminal. While R computations work well, viewing graphs is inconvenient. I am not able to use screen device. I can send graphs to a png or pdf file, then open the file. I would like a setup where code is run in one wi

Re: [R] Plot a line using ggplot2

2022-12-08 Thread Ebert,Timothy Aaron
Of Sorkin, John Sent: Thursday, December 8, 2022 8:06 PM To: r-help@r-project.org (r-help@r-project.org) Subject: [R] Plot a line using ggplot2 [External Email] Colleagues, I am trying to plot a simple line using ggplot2. I get the axes, but I don't get the line. Please let me know what

Re: [R] Plot a line using ggplot2

2022-12-08 Thread Jeff Newmiller
Please run your code before you send it. Your example is not reproducible. library(ggplot2) linedata<- data.frame( PointEstx = c( 1, 2 ) , PointEsty = c( 1, 1.5 ) ) # make sure we have a data frame str(linedata) #plot the data ggplot( linedata , aes( x = PointEstx , y = PointEsty )

[R] Plot a line using ggplot2

2022-12-08 Thread Sorkin, John
Colleagues, I am trying to plot a simple line using ggplot2. I get the axes, but I don't get the line. Please let me know what my error I am making. Thank you, John # Define x and y values PointEstx <- Estx+1.96*SE PointEsty <- 1 row2 <- cbind(PointEstx,PointEsty) linedata<- data_frame(rbind(r

Re: [R] Plot by month

2022-02-27 Thread Jim Lemon
Try group_by() function > Try fill= or color= in the aes() statement in ggplot. > > What is the goal? > Do you want lines, bars, or dots? > > Is this a class? > > Tim > > -Original Message- > From: R-help On Behalf Of ektaraful > Sent: Saturday, February

Re: [R] How to rotate only one panel by 90 degrees in R plot?

2021-10-13 Thread Luigi Marongiu
Thank you! On Wed, Oct 13, 2021 at 12:00 PM Deepayan Sarkar wrote: > > On Wed, Oct 13, 2021 at 12:13 PM Luigi Marongiu > wrote: > > > > I have seen that the only package that easily rotate the plot is > > ggplot, so I ran: > > ``` > > library(ggplot2) > > df = data.frame(MR = c(negative_mr, unce

Re: [R] How to rotate only one panel by 90 degrees in R plot?

2021-10-13 Thread Deepayan Sarkar
On Wed, Oct 13, 2021 at 12:13 PM Luigi Marongiu wrote: > > I have seen that the only package that easily rotate the plot is > ggplot, so I ran: > ``` > library(ggplot2) > df = data.frame(MR = c(negative_mr, uncertain_mr, positive_mr), > FCN = c(negative_fcn, uncertain_fcn, positive_fcn)) > p <- gg

Re: [R] How to rotate only one panel by 90 degrees in R plot?

2021-10-12 Thread Luigi Marongiu
I have seen that the only package that easily rotate the plot is ggplot, so I ran: ``` library(ggplot2) df = data.frame(MR = c(negative_mr, uncertain_mr, positive_mr), FCN = c(negative_fcn, uncertain_fcn, positive_fcn)) p <- ggplot(df, aes(x=MR)) + geom_density() p + coord_flip() ``` Even in this c

Re: [R] How to rotate only one panel by 90 degrees in R plot?

2021-10-12 Thread Paul Murrell
Hi I don't think you need (or want) the 'gridGraphics' package for this. You just need to flip the x-/y-data that you get from density() (and make sure that you align the y-axes of the two plots). The following code shows an example (and adds a bit of par() control to eliminate white space).

Re: [R] How to rotate only one panel by 90 degrees in R plot?

2021-10-12 Thread Bert Gunter
I don't know the gridGraphics package, and I haven't looked closely at what you are trying to do. But note that lattice functions construct grid "grobs" that can be saved and plotted in arbitrary, including rotated, viewports, using the print.trellis function. I frankly am pretty ignorant about suc

[R] How to rotate only one panel by 90 degrees in R plot?

2021-10-12 Thread Luigi Marongiu
Hello, I would like to show a density plot of the Y axis. To do that, I would like to split the plot into a panel 2/3 long and a density plot 1/3 long. The problem is that, since the density is on the Y axis, the density plot should be rotated byb90 degrees. I tried with the package gridGraphics bu

Re: [R] Plot NUTS regions with color

2021-06-23 Thread Bert Gunter
I suggest you post this in the r-sig-geo list rather than here. The expertise you seek is more likely to be there. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

[R] Plot NUTS regions with color

2021-06-23 Thread Phillips Rogfield
Dear R-help ML, I have downloaded the NUTS shapefiles from here: https://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/administrative-units-statistical-units/nuts I can load them with the following code: library(rgdal) shp_bdir <- [PATH TO SHAPE FILE] layername <- "NUTS_RG_

[R] [R-pkgs] precisePlacement: new package for precisely placing elements onto a base R plot

2021-06-21 Thread Jasper Watson
Hello, I have just released to CRAN the precisePlacement package which provides a selection of tools that make it easier to place elements onto a (base R) plot exactly where you want them. It allows users to identify points and distances on a plot in terms of inches, pixels, margin lines, data

Re: [R] Plot GEE confindence interval band ggplot2

2021-06-01 Thread Rui Barradas
Hello, I don't know if the following is what you want but it gives confidence bars. The error in your code is to have Esp as id. dat$Id <- as.integer(factor(dat$Esp)) m5 <- geeglm( formula = tim ~ Pa*Pt, family = Gamma(link = log), data = dat, id = Id, corstr = "exchangeable" ) plo

[R] Plot GEE confindence interval band ggplot2

2021-05-31 Thread Luis Fernando García
Dear all, I want to plot a Generalized Estimating Equation (GEE) model, with interactions and the confidence interval using a similar style to ggplot2 . I have tried several packages but all of them produce errors. My idea I wanted to know if anyone knows a graphical package which works with GEE

Re: [R] Plot with some countries in red

2021-05-19 Thread PIKAL Petr
sday, May 19, 2021 3:14 PM To: r-help@r-project.org Subject: [R] Plot with some countries in red Dear R-experts, Here below a toy R code example. I would like some countries (not all of them) "Italy", "Canada", "Greece" and "Norway" to appear in red co

[R] Plot with some countries in red

2021-05-19 Thread varin sacha via R-help
Dear R-experts, Here below a toy R code example. I would like some countries (not all of them) "Italy", "Canada", "Greece" and "Norway" to appear in red color. The others remaining black. How can I do that without big changes in my R code ? Indeed, I would like my R code to remain like this as

Re: [R] Plot dataframe with color based on a column value

2021-01-24 Thread Luigi Marongiu
I did not know about matplot, but it did the work. using lines is my default procedure but it can be time-consuming. Thank you all. On Sun, Jan 24, 2021 at 6:45 PM Rui Barradas wrote: > > Hello, > > Base R: > > colrs <- rainbow(length(unique(ROI$Z))) > roi_wide <- reshape(ROI, v.names = "Y", time

Re: [R] Plot dataframe with color based on a column value

2021-01-24 Thread Rui Barradas
Hello, Base R: colrs <- rainbow(length(unique(ROI$Z))) roi_wide <- reshape(ROI, v.names = "Y", timevar = "Z", idvar = "X", direction = "wide") matplot(roi_wide, type = "l", lwd = 3, lty = "solid", col = colrs) Hope this helps, Rui Barradas Às 14:48 de 24/01/21, Luigi Marongiu escreveu: He

Re: [R] Plot dataframe with color based on a column value

2021-01-24 Thread Bert Gunter
No. I was wrong. ?plot.default says only one line color (the first) will be used. So it appears that you need to use lines(). Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic

Re: [R] Plot dataframe with color based on a column value

2021-01-24 Thread Bert Gunter
1. lines() *is* base R. 2. See the col argument of ?plot.default. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Sun, Jan 24, 2021 at 6:48 AM Luigi Marongiu

[R] Plot dataframe with color based on a column value

2021-01-24 Thread Luigi Marongiu
Hello is it possible to color the data of a dataframe according to the values of one column? I have a dataframe that OI have subdivided into X and Y, with a third Z with the sample number. I would like to plot Y~X but coloring using Z. But I would like to use base R and not lines. Is that possible?

Re: [R] Plot histogram and lognormal fit on the same time

2021-01-22 Thread Bert Gunter
OK, but that's not the point of my comment. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Fri, Jan 22, 2021 at 5:03 PM Abby Spurdle wrote: > Sorry, Bert. >

Re: [R] Plot histogram and lognormal fit on the same time

2021-01-22 Thread Abby Spurdle
Sorry, Bert. The fitdistr function estimates parameters via maximum likelihood. (i.e. The "lognormal" part of this, is not a kernel). On Fri, Jan 22, 2021 at 5:14 AM Bert Gunter wrote: > > In future, you should try to search before posting. I realize that getting > good search terms can sometime

Re: [R] Plot histogram and lognormal fit on the same time

2021-01-21 Thread Rui Barradas
Hello, A solution based on Marc's first one, maybe easier? (It doesn't rely on multiplying the dlnorm values by 400 since it plots the histogram with freq = FALSE.) set.seed(2020) data <- rlnorm(100, meanlog = 1, sdlog = 1) library(MASS) f <- fitdistr(data, "lognormal") f$estimate p <- pr

Re: [R] Plot histogram and lognormal fit on the same time

2021-01-21 Thread Bert Gunter
In future, you should try to search before posting. I realize that getting good search terms can sometimes be tricky, but not in this case: 'plot density with histogram in R' or similar on rseek.org or just on your usual search platform brought up several ways to do it. As a (slightly offtopic) si

Re: [R] Plot histogram and lognormal fit on the same time

2021-01-21 Thread Marc Girondot via R-help
Two solutions not exactly equivalent ; data <- rlnorm(100, meanlog = 1, sdlog = 1) histdata <- hist(data, ylim=c(0, 100)) library(MASS) f <- fitdistr(data, "lognormal") f$estimate lines(x=seq(from=0, to=50, by=0.1), � y=dlnorm(x=seq(from=0, to=50, by=0.1), meanlog = f$estimate["meanlog"], sdl

[R] Plot histogram and lognormal fit on the same time

2021-01-21 Thread Eric Leroy
Hi, I would like to plot the histogram of data and fit it with a lognormal distribution. The ideal, would be to superimpose the fit on the histogram and write the results of the fit on the figure. Right now, I was able to plot the histogram and fit the density with a lognormal, but I can't

Re: [R] plot factors with dots in R

2020-08-31 Thread Luigi Marongiu
Thank you, all solutions work! On Fri, Aug 28, 2020 at 9:02 AM Deepayan Sarkar wrote: > > On Thu, Aug 27, 2020 at 5:46 PM Luigi Marongiu > wrote: > > > > Hello, > > I have a dataframe as follows: > > ``` > > x = c("0 pmol", "10 pmol", "100 pmol", "1000 pmol") > > y = c(0.9306, 1.8906, 2.2396, 2

Re: [R] plot factors with dots in R

2020-08-28 Thread Deepayan Sarkar
On Thu, Aug 27, 2020 at 5:46 PM Luigi Marongiu wrote: > > Hello, > I have a dataframe as follows: > ``` > x = c("0 pmol", "10 pmol", "100 pmol", "1000 pmol") > y = c(0.9306, 1.8906, 2.2396, 2.7917) > df = data.frame(x, y) > > > str(df) > 'data.frame': 4 obs. of 2 variables: > $ x: chr "0 pmol"

Re: [R] plot factors with dots in R

2020-08-27 Thread Jim Lemon
Hi Luigi, Maybe just: plot(as.numeric(factor(x,levels=x)),y,xaxt="n", main="Concentration by effect", xlab="Concentration",ylab="Effect") axis(1,at=1:4,labels=x) Jim On Thu, Aug 27, 2020 at 10:16 PM Luigi Marongiu wrote: > > Hello, > I have a dataframe as follows: > ``` > x = c("0 pmol", "10

Re: [R] plot factors with dots in R

2020-08-27 Thread Rui Barradas
Hello, The plots that you say give bars (or my equivalent version below) don't give bars, what they give are boxplots with just one value and the median Q1 and Q3 are all equal. plot(y ~ factor(x), df, pch = 16) # boxplot Is the following what you are looking for? plot(y ~ as.integer(fac

Re: [R] plot factors with dots in R

2020-08-27 Thread Luigi Marongiu
f$y) > > gives you points. You need to set labels to x axis though. > > Cheers > Petr > > > -Original Message- > > From: R-help On Behalf Of Luigi Marongiu > > Sent: Thursday, August 27, 2020 2:16 PM > > To: r-help > > Subject: [R

Re: [R] plot factors with dots in R

2020-08-27 Thread PIKAL Petr
-help On Behalf Of Luigi Marongiu > Sent: Thursday, August 27, 2020 2:16 PM > To: r-help > Subject: [R] plot factors with dots in R > > Hello, > I have a dataframe as follows: > ``` > x = c("0 pmol", "10 pmol", "100 pmol", "1000 pmol") &

[R] plot factors with dots in R

2020-08-27 Thread Luigi Marongiu
Hello, I have a dataframe as follows: ``` x = c("0 pmol", "10 pmol", "100 pmol", "1000 pmol") y = c(0.9306, 1.8906, 2.2396, 2.7917) df = data.frame(x, y) > str(df) 'data.frame': 4 obs. of 2 variables: $ x: chr "0 pmol" "10 pmol" "100 pmol" "1000 pmol" $ y: num 0.931 1.891 2.24 2.792 ``` I wou

Re: [R] Plot math symbol with string and number

2020-08-18 Thread Rasmus Liland
On 2020-08-18 11:02 +1200, Paul Murrell wrote: | On 18/08/20 9:54 am, Bert Gunter wrote: | | On Mon, Aug 17, 2020 at 2:14 PM wrote: | | | | | | Plotmath seems to be the right way | | | to do it. But without reading | | | plotmath I'd have gone with this: | | | | | | plot(y, main=paste("data",

Re: [R] Plot math symbol with string and number

2020-08-17 Thread Paul Murrell
I think that comment is fair *on graphics devices that can handle unicode*. So that is true for Cairo-based graphics devices, but not for the pdf() or postscript() devices, for example. Paul On 18/08/20 9:54 am, Bert Gunter wrote: "Plotmath seems to be the right way to do it." Not sure I

Re: [R] Plot math symbol with string and number

2020-08-17 Thread Bert Gunter
"Plotmath seems to be the right way to do it. " Not sure I agree with that. Paul Murrell put together plotmath around 2000 prior to the widescale development and adoption of the unicode standard (corrections/modifications welcome!). So at the time, there really was no other way to handle this for

Re: [R] Plot math symbol with string and number

2020-08-17 Thread Rasmus Liland
On 2020-08-17 22:14 +0100, cpolw...@chemo.org.uk wrote: | On 2020-08-17 03:13, Rasmus Liland wrote: | | On Sun, Aug 16, 2020 at 3:18 PM Bert wrote: | | | | | | ?plotmath | | | | Dear John, read ?plotmath, it is | | good, I was not aware of its | | existence; then backquote s like | | so: | | P

Re: [R] Plot math symbol with string and number

2020-08-17 Thread cpolwart
On 2020-08-17 03:13, Rasmus Liland wrote: On Sun, Aug 16, 2020 at 3:18 PM Bert wrote: | On Sun, Aug 16, 2020, 14:53 John wrote: | | | | I would like to make plots with | | titles for different data sets and | | different parameters. The first | | title doesn't show sigma as a math | | symbol, whi

Re: [R] Plot math symbol with string and number

2020-08-17 Thread John Smith
Thanks to Dunkan, Rasmus and Bert. Will keep the very useful tips. Best! On Sun, Aug 16, 2020 at 9:13 PM Rasmus Liland wrote: > On Sun, Aug 16, 2020 at 3:18 PM Bert wrote: > | On Sun, Aug 16, 2020, 14:53 John wrote: > | | > | | I would like to make plots with > | | titles for different data sets

Re: [R] Plot math symbol with string and number

2020-08-16 Thread Rasmus Liland
On Sun, Aug 16, 2020 at 3:18 PM Bert wrote: | On Sun, Aug 16, 2020, 14:53 John wrote: | | | | I would like to make plots with | | titles for different data sets and | | different parameters. The first | | title doesn't show sigma as a math | | symbol, while the second one | | doesn't contain

Re: [R] Plot math symbol with string and number

2020-08-16 Thread Bert Gunter
Specifically, see the "how to combine "math" and numeric variables" in the Examples therein. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Sun, Aug 16, 2020 a

Re: [R] Plot math symbol with string and number

2020-08-16 Thread Bert Gunter
?plotmath On Sun, Aug 16, 2020, 14:53 John Smith wrote: > Dear Helpers, > > I would like to make plots with titles for different data sets and > different parameters. So a useful title should combine data name > and parameter for clarity. The following is a simplified code example with > two plo

[R] Plot math symbol with string and number

2020-08-16 Thread John Smith
Dear Helpers, I would like to make plots with titles for different data sets and different parameters. So a useful title should combine data name and parameter for clarity. The following is a simplified code example with two plots. The first title doesn't show sigma as a math symbol, while the sec

Re: [R] Plot base 100

2020-07-20 Thread Joshua Ulrich
You can do this with PerformanceAnalytics. library(PerformanceAnalytics) data(edhec) chart.RelativePerformance(edhec, 0, legend = "topleft") Also note that there's a finance-specific mailing list: R-SIG-Finance. Best, Josh On Sun, Jul 19, 2020 at 1:46 PM Pedro páramo wrote: > > Hi all, > > I a

Re: [R] Plot base 100

2020-07-20 Thread Pedro páramo
I understand. I Will send my Code tomorrow, I am outside home now. Many thanks David, sorry about all. El dom., 19 jul. 2020 21:13, David Winsemius escribió: > > On 7/19/20 11:18 AM, Pedro páramo wrote: > > Hi all, > > > > I am trying to make a plot based on stock market prices and the library

Re: [R] Plot base 100

2020-07-19 Thread Jim Lemon
Hi Pedro, Assuming that you get a vector of daily percentage changes: dpc<-c(+3.1, -2.8, +1.7, +2.1) get the cumulative change and add 100: cumsum(dpc)+100 [1] 103.1 100.3 102.0 104.1 You can then plot that. As Rui noted, your mail client is inserting invisible characters that prevent cutting a

Re: [R] Plot base 100

2020-07-19 Thread David Winsemius
On 7/19/20 11:18 AM, Pedro páramo wrote: Hi all, I am trying to make a plot based on stock market prices and the library quantmod, imagine BatchGetSymbols(‘^IBEX’, first.date = ‘1999-12-31’, last.date = ‘2020-12-07’) The thing is I want to plot a plot that for each year on 31/12/year tthe

[R] Plot base 100

2020-07-19 Thread Pedro páramo
Hi all, I am trying to make a plot based on stock market prices and the library quantmod, imagine BatchGetSymbols(‘^IBEX’, first.date = ‘1999-12-31’, last.date = ‘2020-12-07’) The thing is I want to plot a plot that for each year on 31/12/year tthe base is 100 and each day calvulate the cumulat

Re: [R] plot shows exponential values incompatible with data

2020-07-10 Thread Fox, John
Dear Jim, As I pointed out yesterday, setting ylim as you suggest still results in "0e+00" as the smallest tick mark, as it should for evenly spaced ticks. Best, John > On Jul 10, 2020, at 12:13 AM, Jim Lemon wrote: > > Hi Luigi, > This is a result of the "pretty" function that calculates h

Re: [R] plot shows exponential values incompatible with data

2020-07-10 Thread Luigi Marongiu
Thank you! I reckon the main problem is the large data range, anyway. I should stick with logarithmic scales... Best regards Luigi On Fri, Jul 10, 2020 at 6:14 AM Jim Lemon wrote: > > Hi Luigi, > This is a result of the "pretty" function that calculates hopefully > good looking axis ticks automat

Re: [R] plot shows exponential values incompatible with data

2020-07-09 Thread Jim Lemon
Hi Luigi, This is a result of the "pretty" function that calculates hopefully good looking axis ticks automatically. You can always specify ylim=c(1.0E09,max(Y)) if you want. Jim On Thu, Jul 9, 2020 at 10:59 PM Luigi Marongiu wrote: > > Hello, > I have these vectors: > ``` > X <- 1:7 > Y <- c(14

Re: [R] plot shows exponential values incompatible with data

2020-07-09 Thread Fox, John
Dear Bernard, > On Jul 9, 2020, at 10:25 AM, Bernard Comcast > wrote: > > Use the xlim option in the plot function? I think you mean ylim, but as you'll find out when you try it, you still (reasonably) get an evenly spaced tick mark at 0: plot(Y ~ X, ylim=c(1e9, 6e11)) The "right" thing to

Re: [R] plot shows exponential values incompatible with data

2020-07-09 Thread Rui Barradas
Hello, Like this? plot(Y~X, log="y") Hope this helps, Rui Barradas Às 14:59 de 09/07/20, Luigi Marongiu escreveu: Thank you, but why it does not work in linear? With the log scale, I know it works but I am not looking for it; is there a way to force a linear scale? Regards Luigi On Thu, J

Re: [R] plot shows exponential values incompatible with data

2020-07-09 Thread Bernard Comcast
Use the xlim option in the plot function? Bernard Sent from my iPhone so please excuse the spelling!" > On Jul 9, 2020, at 10:06 AM, Luigi Marongiu wrote: > > Thank you, > but why it does not work in linear? With the log scale, I know it > works but I am not looking for it; is there a way to f

Re: [R] plot shows exponential values incompatible with data

2020-07-09 Thread Bert Gunter
Please consult ?axis and follow its links (e.g. "axTicks" and "pretty") for the details of the algorithm used to construct axis annotation. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom

Re: [R] plot shows exponential values incompatible with data

2020-07-09 Thread Fox, John
Dear Luigi, > On Jul 9, 2020, at 9:59 AM, Luigi Marongiu wrote: > > Thank you, > but why it does not work in linear? With the log scale, I know it > works but I am not looking for it; is there a way to force a linear > scale? The scale *is* linear and the choice of tick marks, which are evenly

Re: [R] plot shows exponential values incompatible with data

2020-07-09 Thread Luigi Marongiu
Thank you, but why it does not work in linear? With the log scale, I know it works but I am not looking for it; is there a way to force a linear scale? Regards Luigi On Thu, Jul 9, 2020 at 3:44 PM Fox, John wrote: > > Dear Luigi, > > > On Jul 9, 2020, at 8:59 AM, Luigi Marongiu wrote: > > > > He

  1   2   3   4   5   6   7   8   9   10   >