-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add plots
subpackage
#67
Conversation
This is a complete restructuring of the `epi.plots` module from previous releases. This commit creates a subpackage `epi.plots` to handle plotting operations from various models. This subpackage currently has one other module `web` which handles web-based plotting via `plotly`, a new experimental dependency. Changelist: - Add new requirement `plotly` to `README-nightly.py` - Add subpackage `epi.plots` to `__init__.py` - Create subpackage `epi.plots` (and remove old module) - Add `web` module to `epi.plots` subpackage - Update testing suite - Replace `test_transforms.py` with `test_plotting.py` for `epi.plots` subpackage Additional Notes: Deprecation Warning (severe): This commit deprecates the entire `epi.plots` module. Release Notes (major): Due to this severe deprecation and the obvious restructuring of internal code, these features will likely be released early in the alpha stage of epispot v3 via `epispot-nightly`.
This commit greatly simplifies the requirements in the epispot project: - `requirements.txt`: Basic requirements needed to run the stable version - `requirements-nightly.txt`: Basic requirements plus experimental dependencies for the nightly version of epispot - `requirements-dev.txt`: All requirements for the nightly version plus helpful packages used in the development process We have also kept `bin/requirements.txt` separately, but all these requirements are specified in the nightly requirements file as well. Changelist: - Update Travis CI to use dev requirements - Add new requirement specifications to the nightly README - Create new requirements files - Update `setup-nightly.py` to include experimental dependencies Additional Notes: Fixes (major): This commit fixes the failing Travis CI build from `df13d29b9b7e0b92654576f1f76a2a0d88418083`.
This commit is intended to fix an error in the Travis CI workflow due to incorrect dependency specifications in `plotly`. Plotly requires `pandas` to run but `pandas` is not explicitly defined as a dependency so it is not installed by `pip` automatically. Because of this, it is listed as a separate dependency to `epispot`. Changelist: - Add `pandas` to `requirements-nightly.txt` - Add `pandas` to `requirements-dev.txt` Additional Notes: Fixes (major): Fix `02202b802793a00c4cb41d8f060d5fb23fb40622`
This commit updates the `plotly` graph styling used in `epi.plots.web.model()` to use: - Times New Roman by default, followed by a serif font - Larger font size (`24px`) - Greater margins (`250px` left and right, `150px` top and bottom) Changelist: - Update graphing styles in `epi.plots.web`
Stacked area charts are now available for compartmental models in `epi.plots.web`, implemented via the function `stacked`. This function takes all the same arguments as the `model` function and uses all the same themes; only the chart type is different. Changelist: - Add stacked area charts to `epi.plots.web` - Add corresponding tests in `tests/test_plotting.py`
The structure label for `epi.plots.web` did not include the `stacked()` function. Additionally, it did not properly include the `()` to indicate that both `model()` and `stacked()` are functions. Changelist: - Fix `## Structure` label on `epi.plots.web`
This commit adds a `title` parameter to all plotting functions. Additionally, the `test_plotting` structure label has been changed to account for the new tests. Changelist: - Add `title` parameter to plots in `epi.plots.web` - Add testing for `title` in `tests/test_plotting.py` - Update structure label in `tests/test_plotting.py`
This commit introduces native plotting via `matplotlib` and `SciencePlots` (for styling purposes). Previously, plots were generated from the `epi.plots.web` module which created in-browser plots rather than native ones. These new native plots can be accessed via `epi.plots.native` and are displayed in a new window. Changelist: - Add `epi.plots.native` module - Add `SciencePlots` to `requirements-nightly.txt` - Add `SciencePlots` to `requirements-dev.txt` - Add dependency check for `SciencePlots` in `epi.plots.__init__.py` and add `native` module - Add `native` plots to tests Additional Notes: Migration (from v2.1.1): The new `epi.plots.native` module will serve as the replacement for the `epi.plots` module in v2.1.1.
* Debug Travis CI * Further debug Travis CI * Update `requirements-dev.txt` * Optimize imports Co-authored-by: q9i <46249765+quantum9Innovation@users.noreply.github.com>
This commit fixes the code coverage lapses identified in "Code Coverage Gaps on `massive-plots` Branch" (#65) by: (1) adding `# pragma: no cover` annotations to `ImportError` (2) adding a `test_full_native` test to test other parameters in `epi.plots.native.model()` Additionally, this commit fixes an identified bug as a result of the increased testing on the `epi.plots.native` module. The `compartments` and `names` parameters to `epi.plots.native.model()` can now be used without errors. Changelist: - Add `# pragma: no cover` annotations to `epi.plots` - Fix bug in `epi.plots.native.model()` - Add a full native test in `tests/plotting` Additional Notes: Issues (minor): - Fixes "Code Coverage Gaps on `massive-plots` Branch #65" - Fixes additional bug discovered in `epi.plots.native.model()`
…to massive-plots
This commit introduces similar stacked area charts to `epi.plots.web.stacked()` in `epi.plots.native`, this adding native support for stacked area charts. Changelist: - Add `epi.plots.native.stacked()` - Add testing support for ^ in `tests/plotting` Additional Notes: Warnings (minor): Occasionally, legend visibility is poor due to the fact that `matplotlib` does not enforce any white background on the legend. A patch will likely fix this.
Parameter values that were stretched across multiple lines have now been concatenated onto one line. Changelist: - Format `tests/plotting`
Codecov Report
@@ Coverage Diff @@
## master #67 +/- ##
==========================================
+ Coverage 87.86% 90.15% +2.29%
==========================================
Files 7 9 +2
Lines 412 508 +96
==========================================
+ Hits 362 458 +96
Misses 50 50
Continue to review full report at Codecov.
|
- Add to `test/x::integrity`
Fix DeepSource error: Re-defined variable from outer scope PYL-W0621 Changelist: - Remove error from epi.plots
Fix DeepSource error: Missing module/function docstring PY-D0003 Changelist: - Add docstrings to tests/plotting:: - test_plain_native - test_full_native - test_plain_native_stack - test_full_native_stack
This pull request introduces 3 alerts when merging f1896c6 into d9dbf03 - view on LGTM.com new alerts:
|
Operation massive-plots will be completed after these issues are fixed. |
This commit fixes "Decreased legend visibility on `massive-plots`" (#66) via a suggestion by @lisphilar. Changelist: - Fix `epi.plots.native::stacked` Co-authored-by: Lisphilar <7270139+lisphilar@users.noreply.github.com>
This commit adds a LaTeX installation to the Travis CI install script. LaTeX is needed for the `SciencePlots` package, which uses it in epispot's tests. This also (hopefully) fixes the error from the previous commit on Travis CI. Changelist: - Add LaTeX requirements to `.travis.yml::install` Additional Notes: Fixes (major): Fix `0ca85d13b579e624ca5dfff701a7a7c4c62a0d6c`
This commit fixes the issues described in "Improper handling of `compartments` parameter in `massive-plots`" (#68), which also reappear in 2 'unused variable' alerts on LGTM for PR #67. These can be seen at https://lgtm.com/projects/g/epispot/epispot/rev/pr-4a4c33bcfb0a25433ea10477d7c49b516a6f75d6. Additionally, this commit removes all `compartment` parameters where they are not necessary because similar functionality is already provided by the graphics engine. Changelist: - Remove `compartments` from and restructure `epi.plots.native.model()` - Remove all `compartments` from functions in `epi.plots.web` - Edit `tests/plotting::*full*` to run tests without `compartments` specifications Additional Notes: Fixes (major): Fix "Improper handling of `compartments` parameter in `massive-plots`" (#68) Fix 2 LGTM 'unused variable` alerts in `epi.plots.web` for PR #67
This pull request introduces 1 alert when merging 3eef7c5 into d9dbf03 - view on LGTM.com new alerts:
|
This commit fixes the 'unused import alert' in LGTM for PR #67. This alert can be seen at: https://lgtm.com/projects/g/epispot/epispot/rev/pr-4fc894482dc65aa247dbd5ef531e8bbd3fd15a7c Changelist: - Remove unused import from `epi.plots.native` Additional Notes: Fixes (minor): Fix LGTM 'unused import' alert in `epi.plots.native` for PR #67
Development v2: massive-plots
New Feature
The massive-plots operation will add a
plots
subpackage toepispot
, enabling an even wider array of plots and charts to be generated automatically from epispotModel
objects. As of right now, these includeplotly
)matplotlib
+SciencePlots
for styling and optionallyLaTeX
)Another operation, mini-plots, will add comparative features to this list and allow charting parameter values and comparing different models. The testing suite for this new module can be found at
tests/plotting
. Below are a few screenshots from tests to demonstrate the new charts:Plotly web chart (standard line graph of the SEIR model)
Plotly web chart (stacked area graph of the SEIR model)
Matplotlib native chart (standard line graph of the SEIR model: no LaTeX)
Matplotlib native chart (stacked area graph of the SEIR model: with LaTeX)
Known Issues
There is one noted issue about native stacked area plots, which you can see in #66.
This problem will not affect any other part of epispot's codebase.
Code Breakdown
Additional Notes
Deprecation Warning (severe):
This commit deprecates the entire
epi.plots
module.Release Notes (major):
Due to this severe deprecation and the obvious restructuring of
internal code, these features will likely be released early in the
alpha stage of epispot v3 via
epispot-nightly
.Migration (from v2.1.1):
The new
epi.plots.native
module will serve as the replacement for theepi.plots
module in v2.1.1.Warnings (minor):
Occasionally, legend visibility is poor due to the fact that
matplotlib
does not enforce any white background on the legend.A patch will likely fix this. See #66 for more information.