jsongrapher 4.1__py3-none-any.whl → 4.2__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 +13 -10
- JSONGrapher/version.py +1 -1
- jsongrapher-4.2.data/data/README.md +118 -0
- {jsongrapher-4.1.dist-info → jsongrapher-4.2.dist-info}/METADATA +26 -22
- {jsongrapher-4.1.dist-info → jsongrapher-4.2.dist-info}/RECORD +9 -9
- jsongrapher-4.1.data/data/README.md +0 -114
- {jsongrapher-4.1.data → jsongrapher-4.2.data}/data/LICENSE.txt +0 -0
- {jsongrapher-4.1.dist-info → jsongrapher-4.2.dist-info}/LICENSE.txt +0 -0
- {jsongrapher-4.1.dist-info → jsongrapher-4.2.dist-info}/WHEEL +0 -0
- {jsongrapher-4.1.dist-info → jsongrapher-4.2.dist-info}/top_level.txt +0 -0
JSONGrapher/JSONRecordCreator.py
CHANGED
@@ -755,12 +755,13 @@ class JSONGrapherRecord:
|
|
755
755
|
self.fig_dict["data"].append(data_series_dict) #implied return.
|
756
756
|
return data_series_dict
|
757
757
|
|
758
|
-
def add_data_series_as_equation(self, series_name, x_values=None, y_values=None, equation_dict=None, evaluate_equations_as_added=True, comments="", trace_style="", uid="", line="", extra_fields=None):
|
758
|
+
def add_data_series_as_equation(self, series_name, graphical_dimensionality, x_values=None, y_values=None, equation_dict=None, evaluate_equations_as_added=True, comments="", trace_style="", uid="", line="", extra_fields=None):
|
759
759
|
"""
|
760
760
|
This is a way to add an equation that would be used to fill an x,y data series.
|
761
761
|
The equation will be a equation_dict of the json_equationer type
|
762
762
|
"""
|
763
763
|
# series_name: Name of the data series.
|
764
|
+
# graphical_dimensionality is the number of geometric dimensions, so should be either 2 or 3.
|
764
765
|
# x: List of x-axis values. Or similar structure.
|
765
766
|
# y: List of y-axis values. Or similar structure.
|
766
767
|
# equation_dict: This is the field for the equation_dict of json_equationer type
|
@@ -777,6 +778,7 @@ class JSONGrapherRecord:
|
|
777
778
|
y_values = []
|
778
779
|
if equation_dict is None:
|
779
780
|
equation_dict = {}
|
781
|
+
equation_dict["graphical_dimensionality"] = int(graphical_dimensionality)
|
780
782
|
|
781
783
|
x_values = list(x_values)
|
782
784
|
y_values = list(y_values)
|
@@ -1938,6 +1940,7 @@ def apply_plot_style_to_plotly_dict(fig_dict, plot_style=None):
|
|
1938
1940
|
if str(plot_style["layout_style"]).lower() != 'none': #take no action if received "None" or NoneType
|
1939
1941
|
if plot_style["layout_style"] == '': #in this case, we're going to use the default.
|
1940
1942
|
plot_style["layout_style"] = 'default'
|
1943
|
+
print("Warning: No layout_style provided and 'z' field found in first data series. For 'bubble' plots, it is recommended to set layout_style to 'default'. For 'mesh3d' graphs and 'scatter3d' graphs, it is recommended to set layout_style to 'default3d'. Set layout_style to 'none' or another layout_style to avoid this warning.")
|
1941
1944
|
fig_dict = remove_layout_style_from_plotly_dict(fig_dict=fig_dict)
|
1942
1945
|
fig_dict = apply_layout_style_to_plotly_dict(fig_dict=fig_dict, layout_style_to_apply=plot_style["layout_style"])
|
1943
1946
|
#Code logic for trace_styles_collection style.
|
@@ -3485,11 +3488,11 @@ def evaluate_equation_for_data_series_by_index(fig_dict, data_series_index, verb
|
|
3485
3488
|
data_dict_filled['equation'] = equation_dict_evaluated
|
3486
3489
|
data_dict_filled['x_label'] = data_dict_filled['equation']['x_variable']
|
3487
3490
|
data_dict_filled['y_label'] = data_dict_filled['equation']['y_variable']
|
3488
|
-
data_dict_filled['x'] = equation_dict_evaluated['x_points']
|
3489
|
-
data_dict_filled['y'] = equation_dict_evaluated['y_points']
|
3491
|
+
data_dict_filled['x'] = list(equation_dict_evaluated['x_points'])
|
3492
|
+
data_dict_filled['y'] = list(equation_dict_evaluated['y_points'])
|
3490
3493
|
if graphical_dimensionality == 3:
|
3491
3494
|
data_dict_filled['z_label'] = data_dict_filled['equation']['z_variable']
|
3492
|
-
data_dict_filled['z'] = equation_dict_evaluated['z_points']
|
3495
|
+
data_dict_filled['z'] = list(equation_dict_evaluated['z_points'])
|
3493
3496
|
#data_dict_filled may include "x_label" and/or "y_label". If it does, we'll need to check about scaling units.
|
3494
3497
|
if (("x_label" in data_dict_filled) or ("y_label" in data_dict_filled)) or ("z_label" in data_dict_filled):
|
3495
3498
|
#first, get the units that are in the layout of fig_dict so we know what to convert to.
|
@@ -3558,10 +3561,10 @@ def update_implicit_data_series_data(target_fig_dict, source_fig_dict, parallel_
|
|
3558
3561
|
# Use zip() when parallel_structure=True and lengths match
|
3559
3562
|
for target_series, source_series in zip(target_data_series, source_data_series):
|
3560
3563
|
if ("equation" in target_series) or ("simulate" in target_series):
|
3561
|
-
target_series["x"] = source_series.get("x", []) # Extract and apply "x" values
|
3562
|
-
target_series["y"] = source_series.get("y", []) # Extract and apply "y" values
|
3564
|
+
target_series["x"] = list(source_series.get("x", [])) # Extract and apply "x" values
|
3565
|
+
target_series["y"] = list(source_series.get("y", [])) # Extract and apply "y" values
|
3563
3566
|
if "z" in source_series:
|
3564
|
-
target_series["z"] = source_series.get("z", []) # Extract and apply "z" values
|
3567
|
+
target_series["z"] = list(source_series.get("z", [])) # Extract and apply "z" values
|
3565
3568
|
else:
|
3566
3569
|
# Match by name when parallel_structure=False or lengths differ
|
3567
3570
|
source_data_dict = {series["name"]: series for series in source_data_series if "name" in series}
|
@@ -3572,10 +3575,10 @@ def update_implicit_data_series_data(target_fig_dict, source_fig_dict, parallel_
|
|
3572
3575
|
|
3573
3576
|
if target_name in source_data_dict:
|
3574
3577
|
source_series = source_data_dict[target_name]
|
3575
|
-
target_series["x"] = source_series.get("x", []) # Extract and apply "x" values
|
3576
|
-
target_series["y"] = source_series.get("y", []) # Extract and apply "y" values
|
3578
|
+
target_series["x"] = list(source_series.get("x", [])) # Extract and apply "x" values
|
3579
|
+
target_series["y"] = list(source_series.get("y", [])) # Extract and apply "y" values
|
3577
3580
|
if "z" in source_series:
|
3578
|
-
target_series["z"] = source_series.get("z", []) # Extract and apply "z" values
|
3581
|
+
target_series["z"] = list(source_series.get("z", [])) # Extract and apply "z" values
|
3579
3582
|
return updated_fig_dict
|
3580
3583
|
|
3581
3584
|
|
JSONGrapher/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = '4.
|
1
|
+
__version__ = '4.2'
|
@@ -0,0 +1,118 @@
|
|
1
|
+
[](https://anaconda.org/conda-forge/jsongrapher) [](https://badge.fury.io/py/jsongrapher)
|
2
|
+
|
3
|
+
# JSONGrapher (python)
|
4
|
+
|
5
|
+
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.
|
6
|
+
|
7
|
+
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.
|
8
|
+
|
9
|
+
To use python JSONGrapher, first install it using conda or pip:<br>
|
10
|
+
`pip install JSONGrapher[COMPLETE]` or `conda install conda-forge::jsongrapher` <br>
|
11
|
+
Alternatively, you can download the directory directly.<br>
|
12
|
+
|
13
|
+
## **0\. Plotting a JSON Record**
|
14
|
+
To create an interactive plot, you just need one line of code! <br>
|
15
|
+
Then drag an [example](https://github.com/AdityaSavara/jsongrapher-py/tree/main/examples/example_1_drag_and_drop) JSONGrapher record into the window to plot! Below are example 2D and 3D plots. <br>
|
16
|
+
Further below shows how easy it is to create your own json records.
|
17
|
+
<pre>
|
18
|
+
import JSONGrapher; JSONGrapher.launch()
|
19
|
+
# Then just drag records into the window!
|
20
|
+
</pre>
|
21
|
+
|
22
|
+
<a href="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/JSONGrapherWindowShortened.gif"><img src="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/JSONGrapherWindowShortened.gif" width="20%"></a>
|
23
|
+
<a href="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/UAN_DTA_image.gif"><img src="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/UAN_DTA_image.gif" width="25%"></a>
|
24
|
+
<br>
|
25
|
+
<a href="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/Rate_Constant_mesh3d.gif"><img src="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/Rate_Constant_mesh3d.gif" width="35%"></a>
|
26
|
+
<a href="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/Rate_Constant_Scatter3d_example10.gif"><img src="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/Rate_Constant_Scatter3d_example10.gif" width="35%"></a>
|
27
|
+
<br>
|
28
|
+
<a href="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/Rate_Constant_bubble.gif"><img src="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/Rate_Constant_bubble.gif" width="35%"></a>
|
29
|
+
<a href="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/SrTiO3_rainbow_image.gif"><img src="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/SrTiO3_rainbow_image.gif" width="30%"></a>
|
30
|
+
<br><br>
|
31
|
+
<a href="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/O_OH_Scaling.gif"><img src="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/O_OH_Scaling.gif" width="50%"></a>
|
32
|
+
|
33
|
+
|
34
|
+
## **1\. Preparing to Create a Record**
|
35
|
+
|
36
|
+
The remainder of this landing page follows a json record tutorial [example file](https://github.com/AdityaSavara/jsongrapher-py/blob/main/examples/example_2_creating_records_and_using_styles/example_2_json_record_tutorial.py) which shows how to create graphable .json records. The records can then be plotted with python JSONGrapher or with jsongrapher.com<br>
|
37
|
+
|
38
|
+
Let's create an example where we plot the height of a pear tree over several years.
|
39
|
+
<pre>
|
40
|
+
Record = JSONRecordCreator.create_new_JSONGrapherRecord()
|
41
|
+
x_label_including_units = "Time (years)"
|
42
|
+
y_label_including_units = "Height (m)"
|
43
|
+
time_in_years = [0, 1, 2, 3, 4]
|
44
|
+
tree_heights = [0, 0.42, 0.86, 1.19, 1.45]
|
45
|
+
</pre>
|
46
|
+
|
47
|
+
## **2\. Populating the New JSONGrapher Record**
|
48
|
+
|
49
|
+
<pre>
|
50
|
+
Record.set_comments("Tree Growth Data collected from the US National Arboretum")
|
51
|
+
Record.set_datatype("Tree_Growth_Curve")
|
52
|
+
Record.set_x_axis_label_including_units(x_label_including_units)
|
53
|
+
Record.set_y_axis_label_including_units(y_label_including_units)
|
54
|
+
Record.add_data_series(series_name="pear tree growth", x_values=time_in_years, y_values=tree_heights, plot_type="scatter_spline")
|
55
|
+
Record.set_graph_title("Pear Tree Growth Versus Time")
|
56
|
+
</pre>
|
57
|
+
|
58
|
+
## **3\. Exporting to File**
|
59
|
+
|
60
|
+
We can export a record to a .json file, which can then be used with JSONGrapher.
|
61
|
+
<pre>
|
62
|
+
Record.export_to_json_file("ExampleFromTutorial.json")
|
63
|
+
Record.print_to_inspect()
|
64
|
+
</pre>
|
65
|
+
|
66
|
+
<p><strong>Expected Output:</strong></p>
|
67
|
+
<pre>
|
68
|
+
JSONGrapher Record exported to, ./ExampleFromTutorial.json
|
69
|
+
{
|
70
|
+
"comments": "Tree Growth Data collected from the US National Arboretum",
|
71
|
+
"datatype": "Tree_Growth_Curve",
|
72
|
+
"data": [
|
73
|
+
{
|
74
|
+
"name": "pear tree growth",
|
75
|
+
"x": [0, 1, 2, 3, 4],
|
76
|
+
"y": [0, 0.42, 0.86, 1.19, 1.45],
|
77
|
+
"type": "scatter",
|
78
|
+
"line": { "shape": "spline" }
|
79
|
+
}
|
80
|
+
],
|
81
|
+
"layout": {
|
82
|
+
"title": "Pear Tree Growth Versus Time",
|
83
|
+
"xaxis": { "title": "Time (year)" },
|
84
|
+
"yaxis": { "title": "Height (m)" }
|
85
|
+
}
|
86
|
+
}
|
87
|
+
</pre>
|
88
|
+
|
89
|
+
## **4\. Plotting to Inspect**
|
90
|
+
|
91
|
+
We can plot the data with plotly, interact with the graph, and save as a png file.
|
92
|
+
<pre>
|
93
|
+
Record.plot_with_plotly() #Try hovering your mouse over points after this command!
|
94
|
+
</pre>
|
95
|
+
<a href="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_2_creating_records_and_using_styles/image_from_tutorial_plotly_fig.png"><img src="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_2_creating_records_and_using_styles/image_from_tutorial_plotly_fig.png" width="40%"></a>
|
96
|
+
|
97
|
+
We can plot the data using Matplotlib and export the plot as a PNG file.
|
98
|
+
<pre>
|
99
|
+
Record.plot_with_matplotlib()
|
100
|
+
Record.export_to_matplotlib_png("image_from_tutorial_matplotlib_fig")
|
101
|
+
</pre>
|
102
|
+
<a href="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_2_creating_records_and_using_styles/image_from_tutorial_matplotlib_fig.png"><img src="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_2_creating_records_and_using_styles/image_from_tutorial_matplotlib_fig.png" width="40%"></a>
|
103
|
+
|
104
|
+
You can also see more examples: https://github.com/AdityaSavara/jsongrapher-py/tree/main/examples
|
105
|
+
|
106
|
+
Additionally, json records you send to others can be plotted by them at www.jsongrapher.com
|
107
|
+
This 'see the plot using a browser' capability is intended to facilitate including JSONGrapher records in supporting information of scientific publications.
|
108
|
+
|
109
|
+
|
110
|
+
## **Contributing to JSONGrapher, Feature Suggestions, and Reporting Issues**
|
111
|
+
|
112
|
+
These interactions should be through github at https://github.com/AdityaSavara/jsongrapher-py
|
113
|
+
|
114
|
+
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.
|
115
|
+
|
116
|
+
To suggest features, create a new issue under the issues tab.
|
117
|
+
|
118
|
+
To report issues, create a new issue under the issues tab.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: jsongrapher
|
3
|
-
Version: 4.
|
3
|
+
Version: 4.2
|
4
4
|
Summary: The python version of JSONGrapher with tools for creating JSONGrapher Records.
|
5
5
|
Home-page: https://github.com/AdityaSavara/jsongrapher-py
|
6
6
|
Author: Aditya Savara
|
@@ -29,29 +29,33 @@ Requires-Dist: json-equationer; extra == "complete"
|
|
29
29
|
|
30
30
|
# JSONGrapher (python)
|
31
31
|
|
32
|
-
Imagine a world where a person can simply drag a
|
32
|
+
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.
|
33
33
|
|
34
|
-
Create interactive plots just by drag-and-drop of JSON records. Share the json files for easy plotting by others. JSONGrapher
|
34
|
+
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.
|
35
35
|
|
36
36
|
To use python JSONGrapher, first install it using conda or pip:<br>
|
37
37
|
`pip install JSONGrapher[COMPLETE]` or `conda install conda-forge::jsongrapher` <br>
|
38
38
|
Alternatively, you can download the directory directly.<br>
|
39
39
|
|
40
40
|
## **0\. Plotting a JSON Record**
|
41
|
-
To create an interactive plot, you just need one line of code!
|
42
|
-
|
41
|
+
To create an interactive plot, you just need one line of code! <br>
|
42
|
+
Then drag an [example](https://github.com/AdityaSavara/jsongrapher-py/tree/main/examples/example_1_drag_and_drop) JSONGrapher record into the window to plot! Below are example 2D and 3D plots. <br>
|
43
|
+
Further below shows how easy it is to create your own json records.
|
43
44
|
<pre>
|
44
45
|
import JSONGrapher; JSONGrapher.launch()
|
46
|
+
# Then just drag records into the window!
|
45
47
|
</pre>
|
46
48
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
49
|
+
<a href="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/JSONGrapherWindowShortened.gif"><img src="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/JSONGrapherWindowShortened.gif" width="20%"></a>
|
50
|
+
<a href="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/UAN_DTA_image.gif"><img src="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/UAN_DTA_image.gif" width="25%"></a>
|
51
|
+
<br>
|
52
|
+
<a href="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/Rate_Constant_mesh3d.gif"><img src="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/Rate_Constant_mesh3d.gif" width="35%"></a>
|
53
|
+
<a href="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/Rate_Constant_Scatter3d_example10.gif"><img src="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/Rate_Constant_Scatter3d_example10.gif" width="35%"></a>
|
54
|
+
<br>
|
55
|
+
<a href="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/Rate_Constant_bubble.gif"><img src="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/Rate_Constant_bubble.gif" width="35%"></a>
|
56
|
+
<a href="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/SrTiO3_rainbow_image.gif"><img src="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/SrTiO3_rainbow_image.gif" width="30%"></a>
|
57
|
+
<br><br>
|
58
|
+
<a href="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/O_OH_Scaling.gif"><img src="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/O_OH_Scaling.gif" width="50%"></a>
|
55
59
|
|
56
60
|
|
57
61
|
## **1\. Preparing to Create a Record**
|
@@ -60,16 +64,16 @@ The remainder of this landing page follows a json record tutorial [example file]
|
|
60
64
|
|
61
65
|
Let's create an example where we plot the height of a pear tree over several years.
|
62
66
|
<pre>
|
67
|
+
Record = JSONRecordCreator.create_new_JSONGrapherRecord()
|
63
68
|
x_label_including_units = "Time (years)"
|
64
69
|
y_label_including_units = "Height (m)"
|
65
70
|
time_in_years = [0, 1, 2, 3, 4]
|
66
71
|
tree_heights = [0, 0.42, 0.86, 1.19, 1.45]
|
67
72
|
</pre>
|
68
73
|
|
69
|
-
## **2\.
|
74
|
+
## **2\. Populating the New JSONGrapher Record**
|
70
75
|
|
71
76
|
<pre>
|
72
|
-
Record = JSONRecordCreator.create_new_JSONGrapherRecord()
|
73
77
|
Record.set_comments("Tree Growth Data collected from the US National Arboretum")
|
74
78
|
Record.set_datatype("Tree_Growth_Curve")
|
75
79
|
Record.set_x_axis_label_including_units(x_label_including_units)
|
@@ -111,18 +115,18 @@ JSONGrapher Record exported to, ./ExampleFromTutorial.json
|
|
111
115
|
|
112
116
|
## **4\. Plotting to Inspect**
|
113
117
|
|
114
|
-
We can plot the data
|
118
|
+
We can plot the data with plotly, interact with the graph, and save as a png file.
|
115
119
|
<pre>
|
116
|
-
Record.
|
117
|
-
Record.export_to_matplotlib_png("image_from_tutorial_matplotlib_fig")
|
120
|
+
Record.plot_with_plotly() #Try hovering your mouse over points after this command!
|
118
121
|
</pre>
|
122
|
+
<a href="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_2_creating_records_and_using_styles/image_from_tutorial_plotly_fig.png"><img src="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_2_creating_records_and_using_styles/image_from_tutorial_plotly_fig.png" width="40%"></a>
|
119
123
|
|
120
|
-
We can
|
124
|
+
We can plot the data using Matplotlib and export the plot as a PNG file.
|
121
125
|
<pre>
|
122
|
-
Record.
|
126
|
+
Record.plot_with_matplotlib()
|
127
|
+
Record.export_to_matplotlib_png("image_from_tutorial_matplotlib_fig")
|
123
128
|
</pre>
|
124
|
-
|
125
|
-
[](https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_2_creating_records_and_using_styles/image_from_tutorial_matplotlib_fig.png)
|
129
|
+
<a href="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_2_creating_records_and_using_styles/image_from_tutorial_matplotlib_fig.png"><img src="https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_2_creating_records_and_using_styles/image_from_tutorial_matplotlib_fig.png" width="40%"></a>
|
126
130
|
|
127
131
|
You can also see more examples: https://github.com/AdityaSavara/jsongrapher-py/tree/main/examples
|
128
132
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
JSONGrapher/JSONRecordCreator.py,sha256=
|
1
|
+
JSONGrapher/JSONRecordCreator.py,sha256=Wu5gCafri9g4bAAcyAJwlAoTLkExx7ssxjnQYcuGPUg,215343
|
2
2
|
JSONGrapher/UnitPytesting.py,sha256=xizJ-2fg9C5oNMFJyfavbBLMusayE9KWQiYIRrQQd4A,4363
|
3
3
|
JSONGrapher/UnitpyCustomUnitsTesting.py,sha256=Rwq5p8HXN0FP54lRFgLTV0kgJ9TpcFaD3_C0MEOoEzw,1297
|
4
4
|
JSONGrapher/__init__.py,sha256=fA3R6paWq3uskiLe3OglQZY_uJOejZHMFKdyX0dXWjo,310
|
@@ -6,14 +6,14 @@ JSONGrapher/drag_and_drop_gui.py,sha256=-7QJHLhzadHotWhONH4inerMaZ_xuwoTQSMRF_MP
|
|
6
6
|
JSONGrapher/equation_creator.py,sha256=VFu6dFo-C0wDf1N3e0CyCBI-53cCUrp3oe0umdMLofs,17968
|
7
7
|
JSONGrapher/equation_evaluator.py,sha256=Cm7UK5vWa6fT0OylD9f22_eR8zUvxY_Sy_W6n6N9bew,37012
|
8
8
|
JSONGrapher/units_list.py,sha256=ROrlAsD66oPozZmOaE65xjNUEg3CxkSmA8iPE2_ihYI,34438
|
9
|
-
JSONGrapher/version.py,sha256=
|
9
|
+
JSONGrapher/version.py,sha256=bUff73G-qXNfPT8kDpDG9cWR4Adm49E9fp682pqJfbI,19
|
10
10
|
JSONGrapher/styles/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
11
|
JSONGrapher/styles/layout_styles_library.py,sha256=vGb1tE_ETY-Blj2frt8ddHA976ADFSCoabjzKn2ZNYU,3051
|
12
12
|
JSONGrapher/styles/trace_styles_collection_library.py,sha256=DUbbO8jTlhn2q-lOY1XYGkHV1RbJX-P5Z1SUCM0qo6M,5952
|
13
|
-
jsongrapher-4.
|
14
|
-
jsongrapher-4.
|
15
|
-
jsongrapher-4.
|
16
|
-
jsongrapher-4.
|
17
|
-
jsongrapher-4.
|
18
|
-
jsongrapher-4.
|
19
|
-
jsongrapher-4.
|
13
|
+
jsongrapher-4.2.data/data/LICENSE.txt,sha256=7Guw_pmj_H4sApnM7fld2L4HH6CP-3ZYdFoOXtHFx0Y,1489
|
14
|
+
jsongrapher-4.2.data/data/README.md,sha256=u9uRPF0T12Pl6M6qjEleXZoB41ye0VTQPCJpEdldwNU,8157
|
15
|
+
jsongrapher-4.2.dist-info/LICENSE.txt,sha256=7Guw_pmj_H4sApnM7fld2L4HH6CP-3ZYdFoOXtHFx0Y,1489
|
16
|
+
jsongrapher-4.2.dist-info/METADATA,sha256=SmJRCR_Mh6cYNpdGZnB1AsA8C-k-iBD8Cvd_PcFojCo,9231
|
17
|
+
jsongrapher-4.2.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
18
|
+
jsongrapher-4.2.dist-info/top_level.txt,sha256=5f7Ui2hCKCPTQOjD540WKghKNYOvUDNfdpnDbIlAD3Y,12
|
19
|
+
jsongrapher-4.2.dist-info/RECORD,,
|
@@ -1,114 +0,0 @@
|
|
1
|
-
[](https://anaconda.org/conda-forge/jsongrapher) [](https://badge.fury.io/py/jsongrapher)
|
2
|
-
|
3
|
-
# JSONGrapher (python)
|
4
|
-
|
5
|
-
Imagine a world where a person can simply drag a datafile into a graphing utility and a plot will be made, including scientific units, and more plots can be dragged in from data from other sources (and other units) to compare all of the data together, in an interactive graph.
|
6
|
-
|
7
|
-
Create interactive plots just by drag-and-drop of JSON records. Share the json files for easy plotting by others. JSONGrapher automatically plots multiple records together, for comparison, and will automaticlaly convert units between records to plot the data sets together. 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.
|
8
|
-
|
9
|
-
To use python JSONGrapher, first install it using conda or pip:<br>
|
10
|
-
`pip install JSONGrapher[COMPLETE]` or `conda install conda-forge::jsongrapher` <br>
|
11
|
-
Alternatively, you can download the directory directly.<br>
|
12
|
-
|
13
|
-
## **0\. Plotting a JSON Record**
|
14
|
-
To create an interactive plot, you just need one line of code! Then drag an [example](https://github.com/AdityaSavara/jsongrapher-py/tree/main/examples/example_1_drag_and_drop) JSONGrapher record into the window to plot!
|
15
|
-
Below are example 2D and 3D plots. Further below shows how easy it is to create your own json records.
|
16
|
-
<pre>
|
17
|
-
import JSONGrapher; JSONGrapher.launch()
|
18
|
-
</pre>
|
19
|
-
|
20
|
-
[](https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/JSONGrapher/JSONGrapherWindowShortened.png) [](https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/UAN_DTA_image.png)
|
21
|
-
|
22
|
-
[](https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/SrTiO3_rainbow_image.png)
|
23
|
-
[](https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/Rate_Constant_mesh3d.png)
|
24
|
-
[](https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/Rate_Constant_Scatter3d_example10.png)
|
25
|
-
[](https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_1_drag_and_drop/images/Rate_Constant_bubble.png)
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
## **1\. Preparing to Create a Record**
|
31
|
-
|
32
|
-
The remainder of this landing page follows a json record tutorial [example file](https://github.com/AdityaSavara/jsongrapher-py/blob/main/examples/example_2_creating_records_and_using_styles/example_2_json_record_tutorial.py) which shows how to create graphable .json records. The records can then be plotted with python JSONGrapher or with jsongrapher.com<br>
|
33
|
-
|
34
|
-
Let's create an example where we plot the height of a pear tree over several years.
|
35
|
-
<pre>
|
36
|
-
x_label_including_units = "Time (years)"
|
37
|
-
y_label_including_units = "Height (m)"
|
38
|
-
time_in_years = [0, 1, 2, 3, 4]
|
39
|
-
tree_heights = [0, 0.42, 0.86, 1.19, 1.45]
|
40
|
-
</pre>
|
41
|
-
|
42
|
-
## **2\. Creating and Populating a New JSONGrapher Record**
|
43
|
-
|
44
|
-
<pre>
|
45
|
-
Record = JSONRecordCreator.create_new_JSONGrapherRecord()
|
46
|
-
Record.set_comments("Tree Growth Data collected from the US National Arboretum")
|
47
|
-
Record.set_datatype("Tree_Growth_Curve")
|
48
|
-
Record.set_x_axis_label_including_units(x_label_including_units)
|
49
|
-
Record.set_y_axis_label_including_units(y_label_including_units)
|
50
|
-
Record.add_data_series(series_name="pear tree growth", x_values=time_in_years, y_values=tree_heights, plot_type="scatter_spline")
|
51
|
-
Record.set_graph_title("Pear Tree Growth Versus Time")
|
52
|
-
</pre>
|
53
|
-
|
54
|
-
## **3\. Exporting to File**
|
55
|
-
|
56
|
-
We can export a record to a .json file, which can then be used with JSONGrapher.
|
57
|
-
<pre>
|
58
|
-
Record.export_to_json_file("ExampleFromTutorial.json")
|
59
|
-
Record.print_to_inspect()
|
60
|
-
</pre>
|
61
|
-
|
62
|
-
<p><strong>Expected Output:</strong></p>
|
63
|
-
<pre>
|
64
|
-
JSONGrapher Record exported to, ./ExampleFromTutorial.json
|
65
|
-
{
|
66
|
-
"comments": "Tree Growth Data collected from the US National Arboretum",
|
67
|
-
"datatype": "Tree_Growth_Curve",
|
68
|
-
"data": [
|
69
|
-
{
|
70
|
-
"name": "pear tree growth",
|
71
|
-
"x": [0, 1, 2, 3, 4],
|
72
|
-
"y": [0, 0.42, 0.86, 1.19, 1.45],
|
73
|
-
"type": "scatter",
|
74
|
-
"line": { "shape": "spline" }
|
75
|
-
}
|
76
|
-
],
|
77
|
-
"layout": {
|
78
|
-
"title": "Pear Tree Growth Versus Time",
|
79
|
-
"xaxis": { "title": "Time (year)" },
|
80
|
-
"yaxis": { "title": "Height (m)" }
|
81
|
-
}
|
82
|
-
}
|
83
|
-
</pre>
|
84
|
-
|
85
|
-
## **4\. Plotting to Inspect**
|
86
|
-
|
87
|
-
We can plot the data using Matplotlib and export the plot as a PNG file.
|
88
|
-
<pre>
|
89
|
-
Record.plot_with_matplotlib()
|
90
|
-
Record.export_to_matplotlib_png("image_from_tutorial_matplotlib_fig")
|
91
|
-
</pre>
|
92
|
-
|
93
|
-
We can create an interactive graph with python plotly:
|
94
|
-
<pre>
|
95
|
-
Record.plot_with_plotly() #Try hovering your mouse over points after this command!
|
96
|
-
</pre>
|
97
|
-
|
98
|
-
[](https://raw.githubusercontent.com/AdityaSavara/JSONGrapher-py/main/examples/example_2_creating_records_and_using_styles/image_from_tutorial_matplotlib_fig.png)
|
99
|
-
|
100
|
-
You can also see more examples: https://github.com/AdityaSavara/jsongrapher-py/tree/main/examples
|
101
|
-
|
102
|
-
Additionally, json records you send to others can be plotted by them at www.jsongrapher.com
|
103
|
-
This 'see the plot using a browser' capability is intended to facilitate including JSONGrapher records in supporting information of scientific publications.
|
104
|
-
|
105
|
-
|
106
|
-
## **Contributing to JSONGrapher, Feature Suggestions, and Reporting Issues**
|
107
|
-
|
108
|
-
These interactions should be through github at https://github.com/AdityaSavara/jsongrapher-py
|
109
|
-
|
110
|
-
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.
|
111
|
-
|
112
|
-
To suggest features, create a new issue under the issues tab.
|
113
|
-
|
114
|
-
To report issues, create a new issue under the issues tab.
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|