plotmath

Transform numbers with exponents to plotmath commands for beautiful legends in R

给你一囗甜甜゛ 提交于 2020-01-13 23:18:04
问题 I'm trying to generate a beautiful legend in R plots. I have a factor=1e-5 , that should appear nicely formatted in the legend. I found a nice function in the package sfsmisc , that transforms numbers to expressions. To add this expression to my bquote command, it seems that I need to transform itto a call. unfortunately, there are braces added at the end of the string ( 10^-5() ). Is there a way to avoid the addition of thoses braces? Or is there even an easier way to transform numbers to

Transform numbers with exponents to plotmath commands for beautiful legends in R

无人久伴 提交于 2020-01-13 23:15:00
问题 I'm trying to generate a beautiful legend in R plots. I have a factor=1e-5 , that should appear nicely formatted in the legend. I found a nice function in the package sfsmisc , that transforms numbers to expressions. To add this expression to my bquote command, it seems that I need to transform itto a call. unfortunately, there are braces added at the end of the string ( 10^-5() ). Is there a way to avoid the addition of thoses braces? Or is there even an easier way to transform numbers to

Transform numbers with exponents to plotmath commands for beautiful legends in R

不打扰是莪最后的温柔 提交于 2020-01-13 23:13:36
问题 I'm trying to generate a beautiful legend in R plots. I have a factor=1e-5 , that should appear nicely formatted in the legend. I found a nice function in the package sfsmisc , that transforms numbers to expressions. To add this expression to my bquote command, it seems that I need to transform itto a call. unfortunately, there are braces added at the end of the string ( 10^-5() ). Is there a way to avoid the addition of thoses braces? Or is there even an easier way to transform numbers to

Using plotmath in ggplot2 with percent sign (%)

烂漫一生 提交于 2020-01-10 01:47:35
问题 I would like to use Greek characters, Latin characters and the percent sign in the facet labels of a ggplot2 bar chart. Greek characters can be done with 'facet_grid(.~variable, labeller=label_parsed)': a<-c("Delta~V","VarcoV","Delta~V","VarcoV") b<-c(1,2,3,4) d<-c("one","one","two","two") mydata<-data.frame(cbind(b,a,d)) ggplot(mydata,aes(x=d,y=b))+facet_grid(.~a, labeller=label_parsed)+geom_bar(stat="identity") Now I also want to add a facet label that includes % and a Latin character: a<-c

Using plotmath in ggplot2 with percent sign (%)

北慕城南 提交于 2020-01-10 01:47:35
问题 I would like to use Greek characters, Latin characters and the percent sign in the facet labels of a ggplot2 bar chart. Greek characters can be done with 'facet_grid(.~variable, labeller=label_parsed)': a<-c("Delta~V","VarcoV","Delta~V","VarcoV") b<-c(1,2,3,4) d<-c("one","one","two","two") mydata<-data.frame(cbind(b,a,d)) ggplot(mydata,aes(x=d,y=b))+facet_grid(.~a, labeller=label_parsed)+geom_bar(stat="identity") Now I also want to add a facet label that includes % and a Latin character: a<-c

Keeping trailing zeroes with plotmath

有些话、适合烂在心里 提交于 2020-01-02 02:01:46
问题 I'm using annotate() to overlay text on one of my ggplot2 plots. I'm using the option parse=T because I need to use the Greek letter rho. I'd like the text to say = -0.50 , but the trailing zero gets clipped and I get -0.5 instead. Here's an example: library(ggplot2) x<-rnorm(50) y<-rnorm(50) df<-data.frame(x,y) ggplot(data=df,aes(x=x,y=y))+ geom_point()+ annotate(geom="text",x=1,y=1,label="rho==-0.50",parse=T) Does anyone know how I can get the last 0 to show up? I thought I could use paste(

Using subscript and line break at the same time in plot titles in R

穿精又带淫゛_ 提交于 2020-01-01 19:25:22
问题 I wish to include a subscript and a title running into two lines at the same time but am not getting desired result with following commands: base<-'B1' compare<-'A1' plot (1, 1, main = bquote('Annual mean' ~CO[2] ~'Flux Difference: \n' ~.(compare)~ 'minus'~.(base))) I wish to insert a line break after 'Flux Difference' but its not happening instead this term is hanging nowhere. Please help me. Thanks, Munish 回答1: This is a fairly common request and there is no really clean answer. Plotmath

Using subscript and line break at the same time in plot titles in R

烈酒焚心 提交于 2020-01-01 19:25:13
问题 I wish to include a subscript and a title running into two lines at the same time but am not getting desired result with following commands: base<-'B1' compare<-'A1' plot (1, 1, main = bquote('Annual mean' ~CO[2] ~'Flux Difference: \n' ~.(compare)~ 'minus'~.(base))) I wish to insert a line break after 'Flux Difference' but its not happening instead this term is hanging nowhere. Please help me. Thanks, Munish 回答1: This is a fairly common request and there is no really clean answer. Plotmath

R: bold numbers in plot annotation created by plotmath

♀尐吖头ヾ 提交于 2019-12-31 04:27:13
问题 I build graphics in which I use regular and bold font for titles and/or labels. They contain symbols, text and numbers which I combine using ?plotmath . I noticed that using bold within the expression changes only character strings to bold face, but not numbers which are part of the expression. See this minimal example: x <- y <- 1:10 plot(x, y, xlab=bquote(bold(foo[bar]^2==.(mean(x))))) In this example, there is a numeric superscript on the LHS, and an evaluated expression on the RHS of the

How can you use the atop function in expression()?

旧巷老猫 提交于 2019-12-30 10:52:42
问题 I need to add a line break but I am struggling with the atop function in expression() . The main is the part I would like to break into two lines. > plot (DAC~Chlo,data=brazilw, pch=15,col="red",cex=0.5, main=expression("Fig. 3. Relationship between diffuse attenuation coefficient at 490 nm (K"[d]*") and chlorophyll concentration at three coral reef sites"), xlab=expression("Chlorophyll concentration (mg "*m^{-3}*")"), cex.lab=0.8, cex.main=0.8, cex.axis=0.8, font.main=1, ylim=c(0,0.3), xlim