Re: [R] creating axis of the plot before data are plotted

From: Zroutik Zroutik <zroutik_at_gmail.com>
Date: Tue, 15 Jul 2008 00:04:22 +0200

Nope, this assigns the 26th, 28th, 30th anf 32nd point of the total nrow(matrix) number of points. This does not assign the points (or places of the x-axis) with such a rowname.

row number <-> row name
1:nrow(matrix) <-> rowname(matrix[1]) .. rowname(matrix[nrow(matrix)])

I try to rephrase my question: how do you plot a curve into a plot when the x-axis isn't the rownumbers, but each row is a real x-value (e.g. 35.23)?

p.s. there is a mistake in my original (first) email. Instead "at=NULL" should be "at=Labels" (otherwise there is an error message). Sorry for confusion.

On Mon, Jul 14, 2008 at 5:53 PM, stephen sefick <ssefick_at_gmail.com> wrote:

> try at=seq(from=26, to=32, by=2) in the axis statment
> hope this helps
>
> Stephen
>
> On Mon, Jul 14, 2008 at 11:21 AM, Zroutik Zroutik <zroutik_at_gmail.com>
> wrote:
>
>> Dear R-users,
>>
>> I'm tackling with a problem which causing me a head-ache for a long time.
>> I
>> would like to create a nice x-axis to my plots, but I do not know how to
>> implement the method.
>>
>> Imagine a matrix where you have rownames real numbers -- these rownames
>> should be written in the x-axis nicely. I could not find any way how.
>>
>> I'll describe what I'm doing now:
>> I have a matrix where each column is an independent curve (number of the
>> columns 3-4). The rownames are the x-axis, and the names are real numbers
>> (converted to chars, of course). I find the max and the min among the
>> values
>> in the matrix (for the y-axis) and I'm creating an empty plot. x-axis is
>> c(0, nrow(matrix)). Now, I'm creating the x-axis labels
>>
>> Labels <- seq(1, nrow(matrix), by = 100)
>> axis(1, at = NULL, labels = rownames(matrix)[Labels])
>>
>> At this point I'd like to have instead of "24.12333 26.45667 28.79
>> 31.12333 33.45667" at the x-axis, an optimally placed ticks at let's
>> say
>> "26 28 30 32" -- this is what I cannot achieve.
>>
>> Afterwards I'm plotting the curves in different colours. I know that the
>> x-values are accessed by the number of their row and not rowname.
>>
>> Anybody could point me into some direction, please? Thank you upfront!
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> 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.
>>
>
>
>
> --
> Let's not spend our time and resources thinking about things that are so
> little or so large that all they really do for us is puff us up and make us
> feel like gods. We are mammals, and have not exhausted the annoying little
> problems of being mammals.
>
> -K. Mullis

        [[alternative HTML version deleted]]



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. Received on Mon 14 Jul 2008 - 22:07:19 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 14 Jul 2008 - 23:31:41 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive