-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 61c2f78
Showing
212 changed files
with
26,525 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: 0fee1f01507d8d01e27abb7c79ccc3a6 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
52 changes: 52 additions & 0 deletions
52
_downloads/017531d7482ba7804ed7eada3f5b6b1c/layered_histogram.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
""" | ||
Layered histograms | ||
------------------ | ||
This example shows how to plot multiple | ||
histograms as layers on single plot. | ||
""" | ||
|
||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
|
||
from emcpy.plots.plots import Histogram | ||
from emcpy.plots.create_plots import CreatePlot, CreateFigure | ||
|
||
|
||
def main(): | ||
# Generate test data for histogram plots | ||
mu = 100 # mean of distribution | ||
sigma = 15 # standard deviation of distribution | ||
data1 = mu + sigma * np.random.randn(450) | ||
data2 = mu + sigma * np.random.randn(225) | ||
|
||
# Create histogram objects | ||
hst1 = Histogram(data1) | ||
hst1.color = 'tab:green' | ||
hst1.alpha = 0.7 | ||
hst1.label = 'data 1' | ||
|
||
hst2 = Histogram(data2) | ||
hst2.color = 'tab:purple' | ||
hst2.alpha = 0.7 | ||
hst2.label = 'data 2' | ||
|
||
# Create histogram plot object and add features | ||
plot1 = CreatePlot() | ||
plot1.plot_layers = [hst1, hst2] | ||
plot1.add_title(label='Test Histogram Plot') | ||
plot1.add_xlabel(xlabel='X Axis Label') | ||
plot1.add_ylabel(ylabel='Y Axis Label') | ||
plot1.add_legend() | ||
|
||
# Create figure and save as png | ||
fig = CreateFigure() | ||
fig.plot_list = [plot1] | ||
fig.create_figure() | ||
|
||
plt.show() | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
43 changes: 43 additions & 0 deletions
43
_downloads/0bb05dfab40171a5a8e1daed7344798f/layered_histogram.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"\n# Layered histograms\n\nThis example shows how to plot multiple\nhistograms as layers on single plot.\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\nimport matplotlib.pyplot as plt\n\nfrom emcpy.plots.plots import Histogram\nfrom emcpy.plots.create_plots import CreatePlot, CreateFigure\n\n\ndef main():\n # Generate test data for histogram plots\n mu = 100 # mean of distribution\n sigma = 15 # standard deviation of distribution\n data1 = mu + sigma * np.random.randn(450)\n data2 = mu + sigma * np.random.randn(225)\n\n # Create histogram objects\n hst1 = Histogram(data1)\n hst1.color = 'tab:green'\n hst1.alpha = 0.7\n hst1.label = 'data 1'\n\n hst2 = Histogram(data2)\n hst2.color = 'tab:purple'\n hst2.alpha = 0.7\n hst2.label = 'data 2'\n\n # Create histogram plot object and add features\n plot1 = CreatePlot()\n plot1.plot_layers = [hst1, hst2]\n plot1.add_title(label='Test Histogram Plot')\n plot1.add_xlabel(xlabel='X Axis Label')\n plot1.add_ylabel(ylabel='Y Axis Label')\n plot1.add_legend()\n\n # Create figure and save as png\n fig = CreateFigure()\n fig.plot_list = [plot1]\n fig.create_figure()\n\n plt.show()\n\n\nif __name__ == '__main__':\n main()" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.12.2" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
49 changes: 49 additions & 0 deletions
49
_downloads/23b2839cf2eaa53ad26d37e65d13333c/scatter_with_regression_line.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
""" | ||
Creating a Scatter Plot with a Regression Line | ||
---------------------------------------------- | ||
The following is an example of how to plot data | ||
as a scatter plot and include a linear regression | ||
line. Calling the linear regression function will | ||
give the user the y=mx+b equation as well as the | ||
R-squared value if the user specifies a legend. | ||
""" | ||
|
||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
|
||
from emcpy.plots.plots import Scatter | ||
from emcpy.plots.create_plots import CreatePlot, CreateFigure | ||
from emcpy.stats import get_linear_regression | ||
|
||
|
||
def main(): | ||
# Create test data | ||
rng = np.random.RandomState(0) | ||
x = rng.randn(100) | ||
y = rng.randn(100) | ||
|
||
# Create Scatter object | ||
sctr1 = Scatter(x, y) | ||
# Add linear regression feature in scatter object | ||
sctr1.do_linear_regression = True | ||
sctr1.add_linear_regression() | ||
|
||
# Create plot object and add features | ||
plot1 = CreatePlot() | ||
plot1.plot_layers = [sctr1] | ||
plot1.add_title(label='Test Scatter Plot') | ||
plot1.add_xlabel(xlabel='X Axis Label') | ||
plot1.add_ylabel(ylabel='Y Axis Label') | ||
plot1.add_legend() | ||
|
||
# Create figure | ||
fig = CreateFigure() | ||
fig.plot_list = [plot1] | ||
fig.create_figure() | ||
|
||
plt.show() | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
43 changes: 43 additions & 0 deletions
43
_downloads/2809c46bfe2b922fb375ada1f466b428/map_gridded.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"\n# Create a map plot with gridded data\n\nThe following example plots gridded data over\na CONUS domain.\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\nimport matplotlib.pyplot as plt\nfrom emcpy.plots import CreatePlot, CreateFigure\nfrom emcpy.plots.map_tools import Domain, MapProjection\nfrom emcpy.plots.map_plots import MapGridded\n\n\ndef main():\n # Create 2d gridded plot on global domian\n lats = np.linspace(25, 50, 25)\n lons = np.linspace(245, 290, 45)\n X, Y = np.meshgrid(lats, lons)\n Z = np.random.normal(size=X.shape)\n\n # Create gridded map object\n gridded = MapGridded(X, Y, Z)\n gridded.cmap = 'plasma'\n\n # Create plot object and add features\n plot1 = CreatePlot()\n plot1.plot_layers = [gridded]\n plot1.projection = 'plcarr'\n plot1.domain = 'conus'\n plot1.add_map_features(['coastline'])\n plot1.add_xlabel(xlabel='longitude')\n plot1.add_ylabel(ylabel='latitude')\n plot1.add_title(label='2D Gridded Data', loc='center')\n plot1.add_grid()\n plot1.add_colorbar(label='colorbar label',\n fontsize=12, extend='neither')\n\n # Create figure\n fig = CreateFigure()\n fig.plot_list = [plot1]\n fig.create_figure()\n\n plt.show()\n\n\nif __name__ == '__main__':\n main()" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.12.2" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
50 changes: 50 additions & 0 deletions
50
_downloads/290e6ea373fb2d702d94fe3b97705bcc/map_scatter_2D.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
""" | ||
Plotting 2D scatter data on map plot | ||
------------------------------------ | ||
Sometimes, users only want to look at the locations | ||
of their data on a map and do not care about the | ||
actual values. Below is an example of how to just plot | ||
lat and lon values on map. | ||
""" | ||
|
||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
|
||
from emcpy.plots import CreatePlot, CreateFigure | ||
from emcpy.plots.map_tools import Domain, MapProjection | ||
from emcpy.plots.map_plots import MapScatter | ||
|
||
|
||
def main(): | ||
# Create test data | ||
lats = np.linspace(35, 50, 30) | ||
lons = np.linspace(-70, -120, 30) | ||
|
||
# Create scatter plot on CONUS domian | ||
scatter = MapScatter(lats, lons) | ||
# change colormap and markersize | ||
scatter.color = 'tab:red' | ||
scatter.markersize = 25 | ||
|
||
# Create plot object and add features | ||
plot1 = CreatePlot() | ||
plot1.plot_layers = [scatter] | ||
plot1.projection = 'plcarr' | ||
plot1.domain = 'conus' | ||
plot1.add_map_features(['coastline', 'states']) | ||
plot1.add_xlabel(xlabel='longitude') | ||
plot1.add_ylabel(ylabel='latitude') | ||
plot1.add_title(label='EMCPy Map', loc='center', | ||
fontsize=20) | ||
|
||
fig = CreateFigure() | ||
fig.plot_list = [plot1] | ||
fig.create_figure() | ||
|
||
plt.show() | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
61 changes: 61 additions & 0 deletions
61
_downloads/2d36913f893ce1e5968a5140b00be434/multi_line_plot.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
""" | ||
Plotting multiple lines on a single plot | ||
---------------------------------------- | ||
The following example shows how to use EMCPy's | ||
method to plot several lines on a single subplot. | ||
The user creates three separate objects using different | ||
data and plots them on the same layer. | ||
""" | ||
|
||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
|
||
from emcpy.plots.plots import LinePlot | ||
from emcpy.plots.create_plots import CreatePlot, CreateFigure | ||
|
||
|
||
def _getLineData(): | ||
# generate test data for line plots | ||
|
||
x1 = [0, 401, 1039, 2774, 2408] | ||
x2 = [500, 250, 710, 1515, 1212] | ||
x3 = [400, 150, 910, 1215, 850] | ||
y1 = [0, 2.5, 5, 7.5, 12.5] | ||
y2 = [1, 5, 6, 8, 10] | ||
y3 = [1, 4, 5.5, 9, 10.5] | ||
|
||
return x1, y1, x2, y2, x3, y3 | ||
|
||
|
||
def main(): | ||
# create line plot with multiple lines | ||
x1, y1, x2, y2, x3, y3 = _getLineData() | ||
lp1 = LinePlot(x1, y1) | ||
lp1.label = 'line 1' | ||
|
||
lp2 = LinePlot(x2, y2) | ||
lp2.color = 'tab:green' | ||
lp2.label = 'line 2' | ||
|
||
lp3 = LinePlot(x3, y3) | ||
lp3.color = 'tab:red' | ||
lp3.label = 'line 3' | ||
|
||
plot1 = CreatePlot() | ||
plot1.plot_layers = [lp1, lp2, lp3] | ||
plot1.add_title('Test Line Plot') | ||
plot1.add_xlabel('X Axis Label') | ||
plot1.add_ylabel('Y Axis Label') | ||
plot1.add_legend(loc='upper right') | ||
|
||
fig = CreateFigure() | ||
fig.plot_list = [plot1] | ||
fig.create_figure() | ||
|
||
plt.show() | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
Oops, something went wrong.