Commit d2fb2a81 authored by Daniel Childs's avatar Daniel Childs

cleaned and stable version

parent ec83fb67
Copyright (c) 2012 Free Software Foundation
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
#/***************************************************************************
# Stereonet
#
# Displays a geologic stereonet of selected data
# -------------------
# begin : 2016-11-29
# git sha : $Format:%H$
# copyright : (C) 2016 by Daniel Childs
# email : daniel@childsgeo.com
# ***************************************************************************/
#
#/***************************************************************************
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it under the terms of the GNU General Public License as published by *
# * the Free Software Foundation; either version 2 of the License, or *
# * (at your option) any later version. *
# * *
# ***************************************************************************/
# translation
SOURCES = \
__init__.py
PLUGINNAME = Stereonet
PY_FILES = \
__init__.py
EXTRAS = metadata.txt icon.png
MPLSTEREONET= \
mplstereonet/analysis.py \
mplstereonet/contouring.py \
mplstereonet/convenience_functions.py \
mplstereonet/__init__.py \
mplstereonet/stereonet_axes.py \
mplstereonet/stereonet_math.py \
mplstereonet/stereonet_transforms.py \
mplstereonet/utilities.py
#################################################
# Normally you would not need to edit below here
#################################################
PLUGIN_UPLOAD = $(c)/plugin_upload.py
HOME=/mnt/c/Users/cni
QGISDIR=.qgis2
default: deploy
deploy:
@echo
@echo "------------------------------------------"
@echo "Deploying plugin to your .qgis2 directory."
@echo "------------------------------------------"
# The deploy target only works on unix like operating system where
# the Python plugin directory is located at:
# $HOME/$(QGISDIR)/python/plugins
mkdir -p $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)
mkdir -p $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)/mplstereonet
cp -vf $(PY_FILES) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)
cp -vf $(EXTRAS) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)
cp -vf $(MPLSTEREONET) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)/mplstereonet
# The dclean target removes compiled python files from plugin directory
# also deletes any .git entry
dclean:
@echo
@echo "-----------------------------------"
@echo "Removing any compiled python files."
@echo "-----------------------------------"
find $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) -iname "*.pyc" -delete
find $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) -iname ".git" -prune -exec rm -Rf {} \;
derase:
@echo
@echo "-------------------------"
@echo "Removing deployed plugin."
@echo "-------------------------"
rm -Rf $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)
zip: deploy dclean
@echo
@echo "---------------------------"
@echo "Creating plugin zip bundle."
@echo "---------------------------"
# The zip target deploys the plugin and creates a zip file with the deployed
# content. You can then upload the zip file on http://plugins.qgis.org
rm -f $(PLUGINNAME).zip
cd $(HOME)/$(QGISDIR)/python/plugins; zip -9r $(CURDIR)/$(PLUGINNAME).zip $(PLUGINNAME)
package: compile
# Create a zip package of the plugin named $(PLUGINNAME).zip.
# This requires use of git (your plugin development directory must be a
# git repository).
# To use, pass a valid commit or tag as follows:
# make package VERSION=Version_0.3.2
@echo
@echo "------------------------------------"
@echo "Exporting plugin to zip package. "
@echo "------------------------------------"
rm -f $(PLUGINNAME).zip
git archive --prefix=$(PLUGINNAME)/ -o $(PLUGINNAME).zip $(VERSION)
echo "Created package: $(PLUGINNAME).zip"
upload: zip
@echo
@echo "-------------------------------------"
@echo "Uploading plugin to QGIS Plugin repo."
@echo "-------------------------------------"
$(PLUGIN_UPLOAD) $(PLUGINNAME).zip
clean:
@echo
@echo "------------------------------------"
@echo "Removing uic and rcc generated files"
@echo "------------------------------------"
#/***************************************************************************
# Stereonet
#
# Displays a geologic stereonet of selected data
# -------------------
# begin : 2016-11-29
# git sha : $Format:%H$
# copyright : (C) 2016 by Daniel Childs
# email : daniel@childsgeo.com
# ***************************************************************************/
#
#/***************************************************************************
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it under the terms of the GNU General Public License as published by *
# * the Free Software Foundation; either version 2 of the License, or *
# * (at your option) any later version. *
# * *
# ***************************************************************************/
# translation
SOURCES = \
__init__.py
PLUGINNAME = Stereonet
PY_FILES = \
__init__.py
EXTRAS = metadata.txt icon.png
MPLSTEREONET= \
mplstereonet/analysis.py \
mplstereonet/contouring.py \
mplstereonet/convenience_functions.py \
mplstereonet/__init__.py \
mplstereonet/stereonet_axes.py \
mplstereonet/stereonet_math.py \
mplstereonet/stereonet_transforms.py \
mplstereonet/utilities.py
#################################################
# Normally you would not need to edit below here
#################################################
PLUGIN_UPLOAD = $(c)/plugin_upload.py
#Sorry everyone, this is so I can actually build it on my windows 10 machine
HOME=/mnt/c/Users/cni
QGISDIR=.qgis2
default: deploy
deploy:
@echo
@echo "------------------------------------------"
@echo "Deploying plugin to your .qgis2 directory."
@echo "------------------------------------------"
# The deploy target only works on unix like operating system where
# the Python plugin directory is located at:
# $HOME/$(QGISDIR)/python/plugins
mkdir -p $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)
mkdir -p $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)/mplstereonet
cp -vf $(PY_FILES) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)
cp -vf $(EXTRAS) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)
cp -vf $(MPLSTEREONET) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)/mplstereonet
# The dclean target removes compiled python files from plugin directory
# also deletes any .git entry
dclean:
@echo
@echo "-----------------------------------"
@echo "Removing any compiled python files."
@echo "-----------------------------------"
find $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) -iname "*.pyc" -delete
find $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) -iname ".git" -prune -exec rm -Rf {} \;
derase:
@echo
@echo "-------------------------"
@echo "Removing deployed plugin."
@echo "-------------------------"
rm -Rf $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)
zip: deploy dclean
@echo
@echo "---------------------------"
@echo "Creating plugin zip bundle."
@echo "---------------------------"
# The zip target deploys the plugin and creates a zip file with the deployed
# content. You can then upload the zip file on http://plugins.qgis.org
rm -f $(PLUGINNAME).zip
cd $(HOME)/$(QGISDIR)/python/plugins; zip -9r $(CURDIR)/$(PLUGINNAME).zip $(PLUGINNAME)
package: compile
# Create a zip package of the plugin named $(PLUGINNAME).zip.
# This requires use of git (your plugin development directory must be a
# git repository).
# To use, pass a valid commit or tag as follows:
# make package VERSION=Version_0.3.2
@echo
@echo "------------------------------------"
@echo "Exporting plugin to zip package. "
@echo "------------------------------------"
rm -f $(PLUGINNAME).zip
git archive --prefix=$(PLUGINNAME)/ -o $(PLUGINNAME).zip $(VERSION)
echo "Created package: $(PLUGINNAME).zip"
upload: zip
@echo
@echo "-------------------------------------"
@echo "Uploading plugin to QGIS Plugin repo."
@echo "-------------------------------------"
$(PLUGIN_UPLOAD) $(PLUGINNAME).zip
clean:
@echo
@echo "------------------------------------"
@echo "Removing uic and rcc generated files"
@echo "------------------------------------"
rm $(COMPILED_UI_FILES) $(COMPILED_RESOURCE_FILES)
\ No newline at end of file
# Stereonet
Stereonet is a QGIS plugin that generates a sterenot of geologic structures based on imported CSV data.
### Example
Lets say you have a drill hole and want to plot the geologic stereonet of a bunch of structures.
1. The data needs to be formatted as shown in the "Required Inputs" section.
2. Add a delimited text layer to the project.
3. Select your layer, and use the "Select Features" tool to pick out what points you want plotted.
4. Once points are selected, click the Stereonet icon
5. You should get a plot like this!
### Required Inputs
- A CSV file containing data points with an easting, northing, dip direction, and dip column. (The dip direction and dip column NEED to be named "ddr" and "dip", respectively)
### Known Bugs
* Clicking on most anything in the matplotlib menu bar crashes QGIS. I'm working on getting that removed so nothing won't crash anymore.
* When resizing the window, the orientation markers do not move with the stereonet. Bug has been reported here: https://github.com/joferkington/mplstereonet/issues/15
\ No newline at end of file
......@@ -24,19 +24,14 @@
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import sys
import numpy as np
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar
import matplotlib.pyplot as plt
from matplotlib import cm
import mplstereonet
from qgis.core import *
from qgis.gui import *
import qgis.utils
import random
import os
def classFactory(iface):
return Stereonet(iface)
......@@ -45,23 +40,22 @@ def classFactory(iface):
class Stereonet:
def __init__(self, iface):
self.iface = iface
# super(Stereonet, self).__init__()
def initGui(self):
# self.action = QAction(u'Go!', self.iface.mainWindow())
# self.action.triggered.connect(self.run)
# self.iface.addToolBarIcon(self.action)
self.contourAction = QAction(u'Contour', self.iface.mainWindow())
dir_path = os.path.dirname(os.path.realpath(__file__))
self.contourAction = QAction(QIcon(str(dir_path)+"/icon.png"), u'Stereonet', self.iface.mainWindow())
self.contourAction.triggered.connect(self.contourPlot)
self.iface.addToolBarIcon(self.contourAction)
print(dir_path)
def unload(self):
# self.iface.removeToolBarIcon(self.action)
# del self.action
self.iface.removeToolBarIcon(self.contourAction)
del self.contourAction
def run(self):
#stereonetWithoutContour is unused as of now
def stereonetWithoutContour(self):
plt.rcParams['toolbar'] = 'None'
fig = plt.figure()
ax = fig.add_subplot(111, projection='stereonet')
strikes = list()
......@@ -82,18 +76,16 @@ class Stereonet:
strikes = list()
dips = list()
try:
layer = qgis.utils.iface.activeLayer()
print(layer)
iter = layer.selectedFeatures()
for feature in iter:
strikes.append(feature['ddr']-90)
dips.append(feature['dip'])
layers = self.iface.legendInterface().layers()
for layer in layers:
iter = layer.selectedFeatures()
for feature in iter:
strikes.append(feature['ddr']-90)
dips.append(feature['dip'])
cax = ax.density_contourf(strikes, dips, measurement='poles',cmap=cm.coolwarm)
ax.pole(strikes, dips, 'k+', markersize=7)
ax.grid(True)
fig.colorbar(cax)
plt.show()
except:
return
\ No newline at end of file
icon.png

