Bar Charts
Makes a vertical bar plot.
A bar plot presents categorical data with rectangular bars with lengths proportional to the values that they represent.

Examples

Bar plot on Series

1
<!DOCTYPE html>
2
<html lang="en">
3
4
<head>
5
<meta charset="UTF-8">
6
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/bundle.min.js"></script>
8
<title>Document</title>
9
</head>
10
11
<body>
12
13
<div id="plot_div"></div>
14
<script>
15
16
const s = new dfd.Series([1, 3, 2, 6, 10, 34, 40, 51, 90, 75])
17
s.plot("plot_div").bar()
18
19
</script>
20
</body>
21
22
</html>
Copied!

Bar plot on DataFrame

1
<!DOCTYPE html>
2
<html lang="en">
3
4
<head>
5
<meta charset="UTF-8">
6
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/bundle.min.js"></script>
8
</head>
9
10
<body>
11
12
<div id="plot_div"></div>
13
<script>
14
15
const df = new dfd.DataFrame({'pig': [20, 18, 489, 675, 1776],
16
'horse': [4, 25, 281, 600, 1900]}, {index: [1990, 1997, 2003, 2009, 2014]})
17
df.plot("plot_div").bar()
18
19
</script>
20
</body>
21
22
</html>
Copied!
To customize plots, see the Customizing your plot page