{"id":19288360,"url":"https://github.com/techascent/tech.viz","last_synced_at":"2026-03-06T12:02:50.677Z","repository":{"id":43770960,"uuid":"236597711","full_name":"techascent/tech.viz","owner":"techascent","description":"A Clojure library for visualizing data.","archived":false,"fork":false,"pushed_at":"2022-12-05T20:16:44.000Z","size":386,"stargazers_count":31,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-22T05:22:20.130Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/techascent.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-27T21:20:49.000Z","updated_at":"2024-09-06T19:46:07.000Z","dependencies_parsed_at":"2023-01-23T09:16:12.984Z","dependency_job_id":null,"html_url":"https://github.com/techascent/tech.viz","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/techascent/tech.viz","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techascent%2Ftech.viz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techascent%2Ftech.viz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techascent%2Ftech.viz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techascent%2Ftech.viz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/techascent","download_url":"https://codeload.github.com/techascent/tech.viz/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techascent%2Ftech.viz/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30175901,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T11:48:51.886Z","status":"ssl_error","status_checked_at":"2026-03-06T11:48:51.460Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T22:08:48.162Z","updated_at":"2026-03-06T12:02:50.655Z","avatar_url":"https://github.com/techascent.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tech.viz\n\n\n[![Clojars Project](https://img.shields.io/clojars/v/techascent/tech.viz.svg)](https://clojars.org/techascent/tech.viz)\n\nSimple vega-based visualization of data.\n\n![spiral](images/scatterplot.svg)\n\n\n## Usage\n\n\nTypical expected usage below.  `tech.ml.dataset` is not necessary, it is just used\nfor processing data in this case.\n\n```clojure\nuser\u003e (require '[tech.viz.vega :as vega])\nnil\n\n;;functions take a sequence of maps as the first argument\nuser\u003e (vega/scatterplot [{:a 1 :b 2} {:a 2 :b 3}] :a :b)\n{:$schema \"https://vega.github.io/schema/vega/v5.json\",\n :autosize {:type \"fit\", :resize true, :contains \"padding\"},\n :width 800,\n :height 450,\n :axes\n [{:scale \"x\", :grid true, :orient \"bottom\", :title :a, :domain false}\n  {:scale \"y\", :grid true, :orient \"left\", :title :b, :domain false}],\n :scales\n ({:zero false,\n   :name \"x\",\n   :type \"linear\",\n   :round true,\n   :nice true,\n   :domain {:data \"source\", :field :a},\n   :range \"width\"}\n  {:zero false,\n   :name \"y\",\n   :type \"linear\",\n   :round true,\n   :nice true,\n   :domain {:data \"source\", :field :b},\n   :range \"height\"}),\n :marks\n [{:encode\n   {:update\n    {:fill {:value \"#222\"},\n     :stroke {:value \"#222\"},\n     :opacity {:value 0.5},\n     :shape {:value \"circle\"},\n     :x {:field :a, :scale \"x\"},\n     :y {:field :b, :scale \"y\"}}},\n   :from {:data \"source\"},\n   :type \"symbol\"}],\n :data [{:name \"source\", :values [{:a 1, :b 2} {:a 2, :b 3}]}]}\n\n\nuser\u003e (require '[tech.ml.dataset :as ds])\nnil\nuser\u003e (require '[tech.v2.datatype.datetime.operations :as dtype-dt-ops])\n\n\n;;Simple usage\nuser\u003e (ds/select (ds/-\u003edataset \"test/data/spiral-ds.csv\") :all (range 5))\ntest/data/spiral-ds.csv [5 3]:\n\n|     x |      y | label |\n|-------+--------+-------|\n| 0.041 |  0.075 | green |\n| 0.486 |  0.223 | green |\n| 0.543 | -0.749 | green |\n| 0.154 | -0.376 | green |\n| 0.434 | -0.805 | green |\nuser\u003e (-\u003e (ds/-\u003edataset \"test/data/spiral-ds.csv\")\n          (ds/mapseq-reader)\n          (vega/scatterplot \"x\" \"y\"\n                            {:title \"Spriral Dataset\"\n                             :label-key \"label\"\n                             :background \"white\"})\n          (vega/vega-\u003esvg-file \"scatterplot.svg\"))\n\n\n;; More involved data processing\nuser\u003e (ds/select (ds/-\u003edataset \"https://vega.github.io/vega/data/stocks.csv\")\n                 :all (range 5))\nhttps://vega.github.io/vega/data/stocks.csv [5 3]:\n\n| symbol |       date |  price |\n|--------+------------+--------|\n|   MSFT | 2000-01-01 | 39.810 |\n|   MSFT | 2000-02-01 | 36.350 |\n|   MSFT | 2000-03-01 | 43.220 |\n|   MSFT | 2000-04-01 | 28.370 |\n|   MSFT | 2000-05-01 | 25.450 |\nuser\u003e (as-\u003e (ds/-\u003edataset \"https://vega.github.io/vega/data/stocks.csv\") ds\n      ;;The time series chart expects time in epoch milliseconds\n      (ds/add-or-update-column ds \"year\" (dtype-dt-ops/get-years (ds \"date\")))\n      (ds/filter-column #{2007 2008 2009} \"year\" ds)\n      (ds/update-column ds \"date\" dtype-dt-ops/get-epoch-milliseconds)\n      (ds/mapseq-reader ds)\n\t  ;;all graphing functions run from pure clojure data.  No batteries required.\n      (vega/time-series ds \"date\" \"price\"\n                        {:title \"Stock Price (2007-2010)\"\n                         :label-key \"symbol\"\n                         :background \"white\"})\n      (vega/vega-\u003esvg-file ds \"timeseries.svg\"))\nnil\n```\n\n![timeseries](images/timeseries.svg)\n\n---\n\n#### Iris pairs plot\n\nRaw data as a string:\n\n```clojure\n(def iris-raw-str* (delay (slurp \"https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data\")))\n```\n\nConverted to a sequence of maps:\n\n```clojure\n(def iris-mapseq\n  (-\u003e\u003e @iris-raw-str*\n       (clojure.string/split-lines)\n       (map #(clojure.string/split % #\"\\,\"))\n       (map (fn [[sl sw pl pw class]]\n              {:sepal-length (Double. sl)\n               :sepal-width (Double. sw)\n               :petal-length (Double. pl)\n               :petal-width (Double. pw)\n               :class class}))))\n```\n\nAnd saved as an svg:\n\n```clojure\n(let [spec (pairs iris-mapseq\n                  [:sepal-length :sepal-width :petal-length :petal-width]\n                  {:label-key :class\n                   :background :#f8f8f8})]\n  (clojure.pprint/pprint spec)\n  (vega-\u003esvg-file spec \"iris-pairs.svg\"))\n```\n\n![pairs](images/pairs.svg)\n\n## Deploying\n\n`CLOJARS_USERNAME=[your email] CLOJARS_PASSWORD=$(cat ~/.clojars-token) ./scripts/deploy`\n\n## License\n\nCopyright © 2022 TechAscent, LLC\n\nThis program and the accompanying materials are made available under the\nterms of the Eclipse Public License 2.0 which is available at\nhttp://www.eclipse.org/legal/epl-2.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechascent%2Ftech.viz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechascent%2Ftech.viz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechascent%2Ftech.viz/lists"}