1.01 KB | W: | H:

icon.png

1.98 KB | W: | H:

icon.png
icon.png
icon.png
icon.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -32,7 +32,7 @@ homepage=https://github.com/daniel-childs/qgis-stereonet
category=Plugins
icon=icon.png
# experimental flag
experimental=True
experimental=False
# deprecated flag (applies to the whole plugin, not just a single version)
deprecated=False
......
Copyright (c) 2012 Free Software Foundation
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Copyright (c) 2012 Free Software Foundation
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
from .stereonet_axes import StereonetAxes
from .stereonet_math import pole, plane, line, rake
from .stereonet_math import plunge_bearing2pole, pole2plunge_bearing
from .stereonet_math import geographic2pole, geographic2plunge_bearing
from .stereonet_math import xyz2stereonet, stereonet2xyz, azimuth2rake
from .stereonet_math import vector2plunge_bearing, vector2pole
from .stereonet_math import plane_intersection, project_onto_plane
from .stereonet_math import antipode, angular_distance
from .contouring import density_grid
from .utilities import parse_quadrant_measurement, parse_strike_dip, parse_rake
from .utilities import parse_azimuth, parse_plunge_bearing
from .convenience_functions import subplots
from .analysis import fit_girdle, fit_pole, cov_eig, eigenvectors, \
find_mean_vector, find_fisher_stats, kmeans
__version__ = '0.6-dev'
__all__ = ['StereonetAxes', 'pole', 'plane', 'line', 'rake',
'plunge_bearing2pole', 'geographic2pole', 'vector2plunge_bearing',
'geographic2plunge_bearing', 'density_grid', 'plane_intersection',
'xyz2stereonet', 'stereonet2xyz', 'vector2pole', 'antipode',
'project_onto_plane', 'azimuth2rake', 'parse_azimuth',
'parse_quadrant_measurement', 'parse_strike_dip', 'parse_rake',
'parse_plunge_bearing', 'subplots', 'pole2plunge_bearing',
'fit_girdle', 'fit_pole', 'cov_eig', 'eigenvectors', 'kmeans',
'find_mean_vector', 'find_fisher_stats', 'angular_distance']
from .stereonet_axes import StereonetAxes
from .stereonet_math import pole, plane, line, rake
from .stereonet_math import plunge_bearing2pole, pole2plunge_bearing
from .stereonet_math import geographic2pole, geographic2plunge_bearing
from .stereonet_math import xyz2stereonet, stereonet2xyz, azimuth2rake
from .stereonet_math import vector2plunge_bearing, vector2pole
from .stereonet_math import plane_intersection, project_onto_plane
from .stereonet_math import antipode, angular_distance
from .contouring import density_grid
from .utilities import parse_quadrant_measurement, parse_strike_dip, parse_rake
from .utilities import parse_azimuth, parse_plunge_bearing
from .convenience_functions import subplots
from .analysis import fit_girdle, fit_pole, cov_eig, eigenvectors, \
find_mean_vector, find_fisher_stats, kmeans
__version__ = '0.6-dev'
__all__ = ['StereonetAxes', 'pole', 'plane', 'line', 'rake',
'plunge_bearing2pole', 'geographic2pole', 'vector2plunge_bearing',
'geographic2plunge_bearing', 'density_grid', 'plane_intersection',
'xyz2stereonet', 'stereonet2xyz', 'vector2pole', 'antipode',
'project_onto_plane', 'azimuth2rake', 'parse_azimuth',
'parse_quadrant_measurement', 'parse_strike_dip', 'parse_rake',
'parse_plunge_bearing', 'subplots', 'pole2plunge_bearing',
'fit_girdle', 'fit_pole', 'cov_eig', 'eigenvectors', 'kmeans',
'find_mean_vector', 'find_fisher_stats', 'angular_distance']
This diff is collapsed.
This diff is collapsed.
def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
subplot_kw=None, hemisphere='lower', projection='equal_area',
**fig_kw):
"""
Identical to matplotlib.pyplot.subplots, except that this will default to
producing equal-area stereonet axes.
This prevents constantly doing:
>>> fig, ax = plt.subplot(subplot_kw=dict(projection='stereonet'))
or
>>> fig = plt.figure()
>>> ax = fig.add_subplot(111, projection='stereonet')
Using this function also avoids having ``mplstereonet`` continually appear
to be an unused import when one of the above methods are used.
Parameters
-----------
nrows : int
Number of rows of the subplot grid. Defaults to 1.
ncols : int
Number of columns of the subplot grid. Defaults to 1.
hemisphere : string
Currently this has no effect. When upper hemisphere and dual
hemisphere plots are implemented, this will control which hemisphere
is displayed.
projection : string
The projection for the axes. Defaults to 'equal_area'--an equal-area
(a.k.a. "Schmidtt") stereonet. May also be 'equal_angle' for an
equal-angle (a.k.a. "Wulff") stereonet or any other valid matplotlib
projection (e.g. 'polar' or 'rectilinear' for a "normal" axes).
The following parameters are identical to matplotlib.pyplot.subplots:
sharex : string or bool
If *True*, the X axis will be shared amongst all subplots. If
*True* and you have multiple rows, the x tick labels on all but
the last row of plots will have visible set to *False*
If a string must be one of "row", "col", "all", or "none".
"all" has the same effect as *True*, "none" has the same effect
as *False*.
If "row", each subplot row will share a X axis.
If "col", each subplot column will share a X axis and the x tick
labels on all but the last row will have visible set to *False*.
sharey : string or bool
If *True*, the Y axis will be shared amongst all subplots. If
*True* and you have multiple columns, the y tick labels on all but
the first column of plots will have visible set to *False*
If a string must be one of "row", "col", "all", or "none".
"all" has the same effect as *True*, "none" has the same effect
as *False*.
If "row", each subplot row will share a Y axis.
If "col", each subplot column will share a Y axis and the y tick
labels on all but the last row will have visible set to *False*.
*squeeze* : bool
If *True*, extra dimensions are squeezed out from the
returned axis object:
- if only one subplot is constructed (nrows=ncols=1), the
resulting single Axis object is returned as a scalar.
- for Nx1 or 1xN subplots, the returned object is a 1-d numpy
object array of Axis objects are returned as numpy 1-d
arrays.
- for NxM subplots with N>1 and M>1 are returned as a 2d
array.
If *False*, no squeezing at all is done: the returned axis
object is always a 2-d array contaning Axis instances, even if it
ends up being 1x1.
*subplot_kw* : dict
Dict with keywords passed to the
:meth:`~matplotlib.figure.Figure.add_subplot` call used to
create each subplots.
*fig_kw* : dict
Dict with keywords passed to the :func:`figure` call. Note that all
keywords not recognized above will be automatically included here.
Returns
--------
fig, ax : tuple
- *fig* is the :class:`matplotlib.figure.Figure` object
- *ax* can be either a single axis object or an array of axis
objects if more than one supblot was created. The dimensions
of the resulting array can be controlled with the squeeze
keyword, see above.
"""
import matplotlib.pyplot as plt
if projection in ['equal_area', 'equal_angle']:
projection += '_stereonet'
if subplot_kw == None:
subplot_kw = {}
subplot_kw['projection'] = projection
return plt.subplots(nrows, ncols, sharex=sharex, sharey=sharey,
squeeze=squeeze, subplot_kw=subplot_kw, **fig_kw)
def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
subplot_kw=None, hemisphere='lower', projection='equal_area',
**fig_kw):
"""
Identical to matplotlib.pyplot.subplots, except that this will default to
producing equal-area stereonet axes.
This prevents constantly doing:
>>> fig, ax = plt.subplot(subplot_kw=dict(projection='stereonet'))
or
>>> fig = plt.figure()
>>> ax = fig.add_subplot(111, projection='stereonet')
Using this function also avoids having ``mplstereonet`` continually appear
to be an unused import when one of the above methods are used.
Parameters
-----------
nrows : int
Number of rows of the subplot grid. Defaults to 1.
ncols : int
Number of columns of the subplot grid. Defaults to 1.
hemisphere : string
Currently this has no effect. When upper hemisphere and dual
hemisphere plots are implemented, this will control which hemisphere
is displayed.
projection : string
The projection for the axes. Defaults to 'equal_area'--an equal-area
(a.k.a. "Schmidtt") stereonet. May also be 'equal_angle' for an
equal-angle (a.k.a. "Wulff") stereonet or any other valid matplotlib
projection (e.g. 'polar' or 'rectilinear' for a "normal" axes).
The following parameters are identical to matplotlib.pyplot.subplots:
sharex : string or bool
If *True*, the X axis will be shared amongst all subplots. If
*True* and you have multiple rows, the x tick labels on all but
the last row of plots will have visible set to *False*
If a string must be one of "row", "col", "all", or "none".
"all" has the same effect as *True*, "none" has the same effect
as *False*.
If "row", each subplot row will share a X axis.
If "col", each subplot column will share a X axis and the x tick
labels on all but the last row will have visible set to *False*.
sharey : string or bool
If *True*, the Y axis will be shared amongst all subplots. If
*True* and you have multiple columns, the y tick labels on all but
the first column of plots will have visible set to *False*
If a string must be one of "row", "col", "all", or "none".
"all" has the same effect as *True*, "none" has the same effect
as *False*.
If "row", each subplot row will share a Y axis.
If "col", each subplot column will share a Y axis and the y tick
labels on all but the last row will have visible set to *False*.
*squeeze* : bool
If *True*, extra dimensions are squeezed out from the
returned axis object:
- if only one subplot is constructed (nrows=ncols=1), the
resulting single Axis object is returned as a scalar.
- for Nx1 or 1xN subplots, the returned object is a 1-d numpy
object array of Axis objects are returned as numpy 1-d
arrays.
- for NxM subplots with N>1 and M>1 are returned as a 2d
array.
If *False*, no squeezing at all is done: the returned axis
object is always a 2-d array contaning Axis instances, even if it
ends up being 1x1.
*subplot_kw* : dict
Dict with keywords passed to the
:meth:`~matplotlib.figure.Figure.add_subplot` call used to
create each subplots.
*fig_kw* : dict
Dict with keywords passed to the :func:`figure` call. Note that all
keywords not recognized above will be automatically included here.
Returns
--------
fig, ax : tuple
- *fig* is the :class:`matplotlib.figure.Figure` object
- *ax* can be either a single axis object or an array of axis
objects if more than one supblot was created. The dimensions
of the resulting array can be controlled with the squeeze
keyword, see above.
"""
import matplotlib.pyplot as plt
if projection in ['equal_area', 'equal_angle']:
projection += '_stereonet'
if subplot_kw == None:
subplot_kw = {}
subplot_kw['projection'] = projection
return plt.subplots(nrows, ncols, sharex=sharex, sharey=sharey,
squeeze=squeeze, subplot_kw=subplot_kw, **fig_kw)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment