欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

R語言繪圖時輸出希臘字符上下標(biāo)及數(shù)學(xué)公式實(shí)現(xiàn)方法

 更新時間:2021年11月05日 17:36:09   作者:Kanny廣小隸  
這篇文章主要為大家介紹了R語言進(jìn)行繪圖時輸出希臘字符上標(biāo),下標(biāo)及數(shù)學(xué)公式的實(shí)現(xiàn)方法,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪

通常在我們寫論文時,所需要的統(tǒng)計圖是非常嚴(yán)謹(jǐn)?shù)模锩娴南ED字符與上下腳標(biāo)都必須要嚴(yán)格書寫。因此在使用R繪圖時,如何在我們目標(biāo)圖中使用希臘字符、上標(biāo)、下標(biāo)及一些數(shù)學(xué)公式呢?在本博客中我們會進(jìn)行詳細(xì)的說明。

后面我們都將以一個最簡單的繪圖為例,只是將其標(biāo)題進(jìn)行修改。

希臘字母

使用希臘字符、上標(biāo)、下標(biāo)及數(shù)學(xué)公式,都需要利用一個函數(shù):expression(),具體使用方式如下:

plot(cars)
title(main = expression(Sigma))

輸出:

上下標(biāo)

expression()中的下標(biāo)為[],上標(biāo)為^,空格為~,連接符為*。示例代碼如下:

plot(cars)
title(main = expression(Sigma[1]~'a'*'n'*'d'~Sigma^2))

輸出:

paste

想達(dá)到上面的效果,我們其實(shí)可以使用paste()expression()進(jìn)行組合,不需要上述繁瑣的過程,也能夠達(dá)到我們上述一模一樣的輸出,并且方便快捷:

plot(cars)
title(main = expression(paste(Sigma[1], ' and ', Sigma^2)))

一個復(fù)雜的例子

目標(biāo):

代碼:

expression(paste((frac(1, m)+frac(1, n))^-1, ABCD[paste(m, ',', n)]))

進(jìn)階

在我們想批量產(chǎn)生大量含有不同變量值的標(biāo)題時,如果遇到變量與公式的混合輸出該如何操作,

可參考前文:R語言繪圖公式與變量對象混合拼接實(shí)現(xiàn)方法

數(shù)學(xué)公式

最后的數(shù)學(xué)公式,只需要在expression()中進(jìn)行相應(yīng)的符號連接即可

具體要求可參考:Mathematical Annotation in R

鑒于其很不穩(wěn)定,這里將里面的細(xì)節(jié)搬運(yùn)過來。

(下表也可以直接在 R help 中搜索 plotmath 獲取。)

Syntax Meaning
x + y x plus y
x - y x minus y
x*y juxtapose x and y
x/y x forwardslash y
x %±% y x plus or minus y
x %/% y x divided by y
x %*% y x times y
x %.% y x cdot y
x[i] x subscript i
x^2 x superscript 2
paste(x, y, z) juxtapose x, y, and z
sqrt(x) square root of x
sqrt(x, y) yth root of x
x == y x equals y
x != y x is not equal to y
x < y x is less than y
x <= y x is less than or equal to y
x > y x is greater than y
x >= y x is greater than or equal to y
!x not x
x %~~% y x is approximately equal to y
x %=~% y x and y are congruent
x %==% y x is defined as y
x %prop% y x is proportional to y
x %~% y x is distributed as y
plain(x) draw x in normal font
bold(x) draw x in bold font
italic(x) draw x in italic font
bolditalic(x) draw x in bolditalic font
symbol(x) draw x in symbol font
list(x, y, z) comma-separated list
ellipsis (height varies)
cdots ellipsis (vertically centred)
ldots ellipsis (at baseline)
x %subset% y x is a proper subset of y
x %subseteq% y x is a subset of y
x %notsubset% y x is not a subset of y
x %supset% y x is a proper superset of y
x %supseteq% y x is a superset of y
x %in% y x is an element of y
x %notin% y x is not an element of y
hat(x) x with a circumflex
tilde(x) x with a tilde
dot(x) x with a dot
ring(x) x with a ring
bar(xy) xy with bar
widehat(xy) xy with a wide circumflex
widetilde(xy) xy with a wide tilde
x %<->% y x double-arrow y
x %->% y x right-arrow y
x %<-% y x left-arrow y
x %up% y x up-arrow y
x %down% y x down-arrow y
x %<=>% y x is equivalent to y
x %=>% y x implies y
x %<=% y y implies x
x %dblup% y x double-up-arrow y
x %dbldown% y x double-down-arrow y
alpha – omega Greek symbols
Alpha – Omega uppercase Greek symbols
theta1, phi1, sigma1, omega1 cursive Greek symbols
Upsilon1 capital upsilon with hook
aleph first letter of Hebrew alphabet
infinity infinity symbol
partialdiff partial differential symbol
nabla nabla, gradient symbol
32*degree 32 degrees
60*minute 60 minutes of angle
30*second 30 seconds of angle
displaystyle(x) draw x in normal size (extra spacing)
textstyle(x) draw x in normal size
scriptstyle(x) draw x in small size
scriptscriptstyle(x) draw x in very small size
underline(x) draw x underlined
x ~~ y put extra space between x and y
x + phantom(0) + y leave gap for “0”, but don't draw it
x + over(1, phantom(0)) leave vertical gap for “0” (don't draw)
frac(x, y) x over y
over(x, y) x over y
atop(x, y) x over y (no horizontal bar)
sum(x[i], i==1, n) sum x[i] for i equals 1 to n
prod(plain§(X==x), x) product of P(X=x) for all values of x
integral(f(x)*dx, a, b) definite integral of f(x) wrt x
union(A[i], i==1, n) union of A[i] for i equals 1 to n
intersect(A[i], i==1, n) intersection of A[i]
lim(f(x), x %->% 0) limit of f(x) as x tends to 0
min(g(x), x > 0) minimum of g(x) for x greater than 0
inf(S) infimum of S
sup(S) supremum of S
x^y + z normal operator precedence
x^(y + z) visible grouping of operands
x^{y + z} invisible grouping of operands
group("(",list(a, b),"]") specify left and right delimiters
bgroup("(",atop(x,y),")") use scalable delimiters
group(lceil, x, rceil) special delimiters
group(lfloor, x, rfloor) special delimiters

以上就是R語言繪圖時輸出希臘字符上下標(biāo)及數(shù)學(xué)公式實(shí)現(xiàn)方法的詳細(xì)內(nèi)容,更多關(guān)于R語言繪圖輸出希臘字符上下標(biāo)及數(shù)學(xué)公式的資料請關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

  • R語言泊松(Poisson)分布實(shí)例詳解

    R語言泊松(Poisson)分布實(shí)例詳解

    Poisson分布是一種統(tǒng)計與概率學(xué)里常見到的離散概率分布,下面這篇文章主要給大家介紹了關(guān)于R語言泊松(Poisson)分布的相關(guān)資料,文中通過實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2022-11-11
  • R語言中cbind、rbind和merge函數(shù)的使用與區(qū)別

    R語言中cbind、rbind和merge函數(shù)的使用與區(qū)別

    這篇文章主要介紹了R語言中cbind、rbind和merge函數(shù)的使用與區(qū)別,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-03-03
  • 基于R語言xlsx安裝遇到的問題及解決方案

    基于R語言xlsx安裝遇到的問題及解決方案

    這篇文章主要介紹了基于R語言xlsx安裝遇到的問題及解決方案,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2021-04-04
  • 解決R語言 數(shù)據(jù)不平衡的問題

    解決R語言 數(shù)據(jù)不平衡的問題

    這篇文章主要介紹了解決R語言 數(shù)據(jù)不平衡的問題,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2021-03-03
  • R語言數(shù)據(jù)類型和對象深入講解

    R語言數(shù)據(jù)類型和對象深入講解

    這篇文章主要介紹了R語言數(shù)據(jù)類型和對象深入講解,文中列舉的實(shí)例講解的很清楚,有感興趣的同學(xué)可以學(xué)習(xí)下
    2021-03-03
  • R語言因子型數(shù)值轉(zhuǎn)數(shù)值型的操作

    R語言因子型數(shù)值轉(zhuǎn)數(shù)值型的操作

    這篇文章主要介紹了R語言因子型數(shù)值轉(zhuǎn)數(shù)值型的操作,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2021-04-04
  • R語言中矩陣matrix和數(shù)據(jù)框data.frame的使用詳解

    R語言中矩陣matrix和數(shù)據(jù)框data.frame的使用詳解

    這篇文章主要介紹了R語言中矩陣matrix和數(shù)據(jù)框data.frame的使用詳解,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-03-03
  • R語言變量重編碼、重命名的操作

    R語言變量重編碼、重命名的操作

    這篇文章主要介紹了R語言變量重編碼、重命名的操作,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2021-04-04
  • 詳解R語言實(shí)現(xiàn)前向逐步回歸(前向選擇模型)

    詳解R語言實(shí)現(xiàn)前向逐步回歸(前向選擇模型)

    本文主要介紹了詳解R語言實(shí)現(xiàn)前向逐步回歸,從實(shí)現(xiàn)原理開始,文中通過示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2021-08-08
  • R語言繪制餅狀圖代碼實(shí)例

    R語言繪制餅狀圖代碼實(shí)例

    在本篇文章里小編給大家整理的是一篇關(guān)于R語言繪制餅狀圖代碼實(shí)例內(nèi)容,有興趣的朋友們可以學(xué)習(xí)下。
    2021-04-04

最新評論