[R] A polar.plot BUG in plotrix 1.3.3 ?

2005-06-22 Thread Halldor Björnsson
Hi,

I just updated to R-2.1.1 and updated packages acordingly

However, after the update, routines that use polar.plot
did not function as correctly.

In plotrix 1.3.3 the polar.plot function does scale label.pos
to radians prior to calling radial.plot

Hence, the command
polar.plot(c(5,10,5,0),c(-10,0,10,20),rp.type='P',
 labels=c(A,N,V,S),label.pos=c(0,90,180,270))

produces absurd compass lines but the correct results are obtained if 
label.pos is scaled with pi/180 :

polar.plot(c(5,10,5,0),c(-10,0,10,20),rp.type='P',
 labels=c(A,N,V,S),label.pos=c(0,90,180,270)*pi/180)

I have attatched the polar.plot function from the two different versions 
of the package.

It seems that if not missing  then label.pos is not changed at all in 
version 1.3.3

So, a feature or a bug?

Sincerely,
-- 
--
Halldor Bjornsson   ([EMAIL PROTECTED])
Vedurstofa Islands (Icelandic Met. Office)
Bustadavegur 9, IS-150, Reykjavik, Iceland
--

In version 1.3.3

polar.plot-function(lengths,polar.pos,labels,label.pos,rp.type=r,...) {
  npos-length(lengths)
  # if no positions are given, add the average distance between 
positions so that
  # the first and last line don't overlap
  if(missing(polar.pos)) radial.pos-seq(0,(2-2/(npos+1))*pi,length=npos)
  else radial.pos-pi*polar.pos/180
  if(missing(labels)) {
   labels-as.character(seq(0,340,by=20))
   label.pos-seq(0,1.9*pi,length=18)
  }
  if(missing(label.pos)) label.pos-pi*label.pos/180
  radial.plot(lengths,radial.pos,range(radial.pos),labels,label.pos,
   rp.type=rp.type,...)
}



In version 1.2

polar.plot-function(lengths,polar.pos,labels,label.pos,rp.type=r,...) {
  npos-length(lengths)
  # if no positions are given, add the average distance between 
positions so that
  # the first and last line don't overlap
  if(missing(polar.pos)) polar.pos-seq(0,360-360/(npos+1),length=npos)
  if(missing(labels)) {
   label.pos-seq(0,340,by=20)
   labels-as.character(label.pos)
   label.range-c(0,pi*340/180)
  }
  if(missing(label.pos)) label.pos-polar.pos
  polar.range-range(polar.pos)
  newrange-c(pi*polar.range[1]/180,pi*(2-(360-polar.range[2])/180))
  # rescale to radians
  radial.pos-rescale(c(polar.pos,polar.range),newrange)[1:npos]
  nlabels-length(labels)
  label.pos-rescale(c(label.pos,0,360),c(0,2*pi))[1:nlabels]

radial.plot(lengths,radial.pos,newrange,labels,label.pos,rp.type=rp.type,...)
}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Windows plots fontsize

2005-01-21 Thread Halldor Björnsson
I recently wrote a package that runs on both Linux and Windows.
The functions fetch data to an SQL database and make diverse plots, 
usually with many labels and annotations.

I recently noticed that on SOME windows computers the fonts
in the plots were too large, which caused labels to overlap.
On other windows computers this does not happen.
However on both computers the command par(ps) gives 12
Now, windows is not my forte, but it seems likely that this has to do 
with some user/system settings. If so, my users would probably object to 
me tweaking their windows setup since it might have an effect on other 
programs.

One simple solution is to use par(ps=10), but I cannot find out how to
set this globally.
a) Does anyone know how I can set par(ps=10) by default on all figure?
b) Is there a windows specific way to set default fontsizes in figures?
Thanks,
Halldór
--
--
Halldor Bjornsson   ([EMAIL PROTECTED])
Vedurstofa Islands (Icelandic Met. Office)
Bustadavegur 9, IS-150, Reykjavik, Iceland
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] make R package for windows on Linux

2005-01-05 Thread Halldor Björnsson
Hi,
I made a package on a linux box. All worked fine.
The package contains only R code (no C). I then wanted to make a zip 
file so that I could test the package on a windows machine. I have tried 
all the obvious ways to do this (and even some that are not!), but to no 
avail. The only  instructions I find about building packages for windows 
(e.g. mypkg.zip) seem to imply that the build be done on a windows machine.

Is there a simple way to make mypkg.zip under linux and then install it 
as a zip file on a windows machine?

Sincerely,
Halldor
--
--
Halldor Bjornsson   ([EMAIL PROTECTED])
Vedurstofa Islands (Icelandic Met. Office)
Bustadavegur 9, IS-150, Reykjavik, Iceland
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] plot with dates

2004-12-14 Thread Halldor Björnsson
Hi,
I am trying to understand the behaviour of the plot function.
If I have
 novdate - as.Date(2001/11/1) + (0:29)
 y - 1:30
 b - data.frame(novdate,y)
then plot(b$novdate,b$y) will produce a plot where the x-ticmarks are 
given as dates (Nov 04, Nov 09 etc), but plot(b) will produce a plot
where the x-tickmars are integer values (#day since Jan 1st 1970)

In the first case plot is getting a an x-vector of class Date, and 
y-vector of class integer.  In the second case plot gets an object of 
class data.frame (but with components of class Date and integer).

I am new to R so I may be wrong about this, but it seems to me that
different plotting methods are invoked. methods(plot) yields a list of
plot methods, but I cannot access most of them.
Is there a way to guide plot(b) to using the method used by 
plot(b$novdate,b$y), - or is that a bad idea?...

Sincerely,
Halldór
--
Halldor Bjornsson   ([EMAIL PROTECTED])
Vedurstofa Islands (Icelandic Met. Office)
Bustadavegur 9, IS-150, Reykjavik, Iceland
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] printing ISO/8859-1 characters

2004-10-25 Thread Halldor Björnsson
Hi,
I ran into an odd problem with the print command for R-2.0 on a windows 
machine.

The icelandic character thorn (þ,Þ) which is included in in the Latin-1
character set [iso/8859-1 char# 222 (upper case) and #254 (lower case)]
prints out incorrectly. Instead of getting the correct
character I get the octal codes for upper and lower case thorn (\336 or 
\376). This only happens on a windows machine, but not on a linux box.

This is not some problem generic to the Latin-1 characters. I get
all accented characters correctly and also the character eth (ðÐ).
Its only thorn thats problematic...
This problem also shows up on the commandline a -Þ works
ok, but print(a) or just:
a
returns the octal number.
However, when using THORN in plotlabels it works fine.
If anyone knows how to fix this I would be very happy to hear from them...
Thanks
Halldor
--
--
Halldor Bjornsson   ([EMAIL PROTECTED])
Vedurstofa Islands (Icelandic Met. Office)
Bustadavegur 9, IS-150, Reykjavik, Iceland
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html