JSONGrapherRC (JSONGrapher Record Creator)
A python package for creating JSONGrapher files which can then be plotted.
To use JSONGrapherRC, first install it using pip:
pip install JSONGrapherRC[COMPLETE]
Alternatively, you can download the directory directly.
It is easiest to then follow the example file to see how to create graphable .json records and to plot them. The .json files can then be dragged into www.jsongrapher.com
1. Preparing to Create a Record
Let's create an example where we plot the height of a pear tree over several years. Assuming a pear tree grows approximately 0.40 meters per year, we'll generate sample data with some variation.
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. Creating and Populating a New JSONGrapher Record
Record = JSONRecordCreator.create_new_JSONGrapherRecord()
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 it 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 also plot the data using Matplotlib and export the plot as a PNG file.
Record.plot_with_matplotlib()
Record.export_to_matplotlib_png("ExampleFromTutorial_matplotlib_fig")
And we can create an interactive graph with plotly:
Record.plot_with_plotly() #Try hovering your mouse over points after this command!
Metadata
Release files for jsongrapherrc 2.7
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 |
|---|---|---|---|---|
| jsongrapherrc-2.7.tar.gz | 39.4 kB | Without provenance | Details for jsongrapherrc-2.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jsongrapherrc-2.7-py3-none-any.whl | Python 3 | none | any | Details for jsongrapherrc-2.7-py3-none-any.whl |
Total release size: 81.3 kB
Release files / jsongrapherrc-2.7.tar.gz
| Download URL | jsongrapherrc-2.7.tar.gz |
|---|---|
| Size | 39.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
61a4facef82536ecea75967d633476742233a61c3be17d3fdd7302a3dad2d6bf
|
|
BLAKE2b-256 checksum How to use checksums |
33deb02dae0fdce4d37a784c012bff98a2d3fae0874e7edae8ed87d863b7c86d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|
Release files / jsongrapherrc-2.7-py3-none-any.whl
| Download URL | jsongrapherrc-2.7-py3-none-any.whl |
|---|---|
| Size | 41.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c06d53c4a2dd9e4da4b8b6b7280407bb0403fad5ea2718e247149081bc734ce4
|
|
BLAKE2b-256 checksum How to use checksums |
17fbae40cb3f0f97ab45b3033db66a839b6d2784cdb59091872acf186523614d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|
Security for jsongrapherrc 2.7
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.