JSONGrapher (python)
Imagine a world where a person can simply drag a data file into a graphing utility and a plot will be made -- including axes with the data's units. Imagine that data from data other sources (with other units) can then be dragged in for comparison, with all data plotted on an interactive graph. Imagine that the units of all of these datasets will be converted automatically, as needed, during the plotting.
Create interactive plots just by drag-and-drop of JSON records. Share the json files for easy plotting by others. JSONGrapher will automatically convert units between records to plot the data sets together, to enable comparisons. For example, if one record is in kg/s and another in g/s, JSONGrapher will do the conversion automatically to plot both records together, for comparison. Tools and examples are included for how to create JSON records.
To use python JSONGrapher, first install it using conda or pip:
pip install JSONGrapher[COMPLETE] or conda install conda-forge::jsongrapher
Alternatively, you can download the directory directly.
0. Plotting a JSON Record
To create an interactive plot, you just need one line of code!
Then drag an example JSONGrapher record into the window to plot! Below are example 2D and 3D plots.
Further below shows how easy it is to create your own json records.
import JSONGrapher; JSONGrapher.launch() # Then just drag records into the window!
1. Preparing to Create a Record
The remainder of this landing page follows a json record tutorial example which shows how to create graphable .json records. The records can then be plotted with python JSONGrapher or with jsongrapher.com
Let's create an example where we plot the height of a pear tree over several years.
Record = JSONRecordCreator.create_new_JSONGrapherRecord() x_label_including_units = "Time (years)" y_label_including_units = "Height (m)" time_in_years = [0, 1, 2, 3, 4] tree_heights = [0, 0.42, 0.86, 1.19, 1.45]
2. Populating the New JSONGrapher Record
Record.set_comments("Tree Growth Data collected from the US National Arboretum")
Record.set_datatype("Tree_Growth_Curve")
Record.set_x_axis_label_including_units(x_label_including_units)
Record.set_y_axis_label_including_units(y_label_including_units)
Record.add_data_series(series_name="pear tree growth", x_values=time_in_years, y_values=tree_heights, plot_type="scatter_spline")
Record.set_graph_title("Pear Tree Growth Versus Time")
3. Exporting to File
We can export a record to a .json file, which can then be used with JSONGrapher.
Record.export_to_json_file("ExampleFromTutorial.json")
Record.print_to_inspect()
Expected Output:
JSONGrapher Record exported to, ./ExampleFromTutorial.json
{
"comments": "Tree Growth Data collected from the US National Arboretum",
"datatype": "Tree_Growth_Curve",
"data": [
{
"name": "pear tree growth",
"x": [0, 1, 2, 3, 4],
"y": [0, 0.42, 0.86, 1.19, 1.45],
"type": "scatter",
"line": { "shape": "spline" }
}
],
"layout": {
"title": "Pear Tree Growth Versus Time",
"xaxis": { "title": "Time (year)" },
"yaxis": { "title": "Height (m)" }
}
}
4. Plotting to Inspect
We can plot the data with plotly, interact with the graph, and save as a png file.
Record.plot_with_plotly() #Try hovering your mouse over points after this command!
We can plot the data using Matplotlib and export the plot as a PNG file.
Record.plot_with_matplotlib()
Record.export_to_matplotlib_png("image_from_tutorial_matplotlib_fig")
You can also see more examples: https://github.com/AdityaSavara/jsongrapher-py/tree/main/Tutorials
Additionally, json records you send to others can be plotted by them at www.jsongrapher.com This 'see the plot using a browser' capability is intended to facilitate including JSONGrapher records in supporting information of scientific publications.
Contributing to JSONGrapher, Feature Suggestions, and Reporting Issues
These interactions should be through github at https://github.com/AdityaSavara/jsongrapher-py
To contribute to JSONGrapher, make a pull request with sufficient details about what issue you are trying to solve, and adequate commenting in your code to follow the logic. After that, be prepared for further communication if needed.
To suggest features, create a new issue under the issues tab.
To report issues, create a new issue under the issues tab.
Metadata
Release files for jsongrapher 5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jsongrapher-5.1.tar.gz | 113.1 kB | Without provenance | Details for jsongrapher-5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jsongrapher-5.1-py3-none-any.whl | Python 3 | none | any | Details for jsongrapher-5.1-py3-none-any.whl |
Total release size: 232.2 kB
Release files / jsongrapher-5.1.tar.gz
| Download URL | jsongrapher-5.1.tar.gz |
|---|---|
| Size | 113.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f9360bae6b54b7ea7c3f27abe1a7d52c8036419e9c92c309a3f831d80eeed0b4
|
|
BLAKE2b-256 checksum How to use checksums |
f964391d3f69c0fdc4d8f68ffbe7cbfa47426af202d4b48eb485899ef546dad7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|
Release files / jsongrapher-5.1-py3-none-any.whl
| Download URL | jsongrapher-5.1-py3-none-any.whl |
|---|---|
| Size | 119.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
330236c02dd5337b7b48ce6b89a62915039195aaeaef7957c444e0ce172fa29e
|
|
BLAKE2b-256 checksum How to use checksums |
b2d2c9a65f26e66d896d8032a4ee6e64ae6a464e7a9b4e7be312fcb1a79fb9d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|
Security for jsongrapher 5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.