亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

怎么用R語言繪圖時實現輸出希臘字符上下標及數學公式

發布時間:2021-11-06 08:46:57 來源:億速云 閱讀:557 作者:iii 欄目:開發技術

這篇文章主要講解了“怎么用R語言繪圖時實現輸出希臘字符上下標及數學公式”,文中的講解內容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“怎么用R語言繪圖時實現輸出希臘字符上下標及數學公式”吧!

希臘字母

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

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

上下標

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

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

paste

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

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

一個復雜的例子

目標:

怎么用R語言繪圖時實現輸出希臘字符上下標及數學公式

代碼:

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

進階

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

可參考前文:R語言繪圖公式與變量對象混合拼接實現方法

數學公式

最后的數學公式,只需要在expression()中進行相應的符號連接即可

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

鑒于其很不穩定,這里將里面的細節搬運過來。

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

SyntaxMeaning
x + yx plus y
x - yx minus y
x*yjuxtapose x and y
x/yx forwardslash y
x %±% yx plus or minus y
x %/% yx divided by y
x %*% yx times y
x %.% yx cdot y
x[i]x subscript i
x^2x 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 == yx equals y
x != yx is not equal to y
x < yx is less than y
x <= yx is less than or equal to y
x > yx is greater than y
x >= yx is greater than or equal to y
!xnot x
x %~~% yx is approximately equal to y
x %=~% yx and y are congruent
x %==% yx is defined as y
x %prop% yx is proportional to y
x %~% yx 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)
cdotsellipsis (vertically centred)
ldotsellipsis (at baseline)
x %subset% yx is a proper subset of y
x %subseteq% yx is a subset of y
x %notsubset% yx is not a subset of y
x %supset% yx is a proper superset of y
x %supseteq% yx is a superset of y
x %in% yx is an element of y
x %notin% yx 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 %<->% yx double-arrow y
x %->% yx right-arrow y
x %<-% yx left-arrow y
x %up% yx up-arrow y
x %down% yx down-arrow y
x %<=>% yx is equivalent to y
x %=>% yx implies y
x %<=% yy implies x
x %dblup% yx double-up-arrow y
x %dbldown% yx double-down-arrow y
alpha – omegaGreek symbols
Alpha – Omegauppercase Greek symbols
theta1, phi1, sigma1, omega1cursive Greek symbols
Upsilon1capital upsilon with hook
alephfirst letter of Hebrew alphabet
infinityinfinity symbol
partialdiffpartial differential symbol
nablanabla, gradient symbol
32*degree32 degrees
60*minute60 minutes of angle
30*second30 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 ~~ yput extra space between x and y
x + phantom(0) + yleave 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 + znormal 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語言繪圖時實現輸出希臘字符上下標及數學公式”的內容了,經過本文的學習后,相信大家對怎么用R語言繪圖時實現輸出希臘字符上下標及數學公式這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關知識點的文章,歡迎關注!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

焦作市| 潼南县| 永平县| 滨州市| 高唐县| 来安县| 大埔区| 高州市| 隆尧县| 宁南县| 桑植县| 泰顺县| 辽阳市| 双峰县| 宁夏| 堆龙德庆县| 平和县| 清苑县| 新安县| 双柏县| 曲阳县| 锡林浩特市| 夹江县| 隆昌县| 察雅县| 祁连县| 屯门区| 鲜城| 磐石市| 河曲县| 洛南县| 怀安县| 西畴县| 米林县| 遂溪县| 驻马店市| 三门峡市| 桐柏县| 花莲市| 罗甸县| 黑河市|