Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#45 drop static plots #48

Merged
merged 4 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

* Plot components.
* Fixed Windows install script trying to install from offline wheels.
* Fixed issues related to using ARA on Mac.

### Removed

* Removed option for static plots.

## [0.9.3] 2024-06-18

Expand Down
33 changes: 8 additions & 25 deletions docs/documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -325,18 +325,15 @@ PlotContours
:width: 24

Plots the distribution contours for each pair of variables from the data in the dataset.
Launches an interactive plot in a browser.
Requires a dataset to be loaded.


**Inputs**

- **variables** *[List of (str)]* -- List of names of the variables to be plotted.
- **output_type** *(str)* -- Plot type: 'static' creates a bitmap image, 'interactive' launches an interactive plot in a browser.
- **plot** *(bool)* -- Set to True to (re-)create the plot.
- **scale** *(float)* -- Resize factor for the static plot.

**Outputs**

- **img** -- Bitmap image if output_type is 'static', otherwise None.

PlotContoursRequest
-------------------
Expand All @@ -346,18 +343,14 @@ PlotContoursRequest
:width: 24

Plots the requested and predicted values against the distribution contours for each pair of the corresponding variables.
Launches an interactive plot in a browser.
Requires a trained model to be loaded.


**Inputs**

- **request** *[List of (str)]* -- List of requested values, each formatted as a string with the following format: 'variable_name:value'.
- **output_type** *(str)* -- Plot type: 'static' creates a bitmap image, 'interactive' launches an interactive plot in a browser.
- **plot** *(bool)* -- Set to True to (re-)create the plot.
- **scale** *(float)* -- Resize factor for the static plot.

**Outputs**

- **img** -- Bitmap image if output_type is 'static', otherwise None.

PlotCorrelations
----------------
Expand All @@ -367,18 +360,13 @@ PlotCorrelations
:width: 24

Plots correlation matrix for the given variables from the data in the dataset.

Launches an interactive plot in a browser.
Requires a dataset to be loaded.

**Inputs**

- **variables** *[List of (str)]* -- List of names of the variables to be plotted.
- **output_type** *(str)* -- Plot type: 'static' creates a bitmap image, 'interactive' launches an interactive plot in a browser.
- **plot** *(bool)* -- Set to True to (re-)create the plot.
- **scale** *(float)* -- Resize factor for the static plot.

**Outputs**

- **img** -- Bitmap image if output_type is 'static', otherwise None.

PlotDistribution
----------------
Expand All @@ -388,18 +376,13 @@ PlotDistribution
:width: 24

Plots the distribution of the given variables from the data in the dataset.

Launches an interactive plot in a browser.
Requires a dataset to be loaded.

**Inputs**

- **variables** *[List of (str)]* -- List of names of the variables to be plotted.
- **output_type** *(str)* -- Plot type: 'static' creates a bitmap image, 'interactive' launches an interactive plot in a browser.
- **plot** *(bool)* -- Set to True to (re-)create the plot.
- **scale** *(float)* -- Resize factor for the static plot.

**Outputs**

- **img** -- Bitmap image if output_type is 'static', otherwise None.

ProjectSetup
------------
Expand Down
16 changes: 5 additions & 11 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,9 @@ Plotters
--------

Visual analysis of the dataset can give some additional insights on the design space.
**ARA** provides a selection of plot methods, which can output either a *static* bitmap image
(using ``PrevImg`` component from the `Bitmap+ <https://www.food4rhino.com/en/app/bitmap>`_ plugin)
or an *interactive* plot (opening in browser).
**ARA** provides a selection of plots as interactive graphics in a browser window.

- ``Plot Correlations`` -- produces a correlation matrix of the selected variables
- ``Plot Distribution`` -- plots distribution of each selected variable
- ``Plot Contours`` -- plots pair-wise joint distributions of the selected variables as contours


.. attention::

*static* mode is currently not supported on Mac.
- ``PlotCorrelations`` -- produces a correlation matrix of the selected variables
- ``PlotDistribution`` -- plots distribution of each selected variable
- ``PlotContours`` -- plots pair-wise joint distributions of the selected variables as contours
- ``PlotContoursRequest`` -- plots the requested and the generated values against the pair-wise joint distributions of the given variables.
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
aixd >=0.10.0
aixd >=0.11.0
compas >2,<3
flask
kaleido==0.1.0.post1; platform_system == "Windows"
8 changes: 2 additions & 6 deletions src/aixd_ara/components/ara_PlotContours/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@


if plot:
st[cid] = plot_contours(session_id(), variables, output_type) # if output_type interactive: will launch the plotly fig in browser
st[cid] = plot_contours(session_id(), variables, "interactive") # will launch the plotly fig in browser

if cid in st.keys():
print st[cid]
#TODO: add error msg here
if output_type == "static" and 'imgstr' in st[cid].keys():
imgstr = st[cid]['imgstr']
img = convert_str_to_bitmap(imgstr, scale)
print st[cid]
22 changes: 2 additions & 20 deletions src/aixd_ara/components/ara_PlotContours/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,13 @@
"typeHintID": "str",
"scriptParamAccess": 1
},
{
"name": "output_type",
"description": "Plot type: 'static' creates a bitmap image, 'interactive' launches an interactive plot in a browser.",
"typeHintID": "str",
"scriptParamAccess": 0
},
{
"name": "plot",
"description": "Set to True to (re-)create the plot.",
"typeHintID": "bool",
"scriptParamAccess": 0
},
{
"name": "scale",
"description": "Resize factor for the static plot.",
"typeHintID": "float",
"scriptParamAccess": 0
}
],

"outputParameters": [
{
"name": "img",
"description": "Bitmap image if output_type is 'static', otherwise None."
}
]
"outputParameters": []
}
}
}
8 changes: 2 additions & 6 deletions src/aixd_ara/components/ara_PlotContoursRequest/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@
variable_types = get_dataobject_types(session_id())["dataobject_types"]
request_dict = reformat_request(request, variable_types)
print request_dict
st[cid] = plot_contours_request(session_id(), request_dict, n_samples, output_type) # if output_type interactive: will launch the plotly fig in browser
st[cid] = plot_contours_request(session_id(), request_dict, n_samples, "interactive") # will launch the plotly fig in browser

if cid in st.keys():
print st[cid]
#TODO: add error msg here
if output_type == "static" and 'imgstr' in st[cid].keys():
imgstr = st[cid]['imgstr']
img = convert_str_to_bitmap(imgstr, scale)
print st[cid]
19 changes: 1 addition & 18 deletions src/aixd_ara/components/ara_PlotContoursRequest/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,13 @@
"typeHintID": "str",
"scriptParamAccess": 1
},
{
"name": "output_type",
"description": "Plot type: 'static' creates a bitmap image, 'interactive' launches an interactive plot in a browser.",
"typeHintID": "str",
"scriptParamAccess": 0
},
{
"name": "plot",
"description": "Set to True to (re-)create the plot.",
"typeHintID": "bool",
"scriptParamAccess": 0
},
{
"name": "scale",
"description": "Resize factor for the static plot.",
"typeHintID": "float",
"scriptParamAccess": 0
}
],
"outputParameters": [
{
"name": "img",
"description": "Bitmap image if output_type is 'static', otherwise None."
}
]
"outputParameters": []
}
}
10 changes: 2 additions & 8 deletions src/aixd_ara/components/ara_PlotCorrelations/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@


if plot:
st[cid] = plot_correlations(
session_id(), variables, output_type
) # if output_type interactive: will launch the plotly fig in browser
st[cid] = plot_correlations(session_id(), variables, "interactive") # will launch the plotly fig in browser

if cid in st.keys():
print(st[cid])
# TODO: add error msg here
if output_type == "static" and "imgstr" in st[cid].keys():
imgstr = st[cid]["imgstr"]
img = convert_str_to_bitmap(imgstr, scale)
print(st[cid])
19 changes: 1 addition & 18 deletions src/aixd_ara/components/ara_PlotCorrelations/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,14 @@
"typeHintID": "str",
"scriptParamAccess": 1
},
{
"name": "output_type",
"description": "Plot type: 'static' creates a bitmap image, 'interactive' launches an interactive plot in a browser.",
"typeHintID": "str",
"scriptParamAccess": 0
},
{
"name": "plot",
"description": "Set to True to (re-)create the plot.",
"typeHintID": "bool",
"scriptParamAccess": 0
},
{
"name": "scale",
"description": "Resize factor for the static plot.",
"typeHintID": "float",
"scriptParamAccess": 0
}
],

"outputParameters": [
{
"name": "img",
"description": "Bitmap image if output_type is 'static', otherwise None."
}
]
"outputParameters": []
}
}
9 changes: 2 additions & 7 deletions src/aixd_ara/components/ara_PlotDistributions/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@


if plot:
# if output_type interactive: will launch the plotly fig in browser
st[cid] = plot_distrib_attributes(session_id(), variables, output_type)
st[cid] = plot_distrib_attributes(session_id(), variables, "interactive") # will launch the plotly fig in browser

if cid in st.keys():
print(st[cid])
# TODO: add error msg here
if output_type == "static" and "imgstr" in st[cid].keys():
imgstr = st[cid]["imgstr"]
img = convert_str_to_bitmap(imgstr, scale)
print(st[cid])
19 changes: 1 addition & 18 deletions src/aixd_ara/components/ara_PlotDistributions/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,14 @@
"typeHintID": "str",
"scriptParamAccess": 1
},
{
"name": "output_type",
"description": "Plot type: 'static' creates a bitmap image, 'interactive' launches an interactive plot in a browser.",
"typeHintID": "str",
"scriptParamAccess": 0
},
{
"name": "plot",
"description": "Set to True to (re-)create the plot.",
"typeHintID": "bool",
"scriptParamAccess": 0
},
{
"name": "scale",
"description": "Resize factor for the static plot.",
"typeHintID": "float",
"scriptParamAccess": 0
}
],

"outputParameters": [
{
"name": "img",
"description": "Bitmap image if output_type is 'static', otherwise None."
}
]
"outputParameters": []
}
}
Loading