Skip to content

easy graphic question

13 messages · Myriam Abramson, David Scott, Antonio Olinto +9 more

#
Hi!

How do I specify a filled point in a scatterplot? Their size? 

plot(x,y) just gives "empty" points like "o". I want a full black
point. 

TIA
#
On 23 Oct 2001, Myriam Abramson wrote:

            
To see the symbols available, try:

plot(1:30,pch=1:30)

Symbol size is controlled by the parameter cex, so try

plot(1:30,pch=1:30,cex=2)

for example and you will undoubtedly see how it works.

David Scott
_________________________________________________________________
David Scott     Department of Statistics
                Tamaki Campus
                The University of Auckland, PB 92019
                Auckland        NEW ZEALAND
Phone: +64 9 373 7599 ext 6830     Fax: +64 9 373 7000
Email:  d.scott at Auckland.ac.nz

President, New Zealand Statistical Association

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Hi Myrian,

I suggest you to read the document UsingR item 3.3.1 on "Size, colour and
choice of plotting symbol" (see pages 24 and 25).

Also try "?par" at the command line and check for pch and cex.

David's examples are very nice too.

Best whishes,

Antonio Olinto
.
----- Original Message -----
From: "Myriam Abramson" <mabramso at gmu.edu>
To: <r-help at stat.math.ethz.ch>
Sent: Wednesday, October 24, 2001 1:04 AM
Subject: [R] easy graphic question
-.-.-
http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Are there any good books/tutorials that explain how to best make use of
the object programming tools in R?  Alternatively, can someone suggest a
good oop book that describes (and gives examples) of oop with large
volumes of scientific/statistical data.

Cheers,
Randall

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Hi,
Is there a way to superimpose plots? This is a followup of the question on
putting 95% confidence interval in a ecdf. M. Maechler and k. halvorsen
ecdf.ksCl works like a charm by he way, thanks.

I have yet to find a way to get more than one ecdf in the same plot, or any
other data plotting for that matter.

	thanks,

	Christian

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
par(new=TRUE)

 (make sure to set axes=FALSE, xlab="",ylab="" unless you
really want these things plotted on top of your old graph)

or possibly
  lines() or points()
On Thu, 25 Oct 2001, Christian Blouin wrote:

            

  
    
#
On Thu, 25 Oct 2001, Christian Blouin wrote:

            
do-some-plotting-but-set-xlim()-ylim()
par(new=T)
do-some-more-plotting-with-same-xlim()-ylim()

is one way to do it
***********************************************************************
Jens Nieschulze

Institute for Forest Biometrics &	Phone: ++49-551-39-12107
Applied Computer Science		Fax  : ++49-551-39-3465
Buesgenweg 4
37077 Goettingen		E-mail: jniesch at uni-forst.gwdg.de
GERMANY				http://www.uni-forst.gwdg.de/~jniesch

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Christian Blouin <cblouin at is2.dal.ca> writes:
Try:

        par(new = TRUE)

Before the 2nd plot.

Mark


--
Mark Myatt


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Hi,

how are you plotting?  Have you tried e.g.
this should draw the function y2 on the same graph where you plotted y1

Ott Toomet
On Thu, 25 Oct 2001, Christian Blouin wrote:

            
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
"Christian Blouin" <cblouin at is2.dal.ca> writes:
In addition to all the other ideas that have been brought up, you
might want to check whether the plotting function accepts add=TRUE for
adding to an existing plot. 

plot.stepfun() does.
#
Two quick questions.

First, why doesn't using the matrix function actually set the class of the
resulting object to "matrix"?
$dim
 [1] 10 10

or should I be using?
$dim
[1] 10 10

$class
[1] "matrix"

Second, can somone please send me an example showing how inheritance works
in R?  The R Language Definition document isn't particularly clear on the
subject... i.e. NextMethod lacks a good example.

Cheers,
Randall

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Dear Randall,
At 05:27 PM 10/25/2001 +0100, you wrote:
In R, not all objects have a class attribute, and hence not all objects 
belong to a class. In particular, matrices do not (necessarily) belong to a 
class. A matrix in R is a vector with a length-2 dim attribute.

Perhaps it would be more responsive to ask why you require that the matrix 
a belong to the class 'matrix'?

By the way, there is a Matrix library that creates matrices of class 'Matrix'.
From R help:

An R ``object'' is a data object which has a class attribute. A class 
attribute is a character vector giving the names of the classes which the 
object ``inherits'' from. When a generic function fun is applied to an 
object with class attribute c("first", "second"), the system searches for a 
function called fun.first and, if it finds it, applied it to the object. If 
no such function is found a function called fun.second is tried. If no 
class name produces a suitable function, the function fun.default is used.

(I realize that this isn't usually what's meant by "object-oriented 
programming" or "inheritance.")

Thus, for example:

 > M <- matrix(1:12, 3, 4)
 > class(M) <- c('a', 'b')
 >
 > print.a <- function (x, ...) {
+     print.matrix(x)
+     NextMethod()
+     }
 >
 > print.b <- function(x, ...) print(as.vector(x))
 >
 > M
      [,1] [,2] [,3] [,4]
[1,]    1    4    7   10
[2,]    2    5    8   11
[3,]    3    6    9   12
  [1]  1  2  3  4  5  6  7  8  9 10 11 12
 >

I hope that this helps,
  John




-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox at mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
-----------------------------------------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
try 

plot(1:20, 1:20, pch=1:20)

for a selection of plotting symbols

Kjetil Halvorsen
Myriam Abramson wrote:
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._