Skip to content

Commit 61c5e55

Browse files
committedSep 12, 2019
first commit
0 parents  commit 61c5e55

26 files changed

+179342
-0
lines changed
 

‎.idea/inspectionProfiles/profiles_settings.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.idea/misc.xml

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.idea/workspace.xml

+45
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.idea/wwii data visualitation.iml

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎README.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
3+
# Exploring data of WWII with pandas and Bokeh
4+
This is something I made following this blog: [Visualizing with bokeh](https://programminghistorian.org/en/lessons/visualizing-with-bokeh)
5+
6+
7+
## Check out the Plots
8+
9+
1. [x] [JavaScript Drum Kit](https://richardbmk.github.io/JavaScript30/01%20-%20JavaScript%20Drum%20Kit)
10+
2. [x] [JS + CSS Clock](https://richardbmk.github.io/JavaScript30/02%20-%20JS%20and%20CSS%20Clock)
11+
3. [x] [CSS Variables](https://richardbmk.github.io/JavaScript30/03%20-%20CSS%20Variables)
12+
4. [x] [Array Cardio, Day 1](https://richardbmk.github.io/JavaScript30/04%20-%20Array%20Cardio%20Day%201)
13+
5. [x] [Flex Panel Gallery](https://richardbmk.github.io/JavaScript30/05%20-%20Flex%20Panel%20Gallery)
14+
6. [x] [Type Ahead](https://richardbmk.github.io/JavaScript30/06%20-%20Type%20Ahead)
15+
7. [x] [Array Cardio, Day 2](https://richardbmk.github.io/JavaScript30/07%20-%20Array%20Cardio%20Day%202/)
16+
8. [x] [Fun with HTML5 Canvas](https://richardbmk.github.io/JavaScript30/08%20-%20Fun%20with%20HTML5%20Canvas/)
17+
9. [x] [Dev Tools Domination](https://richardbmk.github.io/JavaScript30/09%20-%20Dev%20Tools%20Domination/)

‎columnDataSource.html

+83
Large diffs are not rendered by default.

‎column_datasource.py

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import pandas as pd
2+
from bokeh.plotting import figure, output_file, show
3+
from bokeh.models import ColumnDataSource
4+
from bokeh.models.tools import HoverTool
5+
6+
output_file('columnDataSource.html')
7+
8+
df = pd.read_csv('thor_wwii.csv')
9+
10+
sample = df.sample(100)
11+
source = ColumnDataSource(sample)
12+
13+
p = figure()
14+
p.circle(x='TOTAL_TONS', y='AC_ATTACKING',
15+
source=source,
16+
size=10, color='blue')
17+
18+
p.title.text = 'Attacking Aircraft and Munitions Dropped'
19+
p.xaxis.axis_label = 'Tons of Munitions Dropped'
20+
p.yaxis.axis_label = 'Number of Attacking Aircraft'
21+
22+
23+
hover = HoverTool()
24+
hover.tooltips = [
25+
('Attack Date', '@MSNDATE'),
26+
('Attacking Aircraft', '@AC_ATTACKING'),
27+
('Tons of Munitions', '@TOTAL_TONS'),
28+
('Type of Aircraft', '@AIRCRAFT_NAME'),
29+
('Areas of operation', '@THEATER')
30+
]
31+
32+
p.add_tools(hover)
33+
34+
show(p)

‎env.txt

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
HAY UN ENTORNO VIRTUAL EN ESTA CARPETA!!
2+
3+
Executing transaction: done
4+
#
5+
# To activate this environment, use
6+
#
7+
# $ conda activate bokeh-env
8+
#
9+
# To deactivate an active environment, use
10+
#
11+
# $ conda deactivate
12+
13+

‎eto_operations.html

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
2+
3+
4+
5+
<!DOCTYPE html>
6+
<html lang="en">
7+
8+
<head>
9+
10+
<meta charset="utf-8">
11+
<title>Bokeh Plot</title>
12+
13+
14+
15+
16+
17+
18+
19+
<script type="text/javascript" src="https://cdn.pydata.org/bokeh/release/bokeh-1.3.4.min.js"></script>
20+
<script type="text/javascript">
21+
Bokeh.set_log_level("info");
22+
</script>
23+
24+
25+
26+
27+
</head>
28+
29+
30+
<body>
31+
32+
33+
34+
35+
36+
37+
<div class="bk-root" id="b8b0cd98-c7c9-465e-9ff9-8e5650eb729c" data-root-id="1002"></div>
38+
39+
40+
41+
42+
43+
<script type="application/json" id="1305">
44+
{"b8a7a6f1-42e7-4c4e-ae49-9f4ff95b90bc":{"roots":{"references":[{"attributes":{},"id":"1022","type":"WheelZoomTool"},{"attributes":{"months":[0,6]},"id":"1056","type":"MonthsTicker"},{"attributes":{"days":[1,8,15,22]},"id":"1051","type":"DaysTicker"},{"attributes":{},"id":"1021","type":"PanTool"},{"attributes":{"label":{"value":"Incendiary"},"renderers":[{"id":"1090","type":"GlyphRenderer"}]},"id":"1113","type":"LegendItem"},{"attributes":{"data_source":{"id":"1001","type":"ColumnDataSource"},"glyph":{"id":"1035","type":"Line"},"hover_glyph":null,"muted_glyph":null,"nonselection_glyph":{"id":"1036","type":"Line"},"selection_glyph":null,"view":{"id":"1038","type":"CDSView"}},"id":"1037","type":"GlyphRenderer"},{"attributes":{"months":[0,4,8]},"id":"1055","type":"MonthsTicker"},{"attributes":{},"id":"1007","type":"LinearScale"},{"attributes":{"line_color":"#ffffbf","line_width":2,"x":{"field":"MSNDATE"},"y":{"field":"TONS_FRAG"}},"id":"1061","type":"Line"},{"attributes":{"source":{"id":"1001","type":"ColumnDataSource"}},"id":"1091","type":"CDSView"},{"attributes":{"fill_alpha":{"value":0.2},"fill_color":{"value":"orange"},"left":-784684800000.0,"line_color":{"value":"black"},"line_dash":[6],"right":-800928000000.0},"id":"1115","type":"BoxAnnotation"},{"attributes":{},"id":"1042","type":"BasicTickFormatter"},{"attributes":{"months":[0,2,4,6,8,10]},"id":"1054","type":"MonthsTicker"},{"attributes":{"data_source":{"id":"1001","type":"ColumnDataSource"},"glyph":{"id":"1088","type":"Line"},"hover_glyph":null,"muted_glyph":null,"nonselection_glyph":{"id":"1089","type":"Line"},"selection_glyph":null,"view":{"id":"1091","type":"CDSView"}},"id":"1090","type":"GlyphRenderer"},{"attributes":{},"id":"1026","type":"HelpTool"},{"attributes":{},"id":"1072","type":"Selection"},{"attributes":{"formatter":{"id":"1044","type":"DatetimeTickFormatter"},"ticker":{"id":"1012","type":"DatetimeTicker"}},"id":"1011","type":"DatetimeAxis"},{"attributes":{"items":[{"id":"1059","type":"LegendItem"},{"id":"1086","type":"LegendItem"},{"id":"1113","type":"LegendItem"}],"location":"top_left"},"id":"1058","type":"Legend"},{"attributes":{"bottom_units":"screen","fill_alpha":{"value":0.5},"fill_color":{"value":"lightgrey"},"left_units":"screen","level":"overlay","line_alpha":{"value":1.0},"line_color":{"value":"black"},"line_dash":[4,4],"line_width":{"value":2},"render_mode":"css","right_units":"screen","top_units":"screen"},"id":"1045","type":"BoxAnnotation"},{"attributes":{"months":[0,1,2,3,4,5,6,7,8,9,10,11]},"id":"1053","type":"MonthsTicker"},{"attributes":{"base":60,"mantissas":[1,2,5,10,15,20,30],"max_interval":1800000.0,"min_interval":1000.0,"num_minor_ticks":0},"id":"1047","type":"AdaptiveTicker"},{"attributes":{"source":{"id":"1001","type":"ColumnDataSource"}},"id":"1038","type":"CDSView"},{"attributes":{"line_color":"#1f77b4","line_width":2,"x":{"field":"MSNDATE"},"y":{"field":"TOTAL_TONS"}},"id":"1035","type":"Line"},{"attributes":{"line_alpha":0.1,"line_color":"#1f77b4","line_width":2,"x":{"field":"MSNDATE"},"y":{"field":"TONS_IC"}},"id":"1089","type":"Line"},{"attributes":{"active_drag":"auto","active_inspect":"auto","active_multi":null,"active_scroll":"auto","active_tap":"auto","tools":[{"id":"1021","type":"PanTool"},{"id":"1022","type":"WheelZoomTool"},{"id":"1023","type":"BoxZoomTool"},{"id":"1024","type":"SaveTool"},{"id":"1025","type":"ResetTool"},{"id":"1026","type":"HelpTool"}]},"id":"1027","type":"Toolbar"},{"attributes":{},"id":"1025","type":"ResetTool"},{"attributes":{"line_alpha":0.1,"line_color":"#1f77b4","line_width":2,"x":{"field":"MSNDATE"},"y":{"field":"TONS_FRAG"}},"id":"1062","type":"Line"},{"attributes":{"mantissas":[1,2,5],"max_interval":500.0,"num_minor_ticks":0},"id":"1046","type":"AdaptiveTicker"},{"attributes":{"dimension":1,"ticker":{"id":"1017","type":"BasicTicker"}},"id":"1020","type":"Grid"},{"attributes":{},"id":"1071","type":"UnionRenderers"},{"attributes":{"days":[1,4,7,10,13,16,19,22,25,28]},"id":"1050","type":"DaysTicker"},{"attributes":{"days":[1,15]},"id":"1052","type":"DaysTicker"},{"attributes":{},"id":"1017","type":"BasicTicker"},{"attributes":{"source":{"id":"1001","type":"ColumnDataSource"}},"id":"1064","type":"CDSView"},{"attributes":{"line_color":"#fc8d59","line_width":2,"x":{"field":"MSNDATE"},"y":{"field":"TONS_IC"}},"id":"1088","type":"Line"},{"attributes":{},"id":"1024","type":"SaveTool"},{"attributes":{"axis_label":"Kilotons of Munitions Dropped","formatter":{"id":"1042","type":"BasicTickFormatter"},"ticker":{"id":"1017","type":"BasicTicker"}},"id":"1016","type":"LinearAxis"},{"attributes":{},"id":"1057","type":"YearsTicker"},{"attributes":{},"id":"1044","type":"DatetimeTickFormatter"},{"attributes":{"callback":null},"id":"1005","type":"DataRange1d"},{"attributes":{"base":24,"mantissas":[1,2,4,6,8,12],"max_interval":43200000.0,"min_interval":3600000.0,"num_minor_ticks":0},"id":"1048","type":"AdaptiveTicker"},{"attributes":{"below":[{"id":"1011","type":"DatetimeAxis"}],"center":[{"id":"1015","type":"Grid"},{"id":"1020","type":"Grid"},{"id":"1058","type":"Legend"},{"id":"1115","type":"BoxAnnotation"}],"left":[{"id":"1016","type":"LinearAxis"}],"renderers":[{"id":"1037","type":"GlyphRenderer"},{"id":"1063","type":"GlyphRenderer"},{"id":"1090","type":"GlyphRenderer"}],"title":{"id":"1039","type":"Title"},"toolbar":{"id":"1027","type":"Toolbar"},"x_range":{"id":"1003","type":"DataRange1d"},"x_scale":{"id":"1007","type":"LinearScale"},"y_range":{"id":"1005","type":"DataRange1d"},"y_scale":{"id":"1009","type":"LinearScale"}},"id":"1002","subtype":"Figure","type":"Plot"},{"attributes":{"ticker":{"id":"1012","type":"DatetimeTicker"}},"id":"1015","type":"Grid"},{"attributes":{"label":{"value":"All Munitions"},"renderers":[{"id":"1037","type":"GlyphRenderer"}]},"id":"1059","type":"LegendItem"},{"attributes":{"days":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]},"id":"1049","type":"DaysTicker"},{"attributes":{"text":"European Theater of Operations"},"id":"1039","type":"Title"},{"attributes":{},"id":"1009","type":"LinearScale"},{"attributes":{"data_source":{"id":"1001","type":"ColumnDataSource"},"glyph":{"id":"1061","type":"Line"},"hover_glyph":null,"muted_glyph":null,"nonselection_glyph":{"id":"1062","type":"Line"},"selection_glyph":null,"view":{"id":"1064","type":"CDSView"}},"id":"1063","type":"GlyphRenderer"},{"attributes":{"callback":null,"data":{"MSNDATE":{"__ndarray__":"AAAAdhK4acIAAIDRHaRpwgAAgI8XkmnCAAAA6yJ+acIAAAAS02ppwgAAgG3eVmnCAACAlI5DacIAAADwmS9pwgAAgEulG2nCAACAclUIacIAAADOYPRowgAAAPUQ4WjCAACAUBzNaMIAAACsJ7lowgAAAGohp2jCAACAxSyTaMIAAIDs3H9owgAAAEjoa2jCAAAAb5hYaMIAAIDKo0RowgAAACavMGjCAAAATV8daMIAAICoaglowgAAgM8a9mfCAAAAKybiZ8IAAICGMc5nwgAAAHmGu2fCAACA1JGnZ8IAAID7QZRnwgAAAFdNgGfCAAAAfv1sZ8IAAIDZCFlnwgAAADUURWfCAAAAXMQxZ8IAAIC3zx1nwgAAgN5/CmfCAAAAOov2ZsIAAICVluJmwgAAgFOQ0GbCAAAAr5u8ZsIAAADWS6lmwgAAgDFXlWbCAACAWAeCZsIAAAC0Em5mwgAAgA8eWmbCAACANs5GZsIAAACS2TJmwgAAALmJH2bCAACAFJULZsI=","dtype":"float64","shape":[49]},"TONS_FRAG":{"__ndarray__":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAx7q4jQbwRj8O1v85zJdnP3106spneV4/+4f029eBkz+jqgmi7gOQP/keLjnulLY/BIasbvWctD/6fmq8dJOIP/yp8dJNYoA/MzMzMzMzsz+q8dJNYhCoP9NNYhBYObQ/Tzv8NVmjvj9mZmZmZmbGP8HKoUW2870/GQRWDi2y1T8IrBxaZDuvP0Jg5dAi28k/mpmZmZmZ2T+JQWDl0CLbP7pJDAIrh7Y/bxKDwMqh3T9mZmZmZmbeP4XrUbgehds/eekmMQis1D/Jdr6fGi/hP2q8dJMYBOo/9ihcj8L14D+4HoXrUbjWP/hT46WbxPA/cT0K16Nw+T+6SQwCK4f8P9V46SYxCABA1XjpJjEI/j81XrpJDAIPQDMzMzMzMw5AF9nO91PjBkCwcmiR7XwAQDm0yHa+n+4/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKVyPwvUorD8=","dtype":"float64","shape":[49]},"TONS_IC":{"__ndarray__":"AAAAAAAAAAAAAAAAAAAAAEKasWg6O1k/AAAAAAAAAABLsDic+dV8Pxjshm2LMns/NmxblNkgcz9pHVVNEHVPP2pI3GPpQ0c/32xzY3rCYj9Wfa62Yn+JPziEKjV7oFU/kGtDxTh/Uz8AAAAAAAAAAAAAAAAAAAAAeekmMQisfD/6fmq8dJNoP9nO91PjpZs/exSuR+F6hD+cxCCwcmihPzvfT42XbpI/2c73U+Olmz/6fmq8dJN4P/p+arx0k3g/Gy/dJAaBlT9YObTIdr6/P5MYBFYOLbI/WmQ730+N1T+e76fGSzfbP+XQItv5ftQ/oBov3SQGxT9/arx0kxjEP166SQwCK8c/g8DKoUW2wz9xPQrXo3DlPxBYObTIduI/CtejcD0K7z8/NV66SQzyP+58PzVeuv0/LbKd76eGJkC+nxov3aQSQF66SQwCSzVAGy/dJAbBM0BaZDvfT01BQEw3iUFgZSxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA+n5qvHSTeD8=","dtype":"float64","shape":[49]},"TOTAL_TONS":{"__ndarray__":"YFRSJ6CJoD+y6nO1FfurPyvQJ/Ik6bo/YTJVMCqpYz/6Zpsb0xO2P5oIG55eKcM/PCKmRBK9yD8EFytqMA3RP7G61XPS+9Q/HG7A54cR0D9eTzv8NVndP3rpJjEIrPE/7XIR34lZ7T+amZmZmZnJP65H4XoUrt8/Gy/dJAaB7T9SuB6F61H0P28Sg8DKofg/73coCvSJ8j/HSzeJQeAIQKRwPQrXow5AVOOlm8QgCkDTTWIQWLkLQC/dJAaBFQxARrbz/dR4HEBMN4lBYKUaQAIrhxbZzh1A2VpfJLRVIkBy+Q/ptz8lQDXvOEVHsidAbJp3nKKzIEBzaJHtfB8eQEw3iUFgJRxAz2vsEtULI0AK16NwPYoeQKabxCCwQiNAJJf/kH7bJ0DkDwaee48sQGTfFcH/hjBA2OvdH+/NPkAyVTAqqU9AQHWm0HmNwUVAFwRWDi16RUDBL/Xzpv5HQDWAt0CCak5AO99PjZduoj8AAAAAAAAAAAAAAAAAAAAAtvP91Hjp3j8=","dtype":"float64","shape":[49]}},"selected":{"id":"1072","type":"Selection"},"selection_policy":{"id":"1071","type":"UnionRenderers"}},"id":"1001","type":"ColumnDataSource"},{"attributes":{"line_alpha":0.1,"line_color":"#1f77b4","line_width":2,"x":{"field":"MSNDATE"},"y":{"field":"TOTAL_TONS"}},"id":"1036","type":"Line"},{"attributes":{"num_minor_ticks":5,"tickers":[{"id":"1046","type":"AdaptiveTicker"},{"id":"1047","type":"AdaptiveTicker"},{"id":"1048","type":"AdaptiveTicker"},{"id":"1049","type":"DaysTicker"},{"id":"1050","type":"DaysTicker"},{"id":"1051","type":"DaysTicker"},{"id":"1052","type":"DaysTicker"},{"id":"1053","type":"MonthsTicker"},{"id":"1054","type":"MonthsTicker"},{"id":"1055","type":"MonthsTicker"},{"id":"1056","type":"MonthsTicker"},{"id":"1057","type":"YearsTicker"}]},"id":"1012","type":"DatetimeTicker"},{"attributes":{"label":{"value":"Fragmentation"},"renderers":[{"id":"1063","type":"GlyphRenderer"}]},"id":"1086","type":"LegendItem"},{"attributes":{"overlay":{"id":"1045","type":"BoxAnnotation"}},"id":"1023","type":"BoxZoomTool"},{"attributes":{"callback":null},"id":"1003","type":"DataRange1d"}],"root_ids":["1002"]},"title":"Bokeh Application","version":"1.3.4"}}
45+
</script>
46+
<script type="text/javascript">
47+
(function() {
48+
var fn = function() {
49+
Bokeh.safely(function() {
50+
(function(root) {
51+
function embed_document(root) {
52+
53+
var docs_json = document.getElementById('1305').textContent;
54+
var render_items = [{"docid":"b8a7a6f1-42e7-4c4e-ae49-9f4ff95b90bc","roots":{"1002":"b8b0cd98-c7c9-465e-9ff9-8e5650eb729c"}}];
55+
root.Bokeh.embed.embed_items(docs_json, render_items);
56+
57+
}
58+
if (root.Bokeh !== undefined) {
59+
embed_document(root);
60+
} else {
61+
var attempts = 0;
62+
var timer = setInterval(function(root) {
63+
if (root.Bokeh !== undefined) {
64+
embed_document(root);
65+
clearInterval(timer);
66+
}
67+
attempts++;
68+
if (attempts > 100) {
69+
console.log("Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing");
70+
clearInterval(timer);
71+
}
72+
}, 10, root)
73+
}
74+
})(window);
75+
});
76+
};
77+
if (document.readyState != "loading") fn();
78+
else document.addEventListener("DOMContentLoaded", fn);
79+
})();
80+
</script>
81+
82+
</body>
83+
84+
</html>

‎firstGraph.html

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
2+
3+
4+
5+
<!DOCTYPE html>
6+
<html lang="en">
7+
8+
<head>
9+
10+
<meta charset="utf-8">
11+
<title>Bokeh Plot</title>
12+
13+
14+
15+
16+
17+
18+
19+
<script type="text/javascript" src="https://cdn.pydata.org/bokeh/release/bokeh-1.3.4.min.js"></script>
20+
<script type="text/javascript">
21+
Bokeh.set_log_level("info");
22+
</script>
23+
24+
25+
26+
27+
</head>
28+
29+
30+
<body>
31+
32+
33+
34+
35+
36+
37+
<div class="bk-root" id="27d6b218-02cb-44f4-a4fe-4353a65b7bc7" data-root-id="1001"></div>
38+
39+
40+
41+
42+
43+
<script type="application/json" id="1196">
44+
{"a08445a2-71e3-461e-b2e1-978fa33b3df6":{"roots":{"references":[{"attributes":{"text":""},"id":"1038","type":"Title"},{"attributes":{"formatter":{"id":"1043","type":"BasicTickFormatter"},"ticker":{"id":"1011","type":"BasicTicker"}},"id":"1010","type":"LinearAxis"},{"attributes":{"source":{"id":"1062","type":"ColumnDataSource"}},"id":"1066","type":"CDSView"},{"attributes":{},"id":"1041","type":"BasicTickFormatter"},{"attributes":{},"id":"1011","type":"BasicTicker"},{"attributes":{},"id":"1075","type":"UnionRenderers"},{"attributes":{},"id":"1043","type":"BasicTickFormatter"},{"attributes":{"ticker":{"id":"1011","type":"BasicTicker"}},"id":"1014","type":"Grid"},{"attributes":{},"id":"1076","type":"Selection"},{"attributes":{"data_source":{"id":"1033","type":"ColumnDataSource"},"glyph":{"id":"1034","type":"Circle"},"hover_glyph":null,"muted_glyph":null,"nonselection_glyph":{"id":"1035","type":"Circle"},"selection_glyph":null,"view":{"id":"1037","type":"CDSView"}},"id":"1036","type":"GlyphRenderer"},{"attributes":{"callback":null,"data":{"x":[1,3,5,7],"y":[2,4,6,8]},"selected":{"id":"1059","type":"Selection"},"selection_policy":{"id":"1058","type":"UnionRenderers"}},"id":"1033","type":"ColumnDataSource"},{"attributes":{"source":{"id":"1033","type":"ColumnDataSource"}},"id":"1037","type":"CDSView"},{"attributes":{"bottom_units":"screen","fill_alpha":{"value":0.5},"fill_color":{"value":"lightgrey"},"left_units":"screen","level":"overlay","line_alpha":{"value":1.0},"line_color":{"value":"black"},"line_dash":[4,4],"line_width":{"value":2},"render_mode":"css","right_units":"screen","top_units":"screen"},"id":"1044","type":"BoxAnnotation"},{"attributes":{"label":{"value":"triangle"},"renderers":[{"id":"1065","type":"GlyphRenderer"}]},"id":"1078","type":"LegendItem"},{"attributes":{"formatter":{"id":"1041","type":"BasicTickFormatter"},"ticker":{"id":"1016","type":"BasicTicker"}},"id":"1015","type":"LinearAxis"},{"attributes":{"click_policy":"hide","items":[{"id":"1046","type":"LegendItem"},{"id":"1061","type":"LegendItem"},{"id":"1078","type":"LegendItem"}]},"id":"1045","type":"Legend"},{"attributes":{},"id":"1016","type":"BasicTicker"},{"attributes":{"below":[{"id":"1010","type":"LinearAxis"}],"center":[{"id":"1014","type":"Grid"},{"id":"1019","type":"Grid"},{"id":"1045","type":"Legend"}],"left":[{"id":"1015","type":"LinearAxis"}],"renderers":[{"id":"1036","type":"GlyphRenderer"},{"id":"1050","type":"GlyphRenderer"},{"id":"1065","type":"GlyphRenderer"}],"title":{"id":"1038","type":"Title"},"toolbar":{"id":"1026","type":"Toolbar"},"x_range":{"id":"1002","type":"DataRange1d"},"x_scale":{"id":"1006","type":"LinearScale"},"y_range":{"id":"1004","type":"DataRange1d"},"y_scale":{"id":"1008","type":"LinearScale"}},"id":"1001","subtype":"Figure","type":"Plot"},{"attributes":{"label":{"value":"circle"},"renderers":[{"id":"1036","type":"GlyphRenderer"}]},"id":"1046","type":"LegendItem"},{"attributes":{"dimension":1,"ticker":{"id":"1016","type":"BasicTicker"}},"id":"1019","type":"Grid"},{"attributes":{"callback":null,"data":{"x":[1,3,5,7],"y":[2,4,6,8]},"selected":{"id":"1076","type":"Selection"},"selection_policy":{"id":"1075","type":"UnionRenderers"}},"id":"1047","type":"ColumnDataSource"},{"attributes":{"active_drag":"auto","active_inspect":"auto","active_multi":null,"active_scroll":"auto","active_tap":"auto","tools":[{"id":"1020","type":"PanTool"},{"id":"1021","type":"WheelZoomTool"},{"id":"1022","type":"BoxZoomTool"},{"id":"1023","type":"SaveTool"},{"id":"1024","type":"ResetTool"},{"id":"1025","type":"HelpTool"}]},"id":"1026","type":"Toolbar"},{"attributes":{"fill_alpha":{"value":0.1},"fill_color":{"value":"#1f77b4"},"line_alpha":{"value":0.1},"line_color":{"value":"#1f77b4"},"size":{"units":"screen","value":10},"x":{"field":"x"},"y":{"field":"y"}},"id":"1035","type":"Circle"},{"attributes":{},"id":"1089","type":"UnionRenderers"},{"attributes":{"line_color":"blue","x":{"field":"x"},"y":{"field":"y"}},"id":"1048","type":"Line"},{"attributes":{},"id":"1090","type":"Selection"},{"attributes":{"line_alpha":0.1,"line_color":"#1f77b4","x":{"field":"x"},"y":{"field":"y"}},"id":"1049","type":"Line"},{"attributes":{},"id":"1020","type":"PanTool"},{"attributes":{"data_source":{"id":"1047","type":"ColumnDataSource"},"glyph":{"id":"1048","type":"Line"},"hover_glyph":null,"muted_glyph":null,"nonselection_glyph":{"id":"1049","type":"Line"},"selection_glyph":null,"view":{"id":"1051","type":"CDSView"}},"id":"1050","type":"GlyphRenderer"},{"attributes":{},"id":"1021","type":"WheelZoomTool"},{"attributes":{"source":{"id":"1047","type":"ColumnDataSource"}},"id":"1051","type":"CDSView"},{"attributes":{"callback":null},"id":"1002","type":"DataRange1d"},{"attributes":{"fill_color":{"value":"red"},"line_color":{"value":"red"},"size":{"units":"screen","value":10},"x":{"field":"x"},"y":{"field":"y"}},"id":"1034","type":"Circle"},{"attributes":{"overlay":{"id":"1044","type":"BoxAnnotation"}},"id":"1022","type":"BoxZoomTool"},{"attributes":{},"id":"1058","type":"UnionRenderers"},{"attributes":{},"id":"1023","type":"SaveTool"},{"attributes":{"callback":null},"id":"1004","type":"DataRange1d"},{"attributes":{},"id":"1059","type":"Selection"},{"attributes":{},"id":"1024","type":"ResetTool"},{"attributes":{"label":{"value":"line"},"renderers":[{"id":"1050","type":"GlyphRenderer"}]},"id":"1061","type":"LegendItem"},{"attributes":{},"id":"1025","type":"HelpTool"},{"attributes":{"callback":null,"data":{"x":[2,4,6,8],"y":[1,3,5,7]},"selected":{"id":"1090","type":"Selection"},"selection_policy":{"id":"1089","type":"UnionRenderers"}},"id":"1062","type":"ColumnDataSource"},{"attributes":{"fill_color":{"value":"gold"},"line_color":{"value":"gold"},"size":{"units":"screen","value":10},"x":{"field":"x"},"y":{"field":"y"}},"id":"1063","type":"Triangle"},{"attributes":{},"id":"1006","type":"LinearScale"},{"attributes":{"fill_alpha":{"value":0.1},"fill_color":{"value":"#1f77b4"},"line_alpha":{"value":0.1},"line_color":{"value":"#1f77b4"},"size":{"units":"screen","value":10},"x":{"field":"x"},"y":{"field":"y"}},"id":"1064","type":"Triangle"},{"attributes":{},"id":"1008","type":"LinearScale"},{"attributes":{"data_source":{"id":"1062","type":"ColumnDataSource"},"glyph":{"id":"1063","type":"Triangle"},"hover_glyph":null,"muted_glyph":null,"nonselection_glyph":{"id":"1064","type":"Triangle"},"selection_glyph":null,"view":{"id":"1066","type":"CDSView"}},"id":"1065","type":"GlyphRenderer"}],"root_ids":["1001"]},"title":"Bokeh Application","version":"1.3.4"}}
45+
</script>
46+
<script type="text/javascript">
47+
(function() {
48+
var fn = function() {
49+
Bokeh.safely(function() {
50+
(function(root) {
51+
function embed_document(root) {
52+
53+
var docs_json = document.getElementById('1196').textContent;
54+
var render_items = [{"docid":"a08445a2-71e3-461e-b2e1-978fa33b3df6","roots":{"1001":"27d6b218-02cb-44f4-a4fe-4353a65b7bc7"}}];
55+
root.Bokeh.embed.embed_items(docs_json, render_items);
56+
57+
}
58+
if (root.Bokeh !== undefined) {
59+
embed_document(root);
60+
} else {
61+
var attempts = 0;
62+
var timer = setInterval(function(root) {
63+
if (root.Bokeh !== undefined) {
64+
embed_document(root);
65+
clearInterval(timer);
66+
}
67+
attempts++;
68+
if (attempts > 100) {
69+
console.log("Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing");
70+
clearInterval(timer);
71+
}
72+
}, 10, root)
73+
}
74+
})(window);
75+
});
76+
};
77+
if (document.readyState != "loading") fn();
78+
else document.addEventListener("DOMContentLoaded", fn);
79+
})();
80+
</script>
81+
82+
</body>
83+
84+
</html>

‎firstPlot.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from bokeh.plotting import figure, output_file, show
2+
3+
output_file('firstGraph.html')
4+
5+
x = [1, 3, 5, 7]
6+
y = [2, 4, 6, 8]
7+
8+
p = figure()
9+
10+
p.circle(x, y, size=10, color='red', legend='circle')
11+
p.line(x, y, color='blue', legend='line')
12+
p.triangle(y, x, color='gold', size=10, legend='triangle')
13+
14+
p.legend.click_policy='hide'
15+
16+
show(p)
17+

‎louding_data.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import pandas as pd
2+
3+
df = pd.read_csv('thor_wwii.csv')
4+
print(df)
5+
6+
# see what the 19 columns are in full
7+
#print(df.columns.tolist())

‎mapping_targets.html

+84
Large diffs are not rendered by default.

‎monutions_by_country.py

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import pandas as pd
2+
from bokeh.plotting import figure, output_file, show
3+
from bokeh.models import ColumnDataSource
4+
from bokeh.models.tools import HoverTool
5+
6+
from bokeh.palettes import RdGy5 #@UnresolvedImport
7+
from bokeh.transform import factor_cmap
8+
output_file('munitions_by_country.html')
9+
10+
df = pd.read_csv('thor_wwii.csv')
11+
12+
grouped = df.groupby('COUNTRY_FLYING_MISSION')['TOTAL_TONS',
13+
'TONS_HE', 'TONS_IC', 'TONS_FRAG'].sum()
14+
# print(grouped)
15+
16+
grouped = grouped / 1000
17+
18+
source = ColumnDataSource(grouped)
19+
countries = source.data['COUNTRY_FLYING_MISSION'].tolist()
20+
p = figure(x_range=countries)
21+
22+
color_map = factor_cmap(field_name='COUNTRY_FLYING_MISSION',
23+
palette=RdGy5, factors=countries)
24+
25+
p.vbar(x='COUNTRY_FLYING_MISSION', top='TOTAL_TONS',
26+
source=source, width=0.70, color=color_map)
27+
28+
p.title.text = 'Munitions Droppen by Allied Country'
29+
p.xaxis.axis_label = 'Country'
30+
p.yaxis.axis_label = 'Kilotons of Munitions'
31+
32+
hover = HoverTool()
33+
hover.tooltips = [
34+
("Totals", "@TONS_HE High Explosive / @TONS_IC Incendiary / @TONS_FRAG Fragmentation")
35+
]
36+
37+
hover.mode = 'vline'
38+
39+
p.add_tools(hover)
40+
41+
show(p)
42+
43+
44+

‎munitions_by_country.html

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
2+
3+
4+
5+
<!DOCTYPE html>
6+
<html lang="en">
7+
8+
<head>
9+
10+
<meta charset="utf-8">
11+
<title>Bokeh Plot</title>
12+
13+
14+
15+
16+
17+
18+
19+
<script type="text/javascript" src="https://cdn.pydata.org/bokeh/release/bokeh-1.3.4.min.js"></script>
20+
<script type="text/javascript">
21+
Bokeh.set_log_level("info");
22+
</script>
23+
24+
25+
26+
27+
</head>
28+
29+
30+
<body>
31+
32+
33+
34+
35+
36+
37+
<div class="bk-root" id="a4c191b4-99c1-48fa-a43d-20edeb95e930" data-root-id="1002"></div>
38+
39+
40+
41+
42+
43+
<script type="application/json" id="1123">
44+
{"1775d92f-273d-4e7a-b6f1-0f7b701dfc98":{"roots":{"references":[{"attributes":{},"id":"1024","type":"ResetTool"},{"attributes":{},"id":"1016","type":"BasicTicker"},{"attributes":{},"id":"1025","type":"HelpTool"},{"attributes":{},"id":"1007","type":"CategoricalScale"},{"attributes":{"dimension":1,"ticker":{"id":"1016","type":"BasicTicker"}},"id":"1019","type":"Grid"},{"attributes":{},"id":"1046","type":"BasicTickFormatter"},{"attributes":{"active_drag":"auto","active_inspect":"auto","active_multi":null,"active_scroll":"auto","active_tap":"auto","tools":[{"id":"1020","type":"PanTool"},{"id":"1021","type":"WheelZoomTool"},{"id":"1022","type":"BoxZoomTool"},{"id":"1023","type":"SaveTool"},{"id":"1024","type":"ResetTool"},{"id":"1025","type":"HelpTool"},{"id":"1040","type":"HoverTool"}]},"id":"1026","type":"Toolbar"},{"attributes":{"bottom_units":"screen","fill_alpha":{"value":0.5},"fill_color":{"value":"lightgrey"},"left_units":"screen","level":"overlay","line_alpha":{"value":1.0},"line_color":{"value":"black"},"line_dash":[4,4],"line_width":{"value":2},"render_mode":"css","right_units":"screen","top_units":"screen"},"id":"1048","type":"BoxAnnotation"},{"attributes":{},"id":"1044","type":"CategoricalTickFormatter"},{"attributes":{"fill_alpha":{"value":0.1},"fill_color":{"value":"#1f77b4"},"line_alpha":{"value":0.1},"line_color":{"value":"#1f77b4"},"top":{"field":"TOTAL_TONS"},"width":{"value":0.7},"x":{"field":"COUNTRY_FLYING_MISSION"}},"id":"1036","type":"VBar"},{"attributes":{"callback":null,"factors":["AUSTRALIA","GREAT BRITAIN","NEW ZEALAND","SOUTH AFRICA","USA"]},"id":"1003","type":"FactorRange"},{"attributes":{},"id":"1049","type":"Selection"},{"attributes":{"data_source":{"id":"1001","type":"ColumnDataSource"},"glyph":{"id":"1035","type":"VBar"},"hover_glyph":null,"muted_glyph":null,"nonselection_glyph":{"id":"1036","type":"VBar"},"selection_glyph":null,"view":{"id":"1038","type":"CDSView"}},"id":"1037","type":"GlyphRenderer"},{"attributes":{"callback":null,"data":{"COUNTRY_FLYING_MISSION":["AUSTRALIA","GREAT BRITAIN","NEW ZEALAND","SOUTH AFRICA","USA"],"TONS_FRAG":{"__ndarray__":"g/qWOV0Wkz+HFtnO91PzPwAAAAAAAAAAAAAAAAAAAAAgtYmT++lfQA==","dtype":"float64","shape":[5]},"TONS_HE":{"__ndarray__":"sOHplbIM3T/Du1zENyKLQB3Sb18HDhFAuB6F61G4jj+x4emV0keUQA==","dtype":"float64","shape":[5]},"TONS_IC":{"__ndarray__":"YAfOGVHaiz+kb9I0KCFqQB1aZDvfT8U/AAAAAAAAAACh1jTvOKlpQA==","dtype":"float64","shape":[5]},"TOTAL_TONS":{"__ndarray__":"LVvri4S23j/DFyZTZWKRQCzG+ZtQCAVAjJyFPe3whz+ny2Ji82WZQA==","dtype":"float64","shape":[5]}},"selected":{"id":"1049","type":"Selection"},"selection_policy":{"id":"1050","type":"UnionRenderers"}},"id":"1001","type":"ColumnDataSource"},{"attributes":{"below":[{"id":"1011","type":"CategoricalAxis"}],"center":[{"id":"1014","type":"Grid"},{"id":"1019","type":"Grid"}],"left":[{"id":"1015","type":"LinearAxis"}],"renderers":[{"id":"1037","type":"GlyphRenderer"}],"title":{"id":"1039","type":"Title"},"toolbar":{"id":"1026","type":"Toolbar"},"x_range":{"id":"1003","type":"FactorRange"},"x_scale":{"id":"1007","type":"CategoricalScale"},"y_range":{"id":"1005","type":"DataRange1d"},"y_scale":{"id":"1009","type":"LinearScale"}},"id":"1002","subtype":"Figure","type":"Plot"},{"attributes":{"factors":["AUSTRALIA","GREAT BRITAIN","NEW ZEALAND","SOUTH AFRICA","USA"],"palette":["#404040","#bababa","#ffffff","#f4a582","#ca0020"]},"id":"1033","type":"CategoricalColorMapper"},{"attributes":{},"id":"1050","type":"UnionRenderers"},{"attributes":{},"id":"1020","type":"PanTool"},{"attributes":{},"id":"1009","type":"LinearScale"},{"attributes":{"callback":null},"id":"1005","type":"DataRange1d"},{"attributes":{"source":{"id":"1001","type":"ColumnDataSource"}},"id":"1038","type":"CDSView"},{"attributes":{"axis_label":"Country","formatter":{"id":"1044","type":"CategoricalTickFormatter"},"ticker":{"id":"1012","type":"CategoricalTicker"}},"id":"1011","type":"CategoricalAxis"},{"attributes":{"text":"Munitions Droppen by Allied Country"},"id":"1039","type":"Title"},{"attributes":{},"id":"1021","type":"WheelZoomTool"},{"attributes":{"fill_color":{"field":"COUNTRY_FLYING_MISSION","transform":{"id":"1033","type":"CategoricalColorMapper"}},"line_color":{"field":"COUNTRY_FLYING_MISSION","transform":{"id":"1033","type":"CategoricalColorMapper"}},"top":{"field":"TOTAL_TONS"},"width":{"value":0.7},"x":{"field":"COUNTRY_FLYING_MISSION"}},"id":"1035","type":"VBar"},{"attributes":{},"id":"1012","type":"CategoricalTicker"},{"attributes":{"callback":null,"mode":"vline","tooltips":[["Totals","@TONS_HE High Explosive / @TONS_IC Incendiary / @TONS_FRAG Fragmentation"]]},"id":"1040","type":"HoverTool"},{"attributes":{"overlay":{"id":"1048","type":"BoxAnnotation"}},"id":"1022","type":"BoxZoomTool"},{"attributes":{"ticker":{"id":"1012","type":"CategoricalTicker"}},"id":"1014","type":"Grid"},{"attributes":{},"id":"1023","type":"SaveTool"},{"attributes":{"axis_label":"Kilotons of Munitions","formatter":{"id":"1046","type":"BasicTickFormatter"},"ticker":{"id":"1016","type":"BasicTicker"}},"id":"1015","type":"LinearAxis"}],"root_ids":["1002"]},"title":"Bokeh Application","version":"1.3.4"}}
45+
</script>
46+
<script type="text/javascript">
47+
(function() {
48+
var fn = function() {
49+
Bokeh.safely(function() {
50+
(function(root) {
51+
function embed_document(root) {
52+
53+
var docs_json = document.getElementById('1123').textContent;
54+
var render_items = [{"docid":"1775d92f-273d-4e7a-b6f1-0f7b701dfc98","roots":{"1002":"a4c191b4-99c1-48fa-a43d-20edeb95e930"}}];
55+
root.Bokeh.embed.embed_items(docs_json, render_items);
56+
57+
}
58+
if (root.Bokeh !== undefined) {
59+
embed_document(root);
60+
} else {
61+
var attempts = 0;
62+
var timer = setInterval(function(root) {
63+
if (root.Bokeh !== undefined) {
64+
embed_document(root);
65+
clearInterval(timer);
66+
}
67+
attempts++;
68+
if (attempts > 100) {
69+
console.log("Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing");
70+
clearInterval(timer);
71+
}
72+
}, 10, root)
73+
}
74+
})(window);
75+
});
76+
};
77+
if (document.readyState != "loading") fn();
78+
else document.addEventListener("DOMContentLoaded", fn);
79+
})();
80+
</script>
81+
82+
</body>
83+
84+
</html>

‎munitions_by_country_stacked.py

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import pandas as pd
2+
from bokeh.plotting import figure, output_file, show
3+
from bokeh.models import ColumnDataSource
4+
from bokeh.palettes import Spectral3 #@UnresolvedImport
5+
from bokeh.models.tools import HoverTool
6+
7+
8+
output_file('types_of_munitions.html')
9+
10+
df = pd.read_csv('thor_wwii.csv')
11+
12+
filter = df['COUNTRY_FLYING_MISSION'].isin(('USA','GREAT BRITAIN'))
13+
df = df[filter]
14+
15+
grouped = df.groupby('COUNTRY_FLYING_MISSION')['TONS_IC', 'TONS_FRAG', 'TONS_HE'].sum()
16+
17+
18+
#convert tons to kilotons again
19+
grouped = grouped / 1000
20+
21+
source = ColumnDataSource(grouped)
22+
countries = source.data['COUNTRY_FLYING_MISSION'].tolist()
23+
p = figure(x_range=countries)
24+
25+
p.vbar_stack(stackers=['TONS_FRAG', 'TONS_HE', 'TONS_IC'],
26+
x='COUNTRY_FLYING_MISSION', source=source,
27+
legend = ['High Explosive', 'Fragmentation', 'Incendiary'],
28+
width=0.5, color=Spectral3)
29+
30+
################## MADE BY ME ##################
31+
hover = HoverTool()
32+
hover.tooltips = [
33+
('Number of High Explosive', '@TONS_HE'),
34+
('Number of Fragmentation', '@TONS_FRAG'),
35+
('Number of Incendiary', '@TONS_IC')
36+
]
37+
p.add_tools(hover)
38+
#################################################
39+
40+
p.title.text ='Types of Munitions Dropped by Allied Country'
41+
p.legend.location = 'top_left'
42+
43+
p.xaxis.axis_label = 'Country'
44+
p.xgrid.grid_line_color = None #remove the x grid lines
45+
46+
p.yaxis.axis_label = 'Kilotons of Munitions'
47+
48+
show(p)
49+

‎my_first_timeseriesv1.py

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import pandas as pd
2+
from bokeh.plotting import figure, output_file, show
3+
from bokeh.models import ColumnDataSource
4+
from bokeh.palettes import Spectral3
5+
output_file('simple_timeseries_plot.html')
6+
7+
df = pd.read_csv('thor_wwii.csv')
8+
9+
#make sure MSNDATE is a datetime format
10+
df['MSNDATE'] = pd.to_datetime(df['MSNDATE'], format='%m/%d/%Y')
11+
12+
grouped = df.groupby('MSNDATE')['TOTAL_TONS', 'TONS_IC', 'TONS_FRAG'].sum()
13+
14+
grouped = grouped/1000
15+
16+
17+
source = ColumnDataSource(grouped)
18+
19+
p = figure(x_axis_type='datetime')
20+
21+
p.line(x='MSNDATE', y='TOTAL_TONS', line_width=2, source=source, legend='All Munitions')
22+
p.line(x='MSNDATE', y='TONS_FRAG', line_width=2, source=source, color=Spectral3[1], legend='Fragmentation')
23+
p.line(x='MSNDATE', y='TONS_IC', line_width=2, source=source, color=Spectral3[2], legend='Incendiary')
24+
25+
p.yaxis.axis_label = 'Kilotons of Munitions Dropped'
26+
p.legend.location = 'top_left'
27+
28+
show(p)

‎my_first_timeseriesv2.py

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import pandas as pd
2+
from bokeh.plotting import figure, output_file, show
3+
from bokeh.models import ColumnDataSource
4+
from bokeh.palettes import Spectral3
5+
output_file('simple_timeseries_plot.html')
6+
7+
df = pd.read_csv('thor_wwii.csv')
8+
9+
#make sure MSNDATE is a datetime format
10+
df['MSNDATE'] = pd.to_datetime(df['MSNDATE'], format='%m/%d/%Y')
11+
12+
grouped = df.groupby(pd.Grouper(key='MSNDATE', freq='M'))['TOTAL_TONS', 'TONS_IC', 'TONS_FRAG'].sum()
13+
14+
grouped = grouped / 1000
15+
16+
17+
source = ColumnDataSource(grouped)
18+
19+
p = figure(x_axis_type='datetime')
20+
21+
p.line(x='MSNDATE', y='TOTAL_TONS', line_width=2, source=source, legend='All Munitions')
22+
p.line(x='MSNDATE', y='TONS_FRAG', line_width=2, source=source, color=Spectral3[1], legend='Fragmentation')
23+
p.line(x='MSNDATE', y='TONS_IC', line_width=2, source=source, color=Spectral3[2], legend='Incendiary')
24+
25+
p.yaxis.axis_label = 'Kilotons of Munitions Dropped'
26+
p.legend.location = 'top_left'
27+
28+
show(p)

‎my_first_timeseriesv3.py

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import pandas as pd
2+
from bokeh.plotting import figure, output_file, show
3+
from bokeh.models import ColumnDataSource
4+
from datetime import datetime
5+
from bokeh.palettes import Spectral3 #@UnresolvedImport
6+
from bokeh.models import BoxAnnotation
7+
8+
output_file('eto_operations.html')
9+
10+
df = pd.read_csv('thor_wwii.csv')
11+
12+
#filter for the European Theater of Operations
13+
filter = df['THEATER']=='ETO'
14+
df = df[filter]
15+
16+
df['MSNDATE'] = pd.to_datetime(df['MSNDATE'], format='%m/%d/%Y')
17+
group = df.groupby(pd.Grouper(key='MSNDATE', freq='M'))['TOTAL_TONS', 'TONS_IC', 'TONS_FRAG'].sum()
18+
group = group / 1000
19+
20+
source = ColumnDataSource(group)
21+
22+
p = figure(x_axis_type="datetime")
23+
24+
p.line(x='MSNDATE', y='TOTAL_TONS', line_width=2, source=source, legend='All Munitions')
25+
p.line(x='MSNDATE', y='TONS_FRAG', line_width=2, source=source, color=Spectral3[1], legend='Fragmentation')
26+
p.line(x='MSNDATE', y='TONS_IC', line_width=2, source=source, color=Spectral3[2], legend='Incendiary')
27+
28+
p.title.text = 'European Theater of Operations'
29+
30+
p.yaxis.axis_label = 'Kilotons of Munitions Dropped'
31+
p.legend.location = 'top_left'
32+
33+
34+
######## , let’s highlight these trends using Bokeh’s annotation features. ###########
35+
36+
box_left = pd.to_datetime('6-6-1944')
37+
box_right = pd.to_datetime('16-12-1944')
38+
39+
box = BoxAnnotation(left=box_left, right=box_right,
40+
line_width=1, line_color='black', line_dash='dashed',
41+
fill_alpha=0.2, fill_color='orange')
42+
43+
p.add_layout(box)
44+
45+
46+
show(p)

‎my_first_timeseriesv4.py

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import pandas as pd
2+
from bokeh.plotting import figure, output_file, show
3+
from bokeh.models import ColumnDataSource
4+
from datetime import datetime
5+
from bokeh.palettes import Spectral3 #@UnresolvedImport
6+
from bokeh.models import BoxAnnotation
7+
8+
output_file('eto_operations.html')
9+
10+
df = pd.read_csv('thor_wwii.csv')
11+
12+
#filter for the European Theater of Operations
13+
filter = df['THEATER']=='PTO'
14+
df = df[filter]
15+
16+
df['MSNDATE'] = pd.to_datetime(df['MSNDATE'], format='%m/%d/%Y')
17+
group = df.groupby(pd.Grouper(key='MSNDATE', freq='M'))['TOTAL_TONS', 'TONS_IC', 'TONS_FRAG'].sum()
18+
group = group / 1000
19+
20+
source = ColumnDataSource(group)
21+
22+
p = figure(x_axis_type="datetime")
23+
24+
p.line(x='MSNDATE', y='TOTAL_TONS', line_width=2, source=source, legend='All Munitions')
25+
p.line(x='MSNDATE', y='TONS_FRAG', line_width=2, source=source, color=Spectral3[1], legend='Fragmentation')
26+
p.line(x='MSNDATE', y='TONS_IC', line_width=2, source=source, color=Spectral3[2], legend='Incendiary')
27+
28+
p.title.text = 'European Theater of Operations'
29+
30+
p.yaxis.axis_label = 'Kilotons of Munitions Dropped'
31+
p.legend.location = 'top_left'
32+
33+
34+
######## , let’s highlight these trends using Bokeh’s annotation features. ###########
35+
36+
box_left = pd.to_datetime('19-2-1945')
37+
box_right = pd.to_datetime('15-8-1944')
38+
39+
box = BoxAnnotation(left=box_left, right=box_right,
40+
line_width=1, line_color='black', line_dash='dashed',
41+
fill_alpha=0.2, fill_color='orange')
42+
43+
p.add_layout(box)
44+
45+
46+
show(p)

‎prueba.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from bokeh.io import show, output_file
2+
from bokeh.models import ColumnDataSource
3+
from bokeh.palettes import Spectral5
4+
from bokeh.plotting import figure
5+
6+
output_file("colormapped_bars.html")
7+
8+
fruits = ['Apples', 'Pears', 'Nectarines', 'Plums', 'Grapes', 'Strawberries']
9+
counts = [5, 3, 4, 2, 4, 6]
10+
11+
source = ColumnDataSource(data=dict(fruits=fruits, counts=counts, color=Spectral6))
12+
13+
p = figure(x_range=fruits, y_range=(0,9), plot_height=250, title="Fruit Counts",
14+
toolbar_location=None, tools="")
15+
16+
p.vbar(x='fruits', top='counts', width=0.9, color='color', legend="fruits", source=source)
17+
18+
p.xgrid.grid_line_color = None
19+
p.legend.orientation = "horizontal"
20+
p.legend.location = "top_center"
21+
22+
show(p)

‎simple_timeseries_plot.html

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
2+
3+
4+
5+
<!DOCTYPE html>
6+
<html lang="en">
7+
8+
<head>
9+
10+
<meta charset="utf-8">
11+
<title>Bokeh Plot</title>
12+
13+
14+
15+
16+
17+
18+
19+
<script type="text/javascript" src="https://cdn.pydata.org/bokeh/release/bokeh-1.3.4.min.js"></script>
20+
<script type="text/javascript">
21+
Bokeh.set_log_level("info");
22+
</script>
23+
24+
25+
26+
27+
</head>
28+
29+
30+
<body>
31+
32+
33+
34+
35+
36+
37+
<div class="bk-root" id="7c9891af-9ebf-482f-8244-b96e4c21f5cd" data-root-id="1002"></div>
38+
39+
40+
41+
42+
43+
<script type="application/json" id="1303">
44+
{"a280f661-37cc-41cd-953b-8a5ee0ffd66a":{"roots":{"references":[{"attributes":{"bottom_units":"screen","fill_alpha":{"value":0.5},"fill_color":{"value":"lightgrey"},"left_units":"screen","level":"overlay","line_alpha":{"value":1.0},"line_color":{"value":"black"},"line_dash":[4,4],"line_width":{"value":2},"render_mode":"css","right_units":"screen","top_units":"screen"},"id":"1045","type":"BoxAnnotation"},{"attributes":{"ticker":{"id":"1012","type":"DatetimeTicker"}},"id":"1015","type":"Grid"},{"attributes":{"data_source":{"id":"1001","type":"ColumnDataSource"},"glyph":{"id":"1061","type":"Line"},"hover_glyph":null,"muted_glyph":null,"nonselection_glyph":{"id":"1062","type":"Line"},"selection_glyph":null,"view":{"id":"1064","type":"CDSView"}},"id":"1063","type":"GlyphRenderer"},{"attributes":{"mantissas":[1,2,5],"max_interval":500.0,"num_minor_ticks":0},"id":"1046","type":"AdaptiveTicker"},{"attributes":{"axis_label":"Kilotons of Munitions Dropped","formatter":{"id":"1042","type":"BasicTickFormatter"},"ticker":{"id":"1017","type":"BasicTicker"}},"id":"1016","type":"LinearAxis"},{"attributes":{"source":{"id":"1001","type":"ColumnDataSource"}},"id":"1064","type":"CDSView"},{"attributes":{"base":60,"mantissas":[1,2,5,10,15,20,30],"max_interval":1800000.0,"min_interval":1000.0,"num_minor_ticks":0},"id":"1047","type":"AdaptiveTicker"},{"attributes":{},"id":"1017","type":"BasicTicker"},{"attributes":{},"id":"1084","type":"UnionRenderers"},{"attributes":{"base":24,"mantissas":[1,2,4,6,8,12],"max_interval":43200000.0,"min_interval":3600000.0,"num_minor_ticks":0},"id":"1048","type":"AdaptiveTicker"},{"attributes":{"dimension":1,"ticker":{"id":"1017","type":"BasicTicker"}},"id":"1020","type":"Grid"},{"attributes":{},"id":"1085","type":"Selection"},{"attributes":{"line_alpha":0.1,"line_color":"#1f77b4","line_width":2,"x":{"field":"MSNDATE"},"y":{"field":"TONS_FRAG"}},"id":"1062","type":"Line"},{"attributes":{"callback":null,"data":{"MSNDATE":{"__ndarray__":"AACArtzJa8IAAAAK6LVrwgAAADGYomvCAACAjKOOa8IAAADornprwgAAgNoDaGvCAAAANg9Ua8IAAABdv0BrwgAAgLjKLGvCAACA33oZa8IAAAA7hgVrwgAAgJaR8WrCAACAvUHeasIAAAAZTcpqwgAAAED9tmrCAACAmwijasIAAAD3E49qwgAAALUNfWrCAACAEBlpasIAAIA3yVVqwgAAAJPUQWrCAAAAuoQuasIAAIAVkBpqwgAAAHGbBmrCAAAAmEvzacIAAIDzVt9pwgAAgBoHzGnCAAAAdhK4acIAAIDRHaRpwgAAgI8XkmnCAAAA6yJ+acIAAAAS02ppwgAAgG3eVmnCAACAlI5DacIAAADwmS9pwgAAgEulG2nCAACAclUIacIAAADOYPRowgAAAPUQ4WjCAACAUBzNaMIAAACsJ7lowgAAAGohp2jCAACAxSyTaMIAAIDs3H9owgAAAEjoa2jCAAAAb5hYaMIAAIDKo0RowgAAACavMGjCAAAATV8daMIAAICoaglowgAAgM8a9mfCAAAAKybiZ8IAAICGMc5nwgAAAHmGu2fCAACA1JGnZ8IAAID7QZRnwgAAAFdNgGfCAAAAfv1sZ8IAAIDZCFlnwgAAADUURWfCAAAAXMQxZ8IAAIC3zx1nwgAAgN5/CmfCAAAAOov2ZsIAAICVluJmwgAAgFOQ0GbCAAAAr5u8ZsIAAADWS6lmwgAAgDFXlWbCAACAWAeCZsIAAAC0Em5mwgAAgA8eWmbCAACANs5GZsIAAACS2TJmwgAAALmJH2bCAACAFJULZsI=","dtype":"float64","shape":[76]},"TONS_FRAG":{"__ndarray__":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPyp8dJNYlA/AAAAAAAAAAAAAAAAAAAAAHsUrkfheoQ/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7FG4HoXrsT8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAx7q4jQbwRj+il1Est7R6Py5zuiwmNn8/FtS3zOmyzD/4oGez6nOVP1ioNc07zvY/zGyQSUbOBUDTakjcY+nPPwncupunOtQ/NbVsrS8S5D+f5Xlwd9b9P588LNSapgRA3BZlNsik+z/sUbgehev9PwRWDi2ynQNARrbz/dR4BkCiRbbz/dTyPxfZzvdT4wJAukkMAiuH/D/wp8ZLN4kKQBBYObTIdgtASOF6FK5HH0DXo3A9CtcWQEoMAiuHlh9ADi2yne/nJECmm8QgsLIyQG8Sg8DKoSpAJQaBlUMrMkC6SQwCK4cCQNEi2/l+ajJAI9v5fmq8CUCwcmiR7XwMQF66SQwCqxNAdZMYBFZuNkAv3SQGgXU4QGQ730+NlxFAPQrXo3A9B0CuR+F6FK4CQFyPwvUoXO8/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKVyPwvUorD8=","dtype":"float64","shape":[76]},"TONS_IC":{"__ndarray__":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/Knx0k1iUD8730+Nl26CPzMzMzMzM7M/8tJNYhBYuT+yne+nxku3P5zEILByaME/i2zn+6nxwj9oke18PzXiP+f7qfHSTdI/sp3vp8ZL1z/D9Shcj8LVP0K3lzRG6+A/s+HplbIM3T9tkElGzsLgP1pkO99PjeM/0SLb+X5q4D9mZmZmZmbWPx+F61G4HsU/TDeJQWDlwD8fhetRuB7FPx+i0R3EzmQ/y6FFtvP99D+FsYUgByX6P3Jyv0NRoPs/bdlaXyQUF0AIVWr2QGsBQGZmZmZmpgJAvAopP6k2CEBQYhBYOTQBQBqojH+fcek/fABSmzi59T+wA+eMKG0EQBtMw/ARcRlA+nlTkQpjFUDpt68D50wXQLkZbsDnBxpAb5nTZTGxH0DaOGItPgUjQIj029eB4yRAAAAAAADAIEBMN4lBYKUkQFg5tMh2/iZAiC09muoJL0C8dJMYBNYsQKAaL90khitAhetRuB69PEBI4XoUrg81QClcj8L1EDFAPQrXo3BdF0B/arx0k9g0QB+F61G4HjVAK4cW2c4XOUAdWmQ73/9CQFyPwvUo3CBA30+Nl25SKUAv3SQGgRUlQHnpJjEIjDpA30+Nl24CSUDXo3A9Cnc1QO58PzVeejVAyXa+nxrvM0D2KFyPwlVBQAaBlUOLbCxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA+n5qvHSTeD8=","dtype":"float64","shape":[76]},"TOTAL_TONS":{"__ndarray__":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHnpJjEIrJw//Knx0k1ioD8fnbryWZ7hP+kmMQisfBpANUbrqGoCBkCgGi/dJAYCQGg/UkSG1fo/2/l+arx08z8nMQisHFr4P+XQItv5/v8/ppvEILByAUCoxks3iUEHQIiiQJ/Ikw5AEugTeZLUFEAXMIFbd9MTQI5Yi08BcBRAWmQ730+NDUBg5dAi2/kLQC2yne+nxgBAImx4eqUsAECPdXEbDaAFQP37jAsHwvM/07zjFB1JEUBPO/w1WWMVQN8CCYofow1AsfShC+qbI0AWjErqBLQiQJMw0/av7BtA9wt2w7bFH0DdRgN4C6QbQBNwCFVq1hVAiD3t8NdkF0Dm49pQMT4kQAwyychZQDFAxv6ye/LoM0DKQQkzbfc5QEWjO4idWUJAvk1/9iNdREB8GcVySzNKQIQNT6+UNU1Ay6FFtvNLUEBWDi2ynVdHQKAaL90kfklA7+vAOSNaUkC4XWiu08ZXQIcuqG+ZgVhAvcEXJlNSYUDUhy6ob7dmQHt1jgHZPG5AnTOitLcpc0Dh6ZWyjBhxQPKYgcp4H3JAMkymCkb9a0AqIsMq3rZqQB8bgXhd/mhA0HmNXaILZ0DC+j+H+dRhQA39E1ysrWpAAuyjU1dwd0CiI7n8h71wQJzX2CWqG0dAON9PjZfWRUA0mIbhI55IQA5Pr5RlgE5AO99PjZduoj8AAAAAAAAAAAAAAAAAAAAAtvP91Hjp3j8=","dtype":"float64","shape":[76]}},"selected":{"id":"1085","type":"Selection"},"selection_policy":{"id":"1084","type":"UnionRenderers"}},"id":"1001","type":"ColumnDataSource"},{"attributes":{"days":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]},"id":"1049","type":"DaysTicker"},{"attributes":{"active_drag":"auto","active_inspect":"auto","active_multi":null,"active_scroll":"auto","active_tap":"auto","tools":[{"id":"1021","type":"PanTool"},{"id":"1022","type":"WheelZoomTool"},{"id":"1023","type":"BoxZoomTool"},{"id":"1024","type":"SaveTool"},{"id":"1025","type":"ResetTool"},{"id":"1026","type":"HelpTool"}]},"id":"1027","type":"Toolbar"},{"attributes":{"label":{"value":"Fragmentation"},"renderers":[{"id":"1063","type":"GlyphRenderer"}]},"id":"1086","type":"LegendItem"},{"attributes":{"days":[1,4,7,10,13,16,19,22,25,28]},"id":"1050","type":"DaysTicker"},{"attributes":{"line_color":"#1f77b4","line_width":2,"x":{"field":"MSNDATE"},"y":{"field":"TOTAL_TONS"}},"id":"1035","type":"Line"},{"attributes":{"line_alpha":0.1,"line_color":"#1f77b4","line_width":2,"x":{"field":"MSNDATE"},"y":{"field":"TOTAL_TONS"}},"id":"1036","type":"Line"},{"attributes":{"days":[1,8,15,22]},"id":"1051","type":"DaysTicker"},{"attributes":{"line_color":"#fc8d59","line_width":2,"x":{"field":"MSNDATE"},"y":{"field":"TONS_IC"}},"id":"1088","type":"Line"},{"attributes":{},"id":"1021","type":"PanTool"},{"attributes":{"callback":null},"id":"1003","type":"DataRange1d"},{"attributes":{"days":[1,15]},"id":"1052","type":"DaysTicker"},{"attributes":{"line_alpha":0.1,"line_color":"#1f77b4","line_width":2,"x":{"field":"MSNDATE"},"y":{"field":"TONS_IC"}},"id":"1089","type":"Line"},{"attributes":{},"id":"1042","type":"BasicTickFormatter"},{"attributes":{},"id":"1022","type":"WheelZoomTool"},{"attributes":{"months":[0,1,2,3,4,5,6,7,8,9,10,11]},"id":"1053","type":"MonthsTicker"},{"attributes":{"data_source":{"id":"1001","type":"ColumnDataSource"},"glyph":{"id":"1088","type":"Line"},"hover_glyph":null,"muted_glyph":null,"nonselection_glyph":{"id":"1089","type":"Line"},"selection_glyph":null,"view":{"id":"1091","type":"CDSView"}},"id":"1090","type":"GlyphRenderer"},{"attributes":{"overlay":{"id":"1045","type":"BoxAnnotation"}},"id":"1023","type":"BoxZoomTool"},{"attributes":{"months":[0,2,4,6,8,10]},"id":"1054","type":"MonthsTicker"},{"attributes":{"source":{"id":"1001","type":"ColumnDataSource"}},"id":"1091","type":"CDSView"},{"attributes":{},"id":"1024","type":"SaveTool"},{"attributes":{"months":[0,4,8]},"id":"1055","type":"MonthsTicker"},{"attributes":{},"id":"1025","type":"ResetTool"},{"attributes":{"months":[0,6]},"id":"1056","type":"MonthsTicker"},{"attributes":{},"id":"1026","type":"HelpTool"},{"attributes":{},"id":"1057","type":"YearsTicker"},{"attributes":{},"id":"1007","type":"LinearScale"},{"attributes":{"callback":null},"id":"1005","type":"DataRange1d"},{"attributes":{"items":[{"id":"1059","type":"LegendItem"},{"id":"1086","type":"LegendItem"},{"id":"1113","type":"LegendItem"}],"location":"top_left"},"id":"1058","type":"Legend"},{"attributes":{"label":{"value":"All Munitions"},"renderers":[{"id":"1037","type":"GlyphRenderer"}]},"id":"1059","type":"LegendItem"},{"attributes":{"data_source":{"id":"1001","type":"ColumnDataSource"},"glyph":{"id":"1035","type":"Line"},"hover_glyph":null,"muted_glyph":null,"nonselection_glyph":{"id":"1036","type":"Line"},"selection_glyph":null,"view":{"id":"1038","type":"CDSView"}},"id":"1037","type":"GlyphRenderer"},{"attributes":{"source":{"id":"1001","type":"ColumnDataSource"}},"id":"1038","type":"CDSView"},{"attributes":{"below":[{"id":"1011","type":"DatetimeAxis"}],"center":[{"id":"1015","type":"Grid"},{"id":"1020","type":"Grid"},{"id":"1058","type":"Legend"}],"left":[{"id":"1016","type":"LinearAxis"}],"renderers":[{"id":"1037","type":"GlyphRenderer"},{"id":"1063","type":"GlyphRenderer"},{"id":"1090","type":"GlyphRenderer"}],"title":{"id":"1040","type":"Title"},"toolbar":{"id":"1027","type":"Toolbar"},"x_range":{"id":"1003","type":"DataRange1d"},"x_scale":{"id":"1007","type":"LinearScale"},"y_range":{"id":"1005","type":"DataRange1d"},"y_scale":{"id":"1009","type":"LinearScale"}},"id":"1002","subtype":"Figure","type":"Plot"},{"attributes":{},"id":"1009","type":"LinearScale"},{"attributes":{"label":{"value":"Incendiary"},"renderers":[{"id":"1090","type":"GlyphRenderer"}]},"id":"1113","type":"LegendItem"},{"attributes":{"text":""},"id":"1040","type":"Title"},{"attributes":{"formatter":{"id":"1044","type":"DatetimeTickFormatter"},"ticker":{"id":"1012","type":"DatetimeTicker"}},"id":"1011","type":"DatetimeAxis"},{"attributes":{"line_color":"#ffffbf","line_width":2,"x":{"field":"MSNDATE"},"y":{"field":"TONS_FRAG"}},"id":"1061","type":"Line"},{"attributes":{},"id":"1044","type":"DatetimeTickFormatter"},{"attributes":{"num_minor_ticks":5,"tickers":[{"id":"1046","type":"AdaptiveTicker"},{"id":"1047","type":"AdaptiveTicker"},{"id":"1048","type":"AdaptiveTicker"},{"id":"1049","type":"DaysTicker"},{"id":"1050","type":"DaysTicker"},{"id":"1051","type":"DaysTicker"},{"id":"1052","type":"DaysTicker"},{"id":"1053","type":"MonthsTicker"},{"id":"1054","type":"MonthsTicker"},{"id":"1055","type":"MonthsTicker"},{"id":"1056","type":"MonthsTicker"},{"id":"1057","type":"YearsTicker"}]},"id":"1012","type":"DatetimeTicker"}],"root_ids":["1002"]},"title":"Bokeh Application","version":"1.3.4"}}
45+
</script>
46+
<script type="text/javascript">
47+
(function() {
48+
var fn = function() {
49+
Bokeh.safely(function() {
50+
(function(root) {
51+
function embed_document(root) {
52+
53+
var docs_json = document.getElementById('1303').textContent;
54+
var render_items = [{"docid":"a280f661-37cc-41cd-953b-8a5ee0ffd66a","roots":{"1002":"7c9891af-9ebf-482f-8244-b96e4c21f5cd"}}];
55+
root.Bokeh.embed.embed_items(docs_json, render_items);
56+
57+
}
58+
if (root.Bokeh !== undefined) {
59+
embed_document(root);
60+
} else {
61+
var attempts = 0;
62+
var timer = setInterval(function(root) {
63+
if (root.Bokeh !== undefined) {
64+
embed_document(root);
65+
clearInterval(timer);
66+
}
67+
attempts++;
68+
if (attempts > 100) {
69+
console.log("Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing");
70+
clearInterval(timer);
71+
}
72+
}, 10, root)
73+
}
74+
})(window);
75+
});
76+
};
77+
if (document.readyState != "loading") fn();
78+
else document.addEventListener("DOMContentLoaded", fn);
79+
})();
80+
</script>
81+
82+
</body>
83+
84+
</html>

‎target_locations.py

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import pandas as pd
2+
from bokeh.plotting import figure, output_file, show
3+
from bokeh.models import ColumnDataSource, Range1d
4+
from bokeh.layouts import layout
5+
from bokeh.palettes import Spectral3 #@UnresolvedImport
6+
from bokeh.tile_providers import CARTODBPOSITRON #@UnresolvedImport
7+
from pyproj import Proj, transform
8+
9+
output_file('mapping_targets.html')
10+
11+
#helper function to convert lat/long to easting/northing for mapping
12+
#this relies on functions from the pyproj library
13+
def LongLat_to_EN(long, lat):
14+
try:
15+
easting, northing = transform(
16+
Proj(init='epsg:4326'), Proj(init='epsg:3857'), long, lat)
17+
return easting, northing
18+
except:
19+
return None, None
20+
21+
df = pd.read_csv('thor_wwii.csv')
22+
23+
24+
#helper to convert all lat/long to webmercator and stores in new column
25+
df['E'], df['N'] = zip(*df.apply(lambda x: LongLat_to_EN(x['TGT_LONGITUDE'], x['TGT_LATITUDE']), axis=1))
26+
27+
28+
grouped = df.groupby(['E', 'N'])['TONS_IC', 'TONS_FRAG'].sum().reset_index()
29+
30+
filter = grouped['TONS_FRAG']!=0
31+
32+
grouped = grouped[filter]
33+
34+
source = ColumnDataSource(grouped)
35+
36+
left = -2150000
37+
right = 18000000
38+
bottom = -5300000
39+
top = 11000000
40+
41+
p = figure(x_range=Range1d(left, right), y_range=Range1d(bottom, top))
42+
43+
p.add_tile(CARTODBPOSITRON)
44+
p.circle(x='E', y='N', source=source, line_color='grey', fill_color='yellow')
45+
46+
p.axis.visible = False
47+
48+
show(p)

‎thor_wwii.csv

+178,282
Large diffs are not rendered by default.

‎types_of_munitions.html

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
2+
3+
4+
5+
<!DOCTYPE html>
6+
<html lang="en">
7+
8+
<head>
9+
10+
<meta charset="utf-8">
11+
<title>Bokeh Plot</title>
12+
13+
14+
15+
16+
17+
18+
19+
<script type="text/javascript" src="https://cdn.pydata.org/bokeh/release/bokeh-1.3.4.min.js"></script>
20+
<script type="text/javascript">
21+
Bokeh.set_log_level("info");
22+
</script>
23+
24+
25+
26+
27+
</head>
28+
29+
30+
<body>
31+
32+
33+
34+
35+
36+
37+
<div class="bk-root" id="025c7f2b-13c3-426d-9179-76f704fb9823" data-root-id="1002"></div>
38+
39+
40+
41+
42+
43+
<script type="application/json" id="1167">
44+
{"34bf1e66-670b-4f28-8dde-17cf3c60a846":{"roots":{"references":[{"attributes":{"text":"Types of Munitions Dropped by Allied Country"},"id":"1044","type":"Title"},{"attributes":{"overlay":{"id":"1050","type":"BoxAnnotation"}},"id":"1022","type":"BoxZoomTool"},{"attributes":{},"id":"1016","type":"BasicTicker"},{"attributes":{"bottom":{"expr":{"id":"1035","type":"Stack"}},"fill_alpha":{"value":0.1},"fill_color":{"value":"#1f77b4"},"line_alpha":{"value":0.1},"line_color":{"value":"#1f77b4"},"top":{"expr":{"id":"1036","type":"Stack"}},"width":{"value":0.5},"x":{"field":"COUNTRY_FLYING_MISSION"}},"id":"1055","type":"VBar"},{"attributes":{},"id":"1020","type":"PanTool"},{"attributes":{},"id":"1065","type":"UnionRenderers"},{"attributes":{"axis_label":"Country","formatter":{"id":"1049","type":"CategoricalTickFormatter"},"ticker":{"id":"1012","type":"CategoricalTicker"}},"id":"1011","type":"CategoricalAxis"},{"attributes":{"fields":["TONS_FRAG","TONS_HE","TONS_IC"]},"id":"1038","type":"Stack"},{"attributes":{"bottom":{"expr":{"id":"1033","type":"Stack"}},"fill_color":{"value":"#99d594"},"line_color":{"value":"#99d594"},"top":{"expr":{"id":"1034","type":"Stack"}},"width":{"value":0.5},"x":{"field":"COUNTRY_FLYING_MISSION"}},"id":"1040","type":"VBar"},{"attributes":{"fields":["TONS_FRAG","TONS_HE"]},"id":"1036","type":"Stack"},{"attributes":{"bottom":{"expr":{"id":"1035","type":"Stack"}},"fill_color":{"value":"#ffffbf"},"line_color":{"value":"#ffffbf"},"top":{"expr":{"id":"1036","type":"Stack"}},"width":{"value":0.5},"x":{"field":"COUNTRY_FLYING_MISSION"}},"id":"1054","type":"VBar"},{"attributes":{"below":[{"id":"1011","type":"CategoricalAxis"}],"center":[{"id":"1014","type":"Grid"},{"id":"1019","type":"Grid"},{"id":"1051","type":"Legend"}],"left":[{"id":"1015","type":"LinearAxis"}],"renderers":[{"id":"1042","type":"GlyphRenderer"},{"id":"1056","type":"GlyphRenderer"},{"id":"1071","type":"GlyphRenderer"}],"title":{"id":"1044","type":"Title"},"toolbar":{"id":"1026","type":"Toolbar"},"x_range":{"id":"1003","type":"FactorRange"},"x_scale":{"id":"1007","type":"CategoricalScale"},"y_range":{"id":"1005","type":"DataRange1d"},"y_scale":{"id":"1009","type":"LinearScale"}},"id":"1002","subtype":"Figure","type":"Plot"},{"attributes":{"data_source":{"id":"1001","type":"ColumnDataSource"},"glyph":{"id":"1040","type":"VBar"},"hover_glyph":null,"muted_glyph":null,"name":"TONS_FRAG","nonselection_glyph":{"id":"1041","type":"VBar"},"selection_glyph":null,"view":{"id":"1043","type":"CDSView"}},"id":"1042","type":"GlyphRenderer"},{"attributes":{"callback":null,"factors":["GREAT BRITAIN","USA"]},"id":"1003","type":"FactorRange"},{"attributes":{},"id":"1047","type":"BasicTickFormatter"},{"attributes":{"fields":["TONS_FRAG"]},"id":"1034","type":"Stack"},{"attributes":{"source":{"id":"1001","type":"ColumnDataSource"}},"id":"1057","type":"CDSView"},{"attributes":{"label":{"value":"Incendiary"},"renderers":[{"id":"1071","type":"GlyphRenderer"}]},"id":"1082","type":"LegendItem"},{"attributes":{"fields":["TONS_FRAG"]},"id":"1035","type":"Stack"},{"attributes":{"fields":["TONS_FRAG","TONS_HE"]},"id":"1037","type":"Stack"},{"attributes":{"fields":[]},"id":"1033","type":"Stack"},{"attributes":{},"id":"1025","type":"HelpTool"},{"attributes":{"axis_label":"Kilotons of Munitions","formatter":{"id":"1047","type":"BasicTickFormatter"},"ticker":{"id":"1016","type":"BasicTicker"}},"id":"1015","type":"LinearAxis"},{"attributes":{},"id":"1009","type":"LinearScale"},{"attributes":{},"id":"1024","type":"ResetTool"},{"attributes":{},"id":"1021","type":"WheelZoomTool"},{"attributes":{},"id":"1007","type":"CategoricalScale"},{"attributes":{"bottom":{"expr":{"id":"1037","type":"Stack"}},"fill_color":{"value":"#fc8d59"},"line_color":{"value":"#fc8d59"},"top":{"expr":{"id":"1038","type":"Stack"}},"width":{"value":0.5},"x":{"field":"COUNTRY_FLYING_MISSION"}},"id":"1069","type":"VBar"},{"attributes":{"data_source":{"id":"1001","type":"ColumnDataSource"},"glyph":{"id":"1069","type":"VBar"},"hover_glyph":null,"muted_glyph":null,"name":"TONS_IC","nonselection_glyph":{"id":"1070","type":"VBar"},"selection_glyph":null,"view":{"id":"1072","type":"CDSView"}},"id":"1071","type":"GlyphRenderer"},{"attributes":{"bottom_units":"screen","fill_alpha":{"value":0.5},"fill_color":{"value":"lightgrey"},"left_units":"screen","level":"overlay","line_alpha":{"value":1.0},"line_color":{"value":"black"},"line_dash":[4,4],"line_width":{"value":2},"render_mode":"css","right_units":"screen","top_units":"screen"},"id":"1050","type":"BoxAnnotation"},{"attributes":{"grid_line_color":null,"ticker":{"id":"1012","type":"CategoricalTicker"}},"id":"1014","type":"Grid"},{"attributes":{"label":{"value":"High Explosive"},"renderers":[{"id":"1042","type":"GlyphRenderer"}]},"id":"1052","type":"LegendItem"},{"attributes":{"callback":null,"tooltips":[["Number of High Explosive","@TONS_HE"],["Number of Fragmentation","@TONS_FRAG"],["Number of Incendiary","@TONS_IC"]]},"id":"1083","type":"HoverTool"},{"attributes":{},"id":"1023","type":"SaveTool"},{"attributes":{"source":{"id":"1001","type":"ColumnDataSource"}},"id":"1072","type":"CDSView"},{"attributes":{"label":{"value":"Fragmentation"},"renderers":[{"id":"1056","type":"GlyphRenderer"}]},"id":"1067","type":"LegendItem"},{"attributes":{"source":{"id":"1001","type":"ColumnDataSource"}},"id":"1043","type":"CDSView"},{"attributes":{"data_source":{"id":"1001","type":"ColumnDataSource"},"glyph":{"id":"1054","type":"VBar"},"hover_glyph":null,"muted_glyph":null,"name":"TONS_HE","nonselection_glyph":{"id":"1055","type":"VBar"},"selection_glyph":null,"view":{"id":"1057","type":"CDSView"}},"id":"1056","type":"GlyphRenderer"},{"attributes":{"callback":null},"id":"1005","type":"DataRange1d"},{"attributes":{"dimension":1,"ticker":{"id":"1016","type":"BasicTicker"}},"id":"1019","type":"Grid"},{"attributes":{},"id":"1012","type":"CategoricalTicker"},{"attributes":{"callback":null,"data":{"COUNTRY_FLYING_MISSION":["GREAT BRITAIN","USA"],"TONS_FRAG":{"__ndarray__":"hxbZzvdT8z8gtYmT++lfQA==","dtype":"float64","shape":[2]},"TONS_HE":{"__ndarray__":"w7tcxDcii0Cx4emV0keUQA==","dtype":"float64","shape":[2]},"TONS_IC":{"__ndarray__":"pG/SNCghakCh1jTvOKlpQA==","dtype":"float64","shape":[2]}},"selected":{"id":"1066","type":"Selection"},"selection_policy":{"id":"1065","type":"UnionRenderers"}},"id":"1001","type":"ColumnDataSource"},{"attributes":{"bottom":{"expr":{"id":"1033","type":"Stack"}},"fill_alpha":{"value":0.1},"fill_color":{"value":"#1f77b4"},"line_alpha":{"value":0.1},"line_color":{"value":"#1f77b4"},"top":{"expr":{"id":"1034","type":"Stack"}},"width":{"value":0.5},"x":{"field":"COUNTRY_FLYING_MISSION"}},"id":"1041","type":"VBar"},{"attributes":{"bottom":{"expr":{"id":"1037","type":"Stack"}},"fill_alpha":{"value":0.1},"fill_color":{"value":"#1f77b4"},"line_alpha":{"value":0.1},"line_color":{"value":"#1f77b4"},"top":{"expr":{"id":"1038","type":"Stack"}},"width":{"value":0.5},"x":{"field":"COUNTRY_FLYING_MISSION"}},"id":"1070","type":"VBar"},{"attributes":{},"id":"1066","type":"Selection"},{"attributes":{"items":[{"id":"1052","type":"LegendItem"},{"id":"1067","type":"LegendItem"},{"id":"1082","type":"LegendItem"}],"location":"top_left"},"id":"1051","type":"Legend"},{"attributes":{},"id":"1049","type":"CategoricalTickFormatter"},{"attributes":{"active_drag":"auto","active_inspect":"auto","active_multi":null,"active_scroll":"auto","active_tap":"auto","tools":[{"id":"1020","type":"PanTool"},{"id":"1021","type":"WheelZoomTool"},{"id":"1022","type":"BoxZoomTool"},{"id":"1023","type":"SaveTool"},{"id":"1024","type":"ResetTool"},{"id":"1025","type":"HelpTool"},{"id":"1083","type":"HoverTool"}]},"id":"1026","type":"Toolbar"}],"root_ids":["1002"]},"title":"Bokeh Application","version":"1.3.4"}}
45+
</script>
46+
<script type="text/javascript">
47+
(function() {
48+
var fn = function() {
49+
Bokeh.safely(function() {
50+
(function(root) {
51+
function embed_document(root) {
52+
53+
var docs_json = document.getElementById('1167').textContent;
54+
var render_items = [{"docid":"34bf1e66-670b-4f28-8dde-17cf3c60a846","roots":{"1002":"025c7f2b-13c3-426d-9179-76f704fb9823"}}];
55+
root.Bokeh.embed.embed_items(docs_json, render_items);
56+
57+
}
58+
if (root.Bokeh !== undefined) {
59+
embed_document(root);
60+
} else {
61+
var attempts = 0;
62+
var timer = setInterval(function(root) {
63+
if (root.Bokeh !== undefined) {
64+
embed_document(root);
65+
clearInterval(timer);
66+
}
67+
attempts++;
68+
if (attempts > 100) {
69+
console.log("Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing");
70+
clearInterval(timer);
71+
}
72+
}, 10, root)
73+
}
74+
})(window);
75+
});
76+
};
77+
if (document.readyState != "loading") fn();
78+
else document.addEventListener("DOMContentLoaded", fn);
79+
})();
80+
</script>
81+
82+
</body>
83+
84+
</html>

0 commit comments

Comments
 (0)
Please sign in to comment.