-
Notifications
You must be signed in to change notification settings - Fork 37
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
Showing
39 changed files
with
585 additions
and
151 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import numpy as np | ||
import pandas as pd | ||
import matplotlib.pyplot as plt | ||
from pyrolite.geochem.norm import ReferenceCompositions | ||
from pyrolite.geochem.ind import REE | ||
from pyrolite.plot.spider import spider | ||
import logging | ||
|
||
rc = ReferenceCompositions() | ||
rn = rc["EMORB_SM89"] # emorb composition as a starting point | ||
components = [i for i in rn.data.index if i in REE()] | ||
data = rn[components]["value"] | ||
nindex, nobs = data.index.size, 200 | ||
ss = [0.1, 0.2, 0.5] # sigmas for noise | ||
|
||
modes = [ | ||
("plot", "plot", [], dict(color="k", alpha=0.01)), | ||
("fill", "fill", [], dict()), | ||
("binkde", "binkde", [], dict(resolution=5)), | ||
( | ||
"binkde", | ||
"binkde percentiles specified", | ||
[], | ||
dict(percentiles=[0.95, 0.5], resolution=5), | ||
), | ||
("ckde", "ckde", [], dict(resolution=5)), | ||
("kde", "kde", [], dict(resolution=5)), | ||
("histogram", "histogram", [], dict(resolution=5)), | ||
] | ||
|
||
fig, ax = plt.subplots( | ||
len(modes), len(ss), sharey=True, figsize=(len(ss) * 3, 2 * len(modes)) | ||
) | ||
ax[0, 0].set_ylim((0.1, 100)) | ||
|
||
for a, (m, name, args, kwargs) in zip(ax, modes): | ||
a[0].annotate( # label the axes rows | ||
"Mode: {}".format(name), | ||
xy=(0.1, 1.05), | ||
xycoords=a[0].transAxes, | ||
fontsize=8, | ||
ha="left", | ||
va="bottom", | ||
) | ||
for ix, s in enumerate(ss): | ||
x = np.arange(nindex) | ||
y = rc["PM_PON"].normalize(data).applymap(np.log) | ||
y = np.tile(y, nobs).reshape(nobs, nindex) | ||
y += np.random.normal(0, s / 2, size=(nobs, nindex)) # noise | ||
y += np.random.normal(0, s, size=(1, nobs)).T # random pattern offset | ||
df = pd.DataFrame(y, columns=components) | ||
df["Eu"] += 1.0 # significant offset | ||
df = df.applymap(np.exp) | ||
for mix, (m, name, args, kwargs) in enumerate(modes): | ||
df.pyroplot.spider( | ||
indexes=x, | ||
mode=m, | ||
ax=ax[mix, ix], | ||
cmap="viridis", | ||
vmin=0.05, | ||
*args, | ||
**kwargs | ||
) | ||
|
||
plt.tight_layout() | ||
# %% save figure | ||
from pyrolite.util.plot import save_figure, save_axes | ||
|
||
save_figure(fig, save_at="../../source/_static", name="spider_modes") |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Conditional Density Spiderplots | ||
================================== | ||
|
||
The spiderplot can be extended to provide visualisations of ranges and density via the | ||
various modes: | ||
|
||
.. literalinclude:: ../../../../examples/plotting/conditionalspider.py | ||
:language: python | ||
:end-before: # %% save figure | ||
|
||
.. image:: ../../../_static/spider_modes.png | ||
:width: 100% | ||
:align: center | ||
|
||
.. seealso:: `Density Plots <density.html>`__, | ||
`Spiderplots <spider.html>`__ |
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,13 +1,12 @@ | ||
import sys | ||
import logging | ||
from ._version import get_versions | ||
from .plot import pyroplot | ||
|
||
__version__ = get_versions()["version"] | ||
del get_versions | ||
|
||
# http://docs.python-guide.org/en/latest/writing/logging/ | ||
logging.getLogger(__name__).addHandler(logging.NullHandler()) | ||
logging.captureWarnings(True) | ||
|
||
from ._version import get_versions | ||
from .plot import pyroplot # import after logger setup to suppress numpydoc warnings | ||
__version__ = get_versions()["version"] | ||
del get_versions | ||
|
||
__all__ = ['plot', 'comp', 'geochem', 'mineral', 'util'] |
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
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
Oops, something went wrong.