Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Adding text to bar plot bars -- elegantly!
#R version 3.3.2 # # Adding text to bar plot bars -- elegantly! #(Data source: https://sciencestruck.com/color-spectrum-chart) # # Data, bar colors, labels, and titles first color.freq.thz=c(442,496,517,566,637,685,744.5) spectrum7=c("red","orange","yellow","green","blue","#6600bb","purple") color.names=c("red","orange","yellow","green","blue","indigo","violet") title1="EMS Color by Median Frequency" title2="Median Frequency in THz" # Now let's do that barplot thing barplot(color.freq.thz,col=spectrum7,main=title1,ylab=title2,ylim=c(400,800)) # This part adds the relevant text (color.names) above each bar horiz.pos=0.7 horiz.pos.incr=1.2 for(i in 1:7) { text(horiz.pos,color.freq.thz[i]+15,color.names[i]) horiz.pos=horiz.pos+horiz.pos.incr } # Lastly, we draw some reference lines on the plot, making it easier to read. abline(h=seq(400,800,50),lty=2,col="grey50")
run
|
edit
|
history
|
help
0
Área sob curvas de funções: Integração numérica utilizando a regra do trapézio.
Teste
Área de un cuadrado
R Basic
sqrt.r
Call option formula for Laplace distributed outcomes
Labegen exemplo
Practical No 8
R functions
Are the items of a vector in a given data frame? (Filtering basics)