{"id":13704053,"url":"https://github.com/dgrtwo/gleam","last_synced_at":"2025-10-07T20:11:25.633Z","repository":{"id":15429992,"uuid":"18162527","full_name":"dgrtwo/gleam","owner":"dgrtwo","description":"Creating interactive visualizations with Python","archived":false,"fork":false,"pushed_at":"2023-02-16T16:24:38.000Z","size":2860,"stargazers_count":256,"open_issues_count":5,"forks_count":45,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-05-20T07:04:50.475Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dgrtwo.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2014-03-27T02:56:32.000Z","updated_at":"2025-03-24T21:39:28.000Z","dependencies_parsed_at":"2024-01-06T03:06:16.756Z","dependency_job_id":"c431f439-ea1b-408d-ba1c-ebdc0de0119b","html_url":"https://github.com/dgrtwo/gleam","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dgrtwo/gleam","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgrtwo%2Fgleam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgrtwo%2Fgleam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgrtwo%2Fgleam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgrtwo%2Fgleam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dgrtwo","download_url":"https://codeload.github.com/dgrtwo/gleam/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgrtwo%2Fgleam/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278838434,"owners_count":26054720,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-08-02T21:01:03.551Z","updated_at":"2025-10-07T20:11:25.601Z","avatar_url":"https://github.com/dgrtwo.png","language":"JavaScript","funding_links":[],"categories":["Planning Coding Resources"],"sub_categories":["Python"],"readme":"gleam\n=====\n\nGleam lets you build interactive web visualizations of data using Python: no knowledge of HTML or JS necessary! You can choose a number of inputs your users can control, then use any Python graphing library to create plots based on those inputs. Gleam puts it all together creates a web interface that lets anyone play with your data in real time. Now it's easier than ever to help others understand and interpret your data. Gleam was inspired by the [Shiny](http://www.rstudio.com/shiny/) package in R.\n\n[See here for a live demo](http://gleam-demo.herokuapp.com)! (You can find the code for the demo in [examples/baseball.py](examples/baseball.py)).\n\nExample\n---------\n\nLet's make an interactive visualization of a scatter plot. Here we'll have three inputs that can be controlled by the user:\n\n* The plot's title\n* What variable goes on the y axis\n* Whether we add a smoothing curve to the data\n\nStart by importing a few packages. Gleam uses the [wtforms](http://wtforms.readthedocs.org/en/latest/) package to provide form inputs. You can use any Python graphing package you want with Gleam, such as [matplotlib](http://matplotlib.org/), but we recommend the intuitive [ggplot](https://github.com/yhat/ggplot/).\n\n    from wtforms import fields\n    from ggplot import *\n\nThen import what you'll need from the gleam package:\n\n    from gleam import Page, panels\n\n### Inputs\n\nAn `Inputs` panel lets you specify the inputs that the user can control. Here, we add a string input for the title, a multiple choice select field for the Y-axis variable, and a checkbox for the smoother:\n\n    class ScatterInput(panels.Inputs):\n        title = fields.StringField(label=\"Title of plot:\")\n        yvar = fields.SelectField(label=\"Y axis\",\n                                  choices=[(\"beef\", \"Beef\"),\n                                           (\"pork\", \"Pork\")])\n        smoother = fields.BooleanField(label=\"Smoothing Curve\")\n\n### Output\n\nThe output is where your actual plotting goes. It comes in the form of a `plot` method, which takes an argument `inputs` containing the inputs from above. Here we use ggplot to make the plot, taking the arguments into consideration. (You could use *any* Python graphing packages in this function- the sky's the limit, as long as it creates a plot).\n\n    class ScatterPlot(panels.Plot):\n        name = \"Scatter\"\n\n        def plot(self, inputs):\n            p = ggplot(meat, aes(x='date', y=inputs.yvar))\n            if inputs.smoother:\n                p = p + stat_smooth(color=\"blue\")\n            p = p + geom_point() + ggtitle(inputs.title)\n            return p\n\n### Tying it together in a Page\n\nConstructing an HTML page to allow this control is as simple as combining the input and the output:\n\n    class ScatterPage(Page):\n        input = ScatterInput()\n        output = ScatterPlot()\n\n### Run the app\n\nYou can then run the app with:\n\n     ScatterPage.run()\n\nBy default, it will create a local server hosted at [http://127.0.0.1:5000/](http://127.0.0.1:5000/): you can visit it there to see your cool visualization, which will look something like this:\n\n![plot](http://i.imgur.com/aiEmxbw.png?1)\n\nTry changing the title, the Y axis selector, or try checking the box: you'll see the plot react in real time.\n\nYou can add more inputs to the ScatterInput class, and then use them to further customize the plot in the ScatterPlot class.\n\n*Enjoy!*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdgrtwo%2Fgleam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdgrtwo%2Fgleam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdgrtwo%2Fgleam/lists"}