-
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.
add plot type example files for gallery
- Loading branch information
1 parent
bd8d326
commit f14651c
Showing
27 changed files
with
816 additions
and
839 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
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
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
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
Gallery | ||
------- | ||
.. _examples: | ||
|
||
Examples | ||
-------- | ||
|
||
The following examples show off the functionality of EMCPy. The examples | ||
give reference to what can be done with these collection of tools. Please | ||
do not hesitate to issue a pull request to add further examples! | ||
do not hesitate to issue a pull request to add further examples! |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,20 +1,6 @@ | ||
## Plots | ||
|
||
The plotting section of EMCPy is the most mature and is used as the backend plotting for (eva)[https://github.com/JCSDA-internal/eva]. It uses declarative, object-oriented programming approach to handle complex plotting routines under the hood to simplify the experience for novice users while remaining robust so more experienced users can utilize higher-level applications. | ||
|
||
### Design | ||
The design was inspired by Unidata's (MetPy)[https://github.com/Unidata/MetPy] declarative plotting syntax. The structure is broken into three different levels: plot type level, plot level, figure level | ||
|
||
#### Plot Type Level | ||
This is the level where users will define their plot type objects and associated plot details. This includes adding the related data the user wants to plot and how the user wants to display the data i.e: color, line style, marker style, labels, etc. | ||
|
||
#### Plot Level | ||
This level is where users design how they want the overall subplot to look. Users can add multiple plot type objects and define titles, x and y labels, colorbars, legends, etc. | ||
|
||
#### Figure Level | ||
This level where users defines high-level specifics about the actual figure itself. These include figure size, layout, defining information about subplot layouts like rows and columns, saving the figure, etc. | ||
.. _plot-types: | ||
|
||
Plot Types | ||
---------- | ||
|
||
Here is a collection of the current plot types that are currently available using EMCPy. | ||
Here is a collection of the plot types that are currently available using EMCPy. |
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 @@ | ||
.. _basic: | ||
|
||
Basic | ||
===== |
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,53 @@ | ||
""" | ||
Bar Plot | ||
-------- | ||
Below is an example of how to plot a bar | ||
plot using EMCPy's plotting method. | ||
""" | ||
|
||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
|
||
from emcpy.plots.plots import BarPlot | ||
from emcpy.plots.create_plots import CreatePlot, CreateFigure | ||
|
||
|
||
def main(): | ||
# Create bar plot | ||
|
||
# Grab sample bar plot data | ||
x_pos, heights = _getBarData() | ||
|
||
# Create bar plot object | ||
bar = BarPlot(x_pos, heights) | ||
bar.color = 'tab:red' | ||
|
||
# Create plot object and add features | ||
plot1 = CreatePlot() | ||
plot1.plot_layers = [bar] | ||
plot1.add_xlabel(xlabel='X Axis Label') | ||
plot1.add_ylabel(ylabel='Y Axis Label') | ||
plot1.add_title("Bar Plot") | ||
|
||
# Create figure | ||
fig = CreateFigure() | ||
fig.plot_list = [plot1] | ||
fig.create_figure() | ||
|
||
plt.show() | ||
|
||
|
||
def _getBarData(): | ||
# Generate test data for bar graphs | ||
|
||
x = ['a', 'b', 'c', 'd', 'e', 'f'] | ||
heights = [5, 6, 15, 22, 24, 8] | ||
|
||
x_pos = [i for i, _ in enumerate(x)] | ||
|
||
return x_pos, heights | ||
|
||
if __name__ == '__main__': | ||
main() |
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,54 @@ | ||
""" | ||
Horizontal Bar Plot | ||
------------------- | ||
Below is an example of how to plot a horizontal | ||
bar plot using EMCPy's plotting method. | ||
""" | ||
|
||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
|
||
from emcpy.plots.plots import HorizontalBar | ||
from emcpy.plots.create_plots import CreatePlot, CreateFigure | ||
|
||
|
||
def main(): | ||
# Create horizontal bar plot | ||
|
||
# Grab sample bar plot data | ||
y_pos, widths= _getBarData() | ||
|
||
# Create horizontal bar plot object | ||
bar = HorizontalBar(y_pos, widths) | ||
bar.color = 'tab:green' | ||
|
||
# Create plot object and add features | ||
plot1 = CreatePlot() | ||
plot1.plot_layers = [bar] | ||
plot1.add_xlabel(xlabel='X Axis Label') | ||
plot1.add_ylabel(ylabel='Y Axis Label') | ||
plot1.add_title("Horizontal Bar Plot") | ||
|
||
# Create figure | ||
fig = CreateFigure() | ||
fig.plot_list = [plot1] | ||
fig.create_figure() | ||
|
||
plt.show() | ||
|
||
|
||
def _getBarData(): | ||
# Generate test data for bar graphs | ||
|
||
x = ['a', 'b', 'c', 'd', 'e', 'f'] | ||
heights = [5, 6, 15, 22, 24, 8] | ||
|
||
x_pos = [i for i, _ in enumerate(x)] | ||
|
||
return x_pos, heights | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
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,45 @@ | ||
""" | ||
Horizontal Line Plot | ||
-------------------- | ||
Below is an example of how to plot a horizontal | ||
line using EMCPy's plotting method. | ||
""" | ||
|
||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
|
||
from emcpy.plots.plots import HorizontalLine | ||
from emcpy.plots.create_plots import CreatePlot, CreateFigure | ||
|
||
|
||
def main(): | ||
|
||
y = 5 | ||
|
||
# Create vertical line plot object | ||
hlp = HorizontalLine(y) | ||
hlp.label = 'Horizontal Line' | ||
|
||
# Add vertical line plot object to list | ||
plt_list = [hlp] | ||
|
||
# Create plot object and add features | ||
plot1 = CreatePlot() | ||
plot1.plot_layers = [hlp] | ||
plot1.add_title('Horizontal Line Plot') | ||
plot1.add_xlabel('X Axis Label') | ||
plot1.add_ylabel('Y Axis Label') | ||
plot1.add_legend(loc='upper right') | ||
|
||
# Create figure | ||
fig = CreateFigure() | ||
fig.plot_list = [plot1] | ||
fig.create_figure() | ||
|
||
plt.show() | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
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
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 @@ | ||
""" | ||
Scatter Plot | ||
------------ | ||
Below is an example of how to plot a basic | ||
scatter plot using EMCPy's plotting method. | ||
""" | ||
|
||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
|
||
from emcpy.plots.plots import Scatter | ||
from emcpy.plots.create_plots import CreatePlot, CreateFigure | ||
|
||
|
||
def main(): | ||
|
||
# Create scatter plot object | ||
x1, y1, x2, y2 = _getScatterData() | ||
sctr1 = Scatter(x1, y1) | ||
|
||
# Create plot object and add features | ||
plot1 = CreatePlot() | ||
plot1.plot_layers = [sctr1] | ||
plot1.add_title(label='Scatter Plot') | ||
plot1.add_xlabel(xlabel='X Axis Label') | ||
plot1.add_ylabel(ylabel='Y Axis Label') | ||
|
||
# Create figure | ||
fig = CreateFigure() | ||
fig.plot_list = [plot1] | ||
fig.create_figure() | ||
|
||
plt.show() | ||
|
||
def _getScatterData(): | ||
# Generate test data for scatter plots | ||
|
||
rng = np.random.RandomState(0) | ||
x1 = rng.randn(100) | ||
y1 = rng.randn(100) | ||
|
||
rng = np.random.RandomState(0) | ||
x2 = rng.randn(30) | ||
y2 = rng.randn(30) | ||
|
||
return x1, y1, x2, y2 | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
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,45 @@ | ||
""" | ||
Vertical Line Plot | ||
------------------ | ||
Below is an example of how to plot a vertical | ||
line using EMCPy's plotting method. | ||
""" | ||
|
||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
|
||
from emcpy.plots.plots import VerticalLine | ||
from emcpy.plots.create_plots import CreatePlot, CreateFigure | ||
|
||
|
||
def main(): | ||
|
||
x = 5 | ||
|
||
# Create vertical line plot object | ||
vlp = VerticalLine(x) | ||
vlp.label = 'Vertical Line' | ||
|
||
# Add vertical line plot object to list | ||
plt_list = [vlp] | ||
|
||
# Create plot object and add features | ||
plot1 = CreatePlot() | ||
plot1.plot_layers = [vlp] | ||
plot1.add_title('Vertical Line Plot') | ||
plot1.add_xlabel('X Axis Label') | ||
plot1.add_ylabel('Y Axis Label') | ||
plot1.add_legend(loc='upper right') | ||
|
||
# Create figure | ||
fig = CreateFigure() | ||
fig.plot_list = [plot1] | ||
fig.create_figure() | ||
|
||
plt.show() | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
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 @@ | ||
.. _gridded | ||
|
||
Gridded | ||
======= |
Oops, something went wrong.