Add Subscript and Superscript to Plot in R (3 Examples) | Power of 2 in Text | expression Function

Add Subscript and Superscript to Plot in R (3 Examples) | Power of 2 in Text | expression Function

Statistics Globe

4 года назад

3,815 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@vanquinguyen1051
@vanquinguyen1051 - 13.07.2023 18:34

Hello Statistics Globe. Can you write the code to indicate "mg NH4+-N kg-1" where number 4 as subscript and the + sign as superscript. Thank you.

Ответить
@justinatuulikefonangolo5509
@justinatuulikefonangolo5509 - 11.06.2022 15:36

Hi, Thank you very much for the video. I have a similar question. I want to plot multiple plots side by side using facets and each facets have subscripts. Here is what I tried but it is not working. NewDat1$facets = factor(NewDat1$Parameter, labels = c(
" Alkalinity",
"Ca (CaCO3)",
"Cl (mg/l),",
"Conductivity (mS/m)",
"Cu (mg/l)",
"F (mg/l)",
"Fe (mg/l)",
"K (mg/l",
"Mg (CaCO3)",
" Mn (mg/l)",
"Na (mg/l)",
"NO[3] (mg/l)",
"pH",
" 'SiO'[2] (mg/l)",
"SO[4] (mg/l)",
"TDS (TDS Calculated)",

"Turbidity (NTU)",
"Zn (mg/l)"))

and then created the plot like this:
ggplot(na.omit(NewDat1), aes(Year, Value, color = Location)) +
geom_line() +
geom_point()+
facet_wrap(~facets, scales = "free_y" )

How can I create the subscripts in the labels

Ответить
@md.jakirhossain8784
@md.jakirhossain8784 - 11.04.2022 00:51

Hi, I want to add a superscript in the variable name(e.g. x^2). How can I do that?

Ответить
@hndieu09
@hndieu09 - 06.07.2021 23:09

I am wondering…if you are German,… as your voice remind me my German lecturer. Thanks a a helpful video

Ответить
@Phil-wi1zp
@Phil-wi1zp - 13.08.2020 15:50

Hi, I just came up with another question as I'm creating a lot of plots for my bachelor thesis. I thought it might be in the interest of some other viewers as well since this is a common task.

Let's say I want to subscript within a ggplot legend label. If I type scale_color_manual(labels = c("Discharge",(expression("NO"[3]^"-"))) then the super- and subscripts work but unfortunately there is a wide blank space before the NO3- in the legend label. Is there another way than using expression for legend labels?

Ответить
@Phil-wi1zp
@Phil-wi1zp - 23.07.2020 09:14

Thanks for the video. But let's say my title would be: "NO3- concentration in 2012" and I want to subscript the "3" and superscript the "-". How does it work then? It's similar to line 10 of the code but I can't seem to make it work because the NO3- is at the beginning of my title.

Ответить