diff --git a/geom.ipynb b/geom.ipynb new file mode 100644 index 0000000..67cfebd --- /dev/null +++ b/geom.ipynb @@ -0,0 +1,142 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "(require '[thi.ng.geom.viz.core :as viz]\n", + " '[thi.ng.geom.svg.core :as svg]\n", + " '[thi.ng.geom.core.vector :as v]\n", + " '[thi.ng.color.core :as col]\n", + " '[thi.ng.math.core :as m :refer [PI TWO_PI]]\n", + " '[clojupyter.misc.display :as display])" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "#'user/spec" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "\n", + "(defn export-viz\n", + " [spec]\n", + " (->> spec\n", + " (viz/svg-plot2d-cartesian)\n", + " (svg/svg {:width 985 :height 600})\n", + " (svg/serialize)))\n", + "\n", + "(def spec\n", + " {:x-axis (viz/log-axis\n", + " {:domain [1 201]\n", + " :range [50 (- 985 10)]\n", + " :pos 550})\n", + " :y-axis (viz/linear-axis\n", + " {:domain [0.1 100]\n", + " :range [550 20]\n", + " :major 10\n", + " :minor 5\n", + " :pos 50\n", + " :label-dist 15\n", + " :label-style {:text-anchor \"end\"}})\n", + " :grid {:attribs {:stroke \"#caa\"}\n", + " :minor-x true\n", + " :minor-y true}\n", + " :data [{:values (map (juxt identity #(Math/sqrt %)) (range 0 200 2))\n", + " :attribs {:fill \"#0af\" :stroke \"none\"}\n", + " :layout viz/svg-scatter-plot}\n", + " {:values (map (juxt identity #(m/random %)) (range 0 200 2))\n", + " :attribs {:fill \"none\" :stroke \"#f60\"}\n", + " :shape (viz/svg-triangle-down 6)\n", + " :layout viz/svg-scatter-plot}]})" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "(-> spec\n", + " (export-viz)\n", + " (display/make-html))" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "(-> spec\n", + " (assoc :y-axis (viz/log-axis\n", + " {:domain [0.1 101]\n", + " :range [550 20]\n", + " :pos 50\n", + " :label-dist 15\n", + " :label-style {:text-anchor \"end\"}}))\n", + " (export-viz)\n", + " (display/make-html))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Lein-Clojure", + "language": "clojure", + "name": "lein-clojure" + }, + "language_info": { + "file_extension": ".clj", + "mimetype": "text/x-clojure", + "name": "clojure", + "version": "1.9.0-RC1" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/highchart.ipynb b/highchart.ipynb index a7c8aaf..1052d3c 100644 --- a/highchart.ipynb +++ b/highchart.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -14,7 +14,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -23,7 +23,7 @@ "" ] }, - "execution_count": 2, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -34,7 +34,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -43,7 +43,7 @@ "#'user/plot-highchart" ] }, - "execution_count": 5, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -59,16 +59,16 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ - "