similar to: Specifying relative position of text in a plot

Displaying 20 results from an estimated 20000 matches similar to: "Specifying relative position of text in a plot"

2007 Oct 08
2
Fill a polygon with a pattern
What is the simplest (namely: minimum number of libraries or conflicts) way to fill a polygon with a pattern? For example, suppose I have (in a graphic file, like a jpeg) the drawing of an "X". Then I fill a polygon (like a triangle) with this pattern, and get something like: X XXX XXXXX XXXXXXX (where the border "X"s could be truncated). I searched the rimage
2006 Sep 30
1
Simple graphics
Is there any way that I can do something like this: png("file.png", width=200, height=200) polygon(c(50, 50, 150, 150), c(50, 150, 150, 50)) dev.off() and then have a png file with a 100 x 100 pixels rectangle in the middle of it? It seems that when I call "plot", it redefines the image coordinates to some "optimized" value and then I lose any information to
2007 May 04
1
Help with map
I have just learned how to play with map, but something weird (or not) is happening. Suppose I want to draw a map of two countries (that have disconnected components), like Argentina and Brazil. If I command: library(maps) library(mapdata) map("worldHires", c("Argentina", "Brazil")) It works fine. However, if I want to _colour_ the interior:
2011 Nov 05
1
3-D ellipsoid equations
+ Hello, The parametric equations of an ellipsoid can be written in terms of spherical coordinates. The three spherical coordinates are converted to Cartesian coordinates by X=a cos (α) sin(θ) Y=b sin(α) sin(θ) Z=c cos(θ) for α and θ The parameter α varies from 0 to 2 π and θ varies from 0 to π . Here ( X o , Y o ,Z o ) is the center of the ellipsoid, and θ is the angle
2007 Mar 05
4
0 * NA = NA
Is there any way to "force" 0 * NA to be 0 instead of NA? For example, suppose I have a vector with some valid values, while other values are NA. If I matrix-pre-multiply this by a weight row vector, whose weights that correspond to the NAs are zero, the outcome will still be NA: x <- c(1, NA, 1) wt <- c(2, 0, 1) wt %*% x # NA Alberto Monteiro
2007 Mar 23
5
Get "home" directory and simple I/O
Is there any generic function that gets the "home" directory? This should return /home/<user> in Linux and x:/Documents and Settings/<user> (or whatever) in Windows XP. Another (unrelated) question: what is the _simplest_ way to read and write R variables to/from files such that they are stored in a human-readable but R-like form? For example, if (say), x is a vector
2008 Apr 29
4
XML write?
Is there any function to write a XML structure, after it was read using xmlTreeParse? Ex: library(XML) x <- xmlTreeParse("Irpf2008/aplicacao/dados/12345678901/12345678901.xml") # write it... Alberto Monteiro PS: please, brazilians, don't be offended by my foul language!
2007 Feb 28
3
get more than get
This must be a stupid question, but is there any "extension" of get? For example: x <- 10 get("x") # gives me 10 get("x^2") # gives me an error Alberto Monteiro
2007 Mar 06
2
Package RODBC
I have some questions about the RODBC package. library(RODBC) # required for those who want to repeat these lines 1st, I noticed that the following sequence does not work: channel <- odbcConnextExcel("test.xls") tables <- sqlTables(channel) name1 <- tables[1, "TABLE_NAME"] # this should be the name plan1 <- sqlFetch(channel, name1) # bang!
2007 Jul 05
4
Me again, about the horrible documentation of tcltk
How on Earth can I know what are the arguments of any of the functions of the tcl/tk package? I tried hard to find, using all search engines available, looking deep into keywords of R, python's tkinter and tcl/tk, but nowhere I found anything remotely similar to a help. For example, what are the possible arguments to tkgetOpenFile? I know that this works: library(tcltk) filename <-
2008 Jun 06
2
Plot matrix as many lines
Suppose that I have a matrix like: m <- rbind(c(1,2,3,4), c(2,3,2,1)) Is there any way to efficiently plot the _lines_ as if I was doing: plot(m[1,], type="l") points(m[2,], type="l", col="red") (of course, in the "real world" there much more than just 2 lines and 4 columns...) Alberto Monteiro
2008 Jun 10
2
A curious bug in read.xls
I found a curious bug in read.xls. I don't know if it's reproducible. It's like this: suppose I do a read.xls in a spreadsheet. A column begins with a number. Then, any strings below it will be rendered as NA. If the column begins with a string, then it will be rendered correctly. Alberto Monteiro
2008 Sep 30
2
plot inside graphic area
I am trying to plot a small graphic inside the graphic area of a bigger graphic. Does anybody know the commend for that? Thanks a lot! -- MSc José Alberto F. Monteiro Botanisches Institut Universität Basel السلام عليكم [[alternative HTML version deleted]]
2007 May 20
4
Running an R script without running R
Is there any way to run an R script without running R? As an example, suppose I have a tcl/tk interface that asks for a number (in a GUI) and displays its factorial. Is there a way to invoke this script without invoking R? I'm using R 2.4.1 in GNU/Linux Fedora Core 4. Alberto Monteiro
2007 Jul 16
2
Source inside source
Is there a way to know where is the source, so as to make a source call inside another source smarter? As an example: file1.R is in directory /files/dir1/ file2.R is in directory /files/dir1/dir2/ In file1.R, there is this line: source("dir2/file2.R") So, if I setwd to /files/dir1/, and then I call source("file1.R"), it will run correctly. However, if I setwd to /files,
2007 Mar 30
3
RWiki, tcltk and plot
I think I - almost - got the knack for GUI programming using the tcltk library. Maybe I will update the RWiki with this: # ################################################# # library(tcltk) # # Create some matrix - nothing about tcltk here # matrix <- cbind(rnorm(100), rpois(100, lambda=10), runif(100), rt(100, df=2), rt(100, df=4)) colnames(matrix) <- c("Normal",
2006 Oct 05
5
[Fwd: Re: Block comments in R?]
Ooops! Sorry, I send it only to Uwe Ligges the first time. Best, Philippe Grosjean This is perhaps another solution, more elegant in the way the block comment is written... but it requires to redefine `!` and slows it a little bit because it tests first its arguments before calling .Primitive(!): It takes advantage of `!` being not defined for character arguments: > !2 [1] FALSE >
2007 Feb 28
2
What is a expression good for?
I mean, I can generate a expression, for example, with: z <- expression(x+y) But then how can I _use_ it? Is it possible to retrieve information from it, for example, that z is a sum, its first argument is x (or expression(x)) and its second argument is y? Alberto Monteiro
2007 Jun 04
2
Abstract plot
I want to make a plot, but instead of showing _numerical_ values, I would like to show _symbolic_ values. For example, I want to plot a function y = a x + b, where x varies between Xmin and Xmax. I would like the plot to show, in the x-axis, the strings Xmin and Xmax, instead of their numeric values. Is it possible? Alberto Monteiro
2008 Jun 16
2
Annoyance in as.numeric
Why does as.numeric convert matrices and arrays to vectors? as.numeric(matrix(c("1", "2", "3", "4"), 2, 2)) [1] 1 2 3 4 I could only figure out ugly ways to bypass this, like: x <- matrix(c("1", "2", "3", "4"), 2, 2) array(as.numeric(x), dim = dim(x), dimnames = dimnames(x)) Alberto Monteiro