Generate 25 Random number in the interval 0-30
✓ Published0🌍 Public
CChristosT
Last edited Jan 31, 2016
Created on Jan 23, 2016
This example shows a static bar chart of 25 randomly generated numbers between 0 and 30, with each bar’s height proportional to its value. The visualization uses D3.js (version 3.5.5) to bind the dataset to `div` elements, setting each bar’s height via `.style("height", ...)` and styling them with the CSS class `bar` (teal, fixed width, inline-block). The data are generated on the fly using `Math.random()*30` in a loop, while the original R code uses `runif(25, 0, 30)` to produce the same distribution. The chart intentionally omits axes, focusing solely on relative bar lengths for comparison.
AI-generated descriptionChristos Tsolakis
R - Language

# Generate 25 Random number in the interval 0-30
data <- runif(25, 0, 30)
#Create a filename to save the plot
png(height=800,width=1500,filename="./figure.png")
#Make barplot
barplot(data,width=100,axes=FALSE,col=rgb(0,128,128,255,maxColorValue=255),space=0.08,border=NA,xlim=c(0,2800))
#Save image
dev.off()