Skip to content

symbol in the plot

12 messages · gcheer3, Johannes Graumann, David Winsemius +1 more

#
a graph question. Thanks a lot in advance.

I made two scatterplots on one graph (sigma vs. delta1, sigma vs. delta2)
(20 observations of delta1, delta2 and corresponding sigma) the x-axis is
sigma, the y-axis is either delta1 or delta2. I connected both scatterplots.
To seperate them, one curves is a line with circles, the other curve is a
line with squares on it. 

I want to make a notation either on the y-axis or on the graph. The notiaion
is "delta1--square; delta2--circle". So when people look at the graph, they
can easily tell each curve's meaning. The curve with squares on it means the
sigma vs. delta1, and the curve with circles on it means sigma vs. delta2. I
think I can use 'expression' to write delta1, delta2 and sigma in greek
letters, but I am not sure how to denote the square and cirle I graphed.
#
TO be specific, here is how I graphed

plot(sigma, delta1, ylim=range(-0.5, 2), xlab='sigma', ylab='delta1--square 
delta2--circle', pch=22, type='o')
par(new=TRUE)
plot(sigma, delta2, ylim=range(-0.5, 2), xlab='sigma', ylab='delta1--square 
delta2--circle', col='red', axes=FALSE, type='o')

Thanks a lot
gcheer3 wrote:

  
    
#
How about

plot(sigma, delta1, ylim=range(-0.5, 2), xlab='sigma', ylab='delta', pch=22, 
type='o')
points(sigma, delta2, col='red', axes=FALSE, type='o')
legend("topleft",c("Delta1","Delta2"),fill=TRUE,col=c("black","red"))

Send runnable example next time.

HTH, Joh
gcheer3 wrote:

            
#
Thanks for your reply.  It is very helpful. I am sorry I didn't make my
queston clearer. 
I have two concerns about this graph.
One thing is denote 'sigma' and 'delta' as greek letters, usually I use
'expression'. But I don't know how to use 'expression' in the 'legend'
The other thing is, the graph will also be print out with black and white. I
try to use circle and squre to seperate 'delta1's curve and 'delta2's curve.
So even someone read the black and white handout, they can tell which graph
is which.  It will be nice if there is a notation on the graph, next to a
square symble, it says 'delta 1', next to a circle symble, it says'delta 2'. 
I wrote it on the label with phrases, looks not professional. 

Thank you for any suggestons.

my runable code is as follows:

sigma=c( 0.00625, 0.06250, 0.12500, 0.18750, 0.25000, 0.31250, 0.37500,
0.43750, 0.50000,
0.56250)
delta1=c(0.90768, 0.90489, 0.901788,0.898681, 0.8955, 0.89557,
0.892474,0.88936, 0.886262, 0.179959)
delta2=c(0.90830, 0.9110998, 0.914203, 0.917308, 0.920412, 0.923517,
0.926623, 1.71524, 1.7153, 1.7154)

plot(sigma, delta1, ylim=range(-0.5, 2), xlab='sigma', ylab='delta1--square 
delta2--circle', pch=22, type='o') 
par(new=TRUE) 
plot(sigma, delta2, ylim=range(-0.5, 2), xlab='sigma', ylab='delta1--square 
delta2--circle', col='red', axes=FALSE, type='o')
#
Joh, thank you very much. sorry for confusing you. I didn't make my question
clear.  I tried your code it looks much better than my original one. Just I
prefer I can write the greek letter delta1 and delta 2 instead of words
'delta1' and 'delta2'. Also, it will be nice if there is a square symbol
next to delta1 and a circle symbol next to delta 2, since sometimes I have
to print the graph in a white and black paper. Thanks for any suggestions.
Sorry for not asking question clearly.
Johannes Graumann-2 wrote:

  
    
#
On Nov 20, 2009, at 10:23 AM, gcheer3 wrote:

            
legend("topleft",legend=expression(Delta~1, Delta~2),  
col=c("black","red"), pch=c(22,1) )

(I think I got the order of hte red and circle correct. You should  
check.)
#
Thank you again, Joh

Based on your code seems I solved the problem.
new code as follows:
cs<-expression(delta[1], delta[2])
plot(sigma, delta1, ylim=range(-0.5, 2), xlab='sigma', ylab='delta', pch=22, 
type='o') 
points(sigma, delta2, col='red', axes=FALSE, type='o') 
legend("topleft", cs,    pch = c(21, 22), lty=1, col=2:1)

only concern is there is a waring message in R: Warning message:
In plot.xy(xy.coords(x, y), type = type, ...) :
  "axes" is not a graphical parameter
gcheer3 wrote:

  
    
#
Thank you, David. 
thanks for letting me know how to use expression in legend. It works too.
gcheer3 wrote:

  
    
#
plot(sigma, delta1, ylim=range(-0.5, 2), xlab='sigma', ylab='delta',pch=22, 
type='o')
points(sigma, delta2, col='red', axes=FALSE, pch=1,type='o')
legend("topleft",c(expression(Delta*1),expression(delta*2)),fill=TRUE,col=c("black","red"),pch=c(1,22))

See:
Still, gimme a easily runnable example next time.

HTH, Joh
gcheer3 wrote:

            
#
On Nov 20, 2009, at 10:52 AM, gcheer3 wrote:

            
You should not be specifying axis types or flags to a function,  
[ points() in this case] that is not intended to do anything with the  
axes. To be Biblical: If thine warning offend thee, pluck it[the  
argument] out.
#
Dear All,

One more nlmeODE question:

I have a differential equation where one of the parameters depends on 
time. Values of this parameter at fixed time points are known but need 
to be interpolated between these known points. Can it be implemented in 
nlmeODE solver?

Thanks
Leonid

--------------------------------------
Leonid Gibiansky, Ph.D.
President, QuantPharm LLC
web:    www.quantpharm.com
e-mail: LGibiansky at quantpharm.com
tel:    (301) 767 5566
David Winsemius wrote:
#
Please, ignore this question (see below): I found the way how to do it

Thanks
Leonid
--------------------------------------
Leonid Gibiansky, Ph.D.
President, QuantPharm LLC
web:    www.quantpharm.com
e-mail: LGibiansky at quantpharm.com
tel:    (301) 767 5566
Leonid Gibiansky wrote: