[R] plot question
Eric Thompson
ericthompso at gmail.com
Tue Oct 2 20:46:13 CEST 2007
Okay. If you want to customize the axis labels, you can suppress the
defaults by changing the matplot call to
matplot(x, t(n), pch = 1, axes = FALSE)
And then adding them how you want:
axis(side = 2)
axis(side = 3, at = x, lab = colnames(n))
box()
On 10/2/07, Tiandao Li <Tiandao.Li at usm.edu> wrote:
> Thanks for your quick reply, Eric.
>
> I want plot colnames(n) as string on x-axis. If the regression lines don't
> fit the data very well, it is OK, the plot is only for quality check.
>
>
> On Tue, 2 Oct 2007, Eric Thompson wrote:
>
> If I've correctly interpreted what you want, you first need to get the x values:
>
> x <- colnames(n)
> x <- as.numeric(substr(x, 1, nchar(x) - 1))
>
> Then it seems fairly easy to use matplot to get the values with
> different colors for each concentration
>
> dim(x) <- c(length(x), 1)
> matplot(x, t(n), pch = 1)
>
> But this does not look like a simple line will fit the data for each
> gene well, so perhaps I've misunderstood something. You will have to
> decide how you want to do the regression. It will also get very messy
> and difficult to read with 20 lines (a different regression for each
> gene). To do the regressions, plot the lines, and label with the gene
> ID, see
>
> ?lm
> ?predict
> ?abline
> ?text
>
>
>
>
> On 10/2/07, Tiandao Li <Tiandao.Li at usm.edu> wrote:
> > Hello,
> >
> > I have a question about how to plot a series of data. The folloqing is my
> > data matrix of n
> > > n
> > 25p 5p 2.5p 0.5p
> > 16B-E06.g 45379 4383 5123 45
> > 16B-E06.g 45138 4028 6249 52
> > 16B-E06.g 48457 4267 5470 54
> > 16B-E06.g 47740 4676 6769 48
> > 37B-B02.g 42860 6152 19276 72
> > 35B-A02.g 48325 12863 38274 143
> > 35B-A02.g 48410 12806 39013 175
> > 35B-A02.g 48417 9057 40923 176
> > 35B-A02.g 51403 13865 43338 161
> > 45B-C12.g 50939 3656 5783 43
> > 45B-C12.g 52356 5524 6041 55
> > 45B-C12.g 49338 5141 5266 41
> > 45B-C12.g 51567 3915 5677 43
> > 35A-G04.g 40365 5513 6971 32
> > 35B-D01.g 54217 12607 13067 93
> > 35B-D01.g 55283 11441 14964 101
> > 35B-D01.g 55041 9626 14928 94
> > 35B-D01.g 54058 9465 14912 88
> > 35B-A04.g 42745 12080 34271 105
> > 35B-A04.g 41055 12423 34874 126
> >
> > colnames(n) is concentrations, rownames(n) is gene IDs, and the rest is
> > Intensity. I want to plot the data this way.
> > x-axis is colnames(n) in the order of 0.5p, 2.5p,5p,and 25p.
> > y-axis is Intensity
> > Inside of plot is the points of intensity over 4 concentrations, points
> > from different genes have different color or shape. A regression line of
> > each genes crosss different concetrations, and at the end of line is gene
> > IDs.
> >
> > Thanks,
> >
> > Tiandao
> >
> > ______________________________________________
> > 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.
> >
>
> ______________________________________________
> 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.
>
More information about the R-help
mailing list