jsongrapher 1.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- JSONGrapher/JSONRecordCreator.py +894 -0
- JSONGrapher/__init__.py +3 -0
- JSONGrapher/units_list.py +450 -0
- jsongrapher-1.6.data/data/LICENSE +24 -0
- jsongrapher-1.6.data/data/README.md +79 -0
- jsongrapher-1.6.dist-info/LICENSE +24 -0
- jsongrapher-1.6.dist-info/METADATA +101 -0
- jsongrapher-1.6.dist-info/RECORD +10 -0
- jsongrapher-1.6.dist-info/WHEEL +5 -0
- jsongrapher-1.6.dist-info/top_level.txt +1 -0
@@ -0,0 +1,101 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: jsongrapher
|
3
|
+
Version: 1.6
|
4
|
+
Summary: A python package for creating JSONGrapher Records.
|
5
|
+
Home-page: https://github.com/AdityaSavara/JSONGrapherRC
|
6
|
+
Author: Aditya Savara
|
7
|
+
Author-email: AditySavara2008@u.northwestern.edu
|
8
|
+
License: Unlicense
|
9
|
+
Classifier: License :: OSI Approved :: BSD License
|
10
|
+
Classifier: Programming Language :: Python
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
12
|
+
Classifier: Programming Language :: Python :: 3.6
|
13
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
14
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
15
|
+
Requires-Python: >=3.0.0
|
16
|
+
Description-Content-Type: text/markdown
|
17
|
+
License-File: LICENSE
|
18
|
+
Requires-Dist: numpy
|
19
|
+
Provides-Extra: complete
|
20
|
+
Requires-Dist: matplotlib; extra == "complete"
|
21
|
+
|
22
|
+
|
23
|
+
# JSONGrapherRC
|
24
|
+
A python package for creating JSONGrapher Records
|
25
|
+
|
26
|
+
To use JSONGrapherRC, first install it using pip:
|
27
|
+
<pre>
|
28
|
+
pip install JSONGrapherRC[COMPLETE]
|
29
|
+
</pre>
|
30
|
+
|
31
|
+
Alternatively, you can download the directory directly.<br>
|
32
|
+
It is easiest to then follow the [example file](https://github.com/AdityaSavara/JSONGrapherRC/blob/main/example/exampleUsageJSONRecordCreator.py) to learn.<br>
|
33
|
+
|
34
|
+
|
35
|
+
## **1\. Preparing to Create a Record**
|
36
|
+
|
37
|
+
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.
|
38
|
+
<pre>
|
39
|
+
x_label_including_units = "Time (years)"
|
40
|
+
y_label_including_units = "Height (m)"
|
41
|
+
time_in_years = [0, 1, 2, 3, 4]
|
42
|
+
tree_heights = [0, 0.42, 0.86, 1.19, 1.45]
|
43
|
+
</pre>
|
44
|
+
|
45
|
+
## **2\. Creating and Populating a New JSONGrapher Record**
|
46
|
+
|
47
|
+
The easiest way to start is with the `create_new_JSONGrapherRecord()` function. While you *can* instantiate the JSONGrapherRecord class directly, this function is generally more convenient. We'll create a record and inspect its default fields.
|
48
|
+
<pre>
|
49
|
+
try:
|
50
|
+
from JSONGRapherRC import JSONRecordCreator # Normal usage
|
51
|
+
except ImportError:
|
52
|
+
import JSONRecordCreator # If the class file is local
|
53
|
+
|
54
|
+
Record = JSONRecordCreator.create_new_JSONGrapherRecord()
|
55
|
+
Record.set_comments("Tree Growth Data collected from the US National Arboretum")
|
56
|
+
Record.set_datatype("Tree_Growth_Curve")
|
57
|
+
Record.set_x_axis_label_including_units(x_label_including_units)
|
58
|
+
Record.set_y_axis_label_including_units(y_label_including_units)
|
59
|
+
Record.add_data_series(series_name="pear tree growth", x_values=time_in_years, y_values=tree_heights, plot_type="scatter_spline")
|
60
|
+
Record.set_graph_title("Pear Tree Growth Versus Time")
|
61
|
+
</pre>
|
62
|
+
|
63
|
+
## **3\. Exporting to File**
|
64
|
+
|
65
|
+
We now have a JSONGrapher record! We can export it to a file, which can then be used with JSONGrapher.
|
66
|
+
<pre>
|
67
|
+
Record.export_to_json_file("ExampleFromTutorial.json")
|
68
|
+
Record.print_to_inspect()
|
69
|
+
</pre>
|
70
|
+
|
71
|
+
<p><strong>Expected Output:</strong></p>
|
72
|
+
<pre>
|
73
|
+
JSONGrapher Record exported to, ./ExampleFromTutorial.json
|
74
|
+
{
|
75
|
+
"comments": "Tree Growth Data collected from the US National Arboretum",
|
76
|
+
"datatype": "Tree_Growth_Curve",
|
77
|
+
"data": [
|
78
|
+
{
|
79
|
+
"name": "pear tree growth",
|
80
|
+
"x": [0, 1, 2, 3, 4],
|
81
|
+
"y": [0, 0.42, 0.86, 1.19, 1.45],
|
82
|
+
"type": "scatter",
|
83
|
+
"line": { "shape": "spline" }
|
84
|
+
}
|
85
|
+
],
|
86
|
+
"layout": {
|
87
|
+
"title": "Pear Tree Growth Versus Time",
|
88
|
+
"xaxis": { "title": "Time (year)" },
|
89
|
+
"yaxis": { "title": "Height (m)" }
|
90
|
+
}
|
91
|
+
}
|
92
|
+
</pre>
|
93
|
+
|
94
|
+
|
95
|
+
We can also plot the data using Matplotlib and export the plot as a PNG file.
|
96
|
+
<pre>
|
97
|
+
Record.plot_with_matplotlib()
|
98
|
+
Record.export_to_matplotlib_png("ExampleFromTutorial")
|
99
|
+
</pre>
|
100
|
+
|
101
|
+
[](https://raw.githubusercontent.com/AdityaSavara/JSONGrapherRC/main/example/ExampleFromTutorial.png)
|
@@ -0,0 +1,10 @@
|
|
1
|
+
JSONGrapher/JSONRecordCreator.py,sha256=_dfVxwy7itw3mUq7G_akyeup5KEy6KHXLeiINAzhHqg,45957
|
2
|
+
JSONGrapher/__init__.py,sha256=YvI9lnzN8e6jfCF--fuyiNZYq_YiVM72osipYjmWLAA,279
|
3
|
+
JSONGrapher/units_list.py,sha256=ARlPgvKWZM8um1FA7OtzDjnJhl0zy1X4vGbTQN93MnQ,33074
|
4
|
+
jsongrapher-1.6.data/data/LICENSE,sha256=KrPIO2Ij3T_47dfpfngKzpC4EXohIZMsHauG0R4M-kM,1234
|
5
|
+
jsongrapher-1.6.data/data/README.md,sha256=9UIVwsfi9CtLWzRFTnMiWvRiFf7MZLzmlWOpuOrj8e8,3036
|
6
|
+
jsongrapher-1.6.dist-info/LICENSE,sha256=KrPIO2Ij3T_47dfpfngKzpC4EXohIZMsHauG0R4M-kM,1234
|
7
|
+
jsongrapher-1.6.dist-info/METADATA,sha256=sLXqe5taldI3P4ASryDjexbue9uH8p2bY3Gnb3nZvHw,3913
|
8
|
+
jsongrapher-1.6.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
9
|
+
jsongrapher-1.6.dist-info/top_level.txt,sha256=5f7Ui2hCKCPTQOjD540WKghKNYOvUDNfdpnDbIlAD3Y,12
|
10
|
+
jsongrapher-1.6.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
JSONGrapher
|