[R] Labels for matplot x axis

From: Nick Torenvliet <nick.torenvliet_at_gmail.com>
Date: Tue, 22 Jun 2010 06:05:13 -0400


Hi all, I've been messing with this for a while now..

myStudy is a matrix of word frequency to date of document/document.

As you can see I'm trying to plot the series in the matrix.

I'd like three things --
1- In the plot that gets created the first series is a solid line, the rest
are dashed... how do I make them either one or the other. 2- The legend that comes up has filled boxes with colour as legend keys,  I'd like to show coloured lines for legend keys instead. 3- The x axis of the plot come up labelled 0-80 with major intervals of twenty, I'd like to see (@45 degrees) the axis labelled with the rownames of myStudy, and I'd like to be able to control the interval at which these major ticks are displayed.

I messed around for an hour or two, and was able to get the rownames on the x axis using the last command. I tried using at w/ seq w/ %% but I can't get the major tick intervals.

> myStudy

          Terms
Docs       china greec greece greek
  20100302    56    91      0    58
  20100303    62    94      0   101
  20100304    20   125      0    85
  20100305    98    77      0    50
  20100306    31    12      0     9
  20100308   125    50      0    32
.
.

.
.
  20100615    75    29      0    13
  20100616    84    21      0     8
  20100617    36    10      0    10
  20100618    60     8      0     7
  20100620   113     4      0     3
  20100621   741     7      5     1

> matplot(myStudy,type="l", main = "Word Study",xlab="WSJ Print
Date",ylab="Word Frequency",col=c("blue","red","green"))
> legend(10,600,colnames(myStudy),fill=c("blue","red","green"))
>axis(1,at=1:95,labels=rownames(myStudy),las=1)

Thanks for your time!!

Nick

        [[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 Tue 22 Jun 2010 - 10:18:37 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 Tue 22 Jun 2010 - 11:50:34 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