Skip to main content
100%

D3 Bar chart for random values

✓ Published0🌍 Public
MMrajyalakshmi
Last edited Jan 31, 2016
Created on Jan 25, 2016

This example presents two bar charts of the same 25 random values. An R-generated image uses `barplot` with a cyan fill to display the dataset, while a D3.js version in `index.html` creates a dynamic bar chart by generating random numbers in a loop, binding them with `d3.selectAll("div").data()`, and styling each bar’s height with a custom scale. The D3 chart uses div elements with a teal background and inline height adjustments, while the R chart relies on the base graphics function. Both visualizations share the same data range but differ in implementation languages and rendering approaches.

AI-generated description

Rajyalakshmi Mukkamala( UIN:01030975)

Embedding an image generated by R code:

R image

Embedding R code

Define the vector and plot graph



data<-c(25, 7, 5, 26, 11, 8, 25, 14, 23, 19,14,11,22,29,11,13,12,17,18,10,24,18,25,9,3)
barplot(data,col="cyan4")

Similar vizzes