Displaying 20 results from an estimated 3000 matches similar to: "Plotmath and line breaks in long annotations for plots"
2011 Dec 05
1
Problem in while loop
Hi all,
I have the following code,
When I run the code, it never terminate this is because of the while loop i
am using. In general, if you need a loop for which you don't know in
advance how many iterations there will be, you can use the `while'
statement so here too i don't know the number how many iterations are
there. So Can some one suggest me whats going on?
I am using the
2008 Feb 21
1
linebreaks in mathplot
Dear HelpeRs,
I would like to do sg similar to:
plot(c(0,100), c(0,100), xaxs="i", yaxs="i", type="n")
txt <- paste("a =", a, "%\n b =", b, " km2", sep="")
text(95, 95, txt, adj=c(1,1))
just with the "km2" formatted with 2 in a superscript.
I thought
txt <- substitute("a = "*a*" %\n b
2008 Jan 17
2
"non-plot" plotting
I really do not know ho to else title this ... I want to draw something like
the attached png with R and would like to poll you on how to start ... make
an empty plot first and then start positioning the characterstring
by 'text' and then drawing the lines ...
Joh
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sequence.png
Type: image/png
Size: 7117
2010 Aug 01
3
Constructing arguments for plotmath
Colleagues,
I am encountering difficulty adding formatted text to a graphic. Specifically, I want to add a superscript in the middle of a text string but I would like to format the text string on the fly. The commands:
plot(1,1)
ARG <- bquote('TEXT'^'\u00ae')
mtext(ARG, line=-2, side=1)
yield the desired output.
However, my goal is to paste together a string, then pass
2009 Mar 31
1
Selecting Bootstrap Statistics in the boot package
Dear all,
Let's say I have the following:
# Loading the boot package
# install.packages(boot)
library(boot)
# Generating data
set.seed(123)
x <- rnorm(100)
# Bootstrap for the sample mean
bmean <- boot(x, function(x,d) mean(x[d]), R=1000)
bmean
#
#ORDINARY NONPARAMETRIC BOOTSTRAP
#
#
#Call:
#boot(data = x, statistic = function(x, d) mean(x[d]), R = 1000)
#
#
#Bootstrap Statistics :
#
2008 Apr 02
1
Trouble combining plotmath, bquote, expressions
I'm using R-2.6.2 on Fedora Linux 9.
I've been experimenting with plotmath.
I wish it were easier to combine expressions in plotmath with values
from the R program itself. There are two parameters in the following
example, the mean "mymean" and standard deviation "mystd". I am able
to use bquote to write elements into the graph title like
mu = mymean
and R will
2008 Dec 31
3
Plotmath with values?
I hope to use the plotmath facility to print titles that mix
math and values of R variables.
The help for "plotmath" has an example, which after repeated
reading, I find baffling. Likewise, I have read the help file
for "substitute" (wqhich seems to be needed) without ever
understanding what it does, other than being used in some magic
incantations.
I would like to do
2023 Jun 08
2
need help with plotmath and/or plotting unicode characters
R 4.2.3
OS X
Colleagues
This should be easy -- but not for me.
I want to plot text similar to this:
N ? XX: YY
where XX can be either 1 or 50 and YY is an integer
I envision that there would be two solutions:
UNICODE: If I can generate "?" via unicode, the problem is solved:
mtext(side=3, paste0("N ", UNICODE, " ", XX, ": ", YY))
PLOTMATH:
2004 Apr 14
1
ltext, plotmath, and substitute
I am interested to use plotmath functions within a panel function but am having
some problems getting the code right. Within each panel I am plotting the data,
fitting a regression line, and would like to print the regression equation.
Here is a trivial example of what I'd like to do:
# generate simple data
tmp.df <- data.frame(id = rep(1:4, each=4),
time = rep(1:4, 4),
das =
2009 Jun 03
1
Would like to add this to example for plotmath. Can you help?
Greetings:
I would like comments on this example and after fixing it up, I need
help from someone who has access to insert this in R's help page for
plotmath.
I uploaded a drawing
http://pj.freefaculty.org/R/Normal-2009.pdf
that is created by the following code
http://pj.freefaculty.org/R/Normal1_2009_plotmathExample.R
This will be a good addition to the plotmath help page/example.
2011 Jun 02
2
plotmath: paste string and expression [from a vector of expressions]
Dear all,
I have a vector of expressions and would like to "paste" some string to it before using it in a plot:
vars <- vector("expression", 2)
vars[1] <- expression(alpha)
vars[2] <- expression(beta)
plot(0, 0, main=substitute(bold("Foo" ~~ VAR), list(VAR=vars[2]) ))
Although I tried hard, I just can't figure out how to solve this. The title should be
2007 Nov 15
2
Using plotmath expressions in lattice key text
Folks:
delta <- 1:5
I would like to put 5 separate lines of text of the form "10 %+-% delta[i]"
into a lattice key legend, where ""%+-%" is the plotmath plus/minus symbol
and delta[i] is the ith value of delta.
The construct:
lapply(delta,function(d)bquote(10%+-%.(d)))
appears to produce a list of expressions of the correct form, and, indeed,
if I assign the above
2008 Jun 19
3
YAPMQ - Yet Another PlotMath Question
Hello,
I'm having trouble finding (remembering) how to pass values into text
functions in plots, as demonstrated by:
slope <- 45 ; plot(1:10) ; text(2, 7, labels = expression(45~degree)) ;
text(2, 5, labels = paste(bquote(.(slope)), expression(degree)))
Thanx, DaveT.
*************************************
Silviculture Data Analyst
Ontario Forest Research Institute
Ontario Ministry of
2012 Mar 16
2
variable values in plotmath expressions
## I would like help in using variable values in plotmath expressions
## in lattice
x <- 1:10
y <- 1:10
pval <- .95
plot(y ~ x, ## works as I want in base graphics
main=substitute(list(alpha * " = " * group("",list(p),"")),
list(p=pval)))
plot(y ~ x, ## doesn't work as intended: "pval" is displayed
main=substitute(list(alpha *
2010 Jul 06
1
plotmath vector problem; full program enclosed
Here's another example of my plotmath whipping boy, the Normal distribution.
A colleague asks for a Normal plotted above a series of axes that
represent various other distributions (T, etc).
I want to use vectors of equations in plotmath to do this, but have
run into trouble. Now I've isolated the problem down to a relatively
small piece of working example code (below). If you would
2008 Apr 08
2
plotmath "overstrikes" in output on a Linux system
I've been testing plotmath. But I'm getting some funny output one one
computer. The problem is that characters are 'jumbled' and overstrike
when symbols are introduced.
Sample code:
mu <- 440.0
sigma <- 12.5
myx <- seq( mu - 4*sigma, mu+ 4*sigma, length.out=500)
myDensity <- dnorm(myx,mean=mu,sd=sigma)
# Here's one way to retrieve the values of mu and sigma and
2006 Mar 06
3
how to make plotmath expression work together with paste
Recent questions about using plotmath have renewed my interest in this question
I want to have expressions take values of variables from the
environment. I am able to use expressions, and I am able to use paste
to put text and values of variables into
plots. But the two things just won't work together.
Here is some example code that shows what I mean.
plot(NA,xlim=c(0,100),ylim=c(0,100))
2006 Jan 03
1
Summary functions to dataframe
I have written a few different summary functions. I want to calculate
the statistics by groups and I am having trouble getting the output as a
dataframe. I have attached one example with a small dataset that
calculates summary stats and percentiles, I have others that calculate
upper confidence limits etc. I would like the output to be converted to
a dataframe with one of the columns as the
2012 Nov 14
2
vectorized plotmath expressions via substitute()
hi all - i've seen versions of this question before, but none seem to get
directly at my solving my (probably very simple) issue:
i simply want to annotate the tick marks on an axis with (superscripted)
10^x notation, and tried this:
axis(1, at = axTicks(1), as.expression(substitute(10^foo, list(foo =
axTicks(1))))
thinking the as.expression/substitute would create the appropriate
2011 Jun 02
2
lattice + plotmath: how to get a variable in bold face?
Dear all,
How can I get a bold "1000" in the title? I would like to use a variable (as opposed to putting in "1000" directly).
library(lattice)
N <- 1000
xyplot(0~0, xlab.top=list(label=as.expression(bquote(bold("foo" ~ .(N) ~ "bar"))), font=2, cex=1.2))
## => "font=2" is ignored (of course)
Cheers,
Marius