Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,12 @@ Bandwidth Selection
:toctree: generated/

mgwr.sel_bw.Sel_BW


Visualization
~~~~~~~~~~~~~
.. autosummary::
:toctree: generated/

utils.shift_colormap
utils.truncate_colormap
6 changes: 6 additions & 0 deletions doc/generated/mgwr.utils.shift_colormap.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
mgwr.utils.shift\_colormap
==========================

.. currentmodule:: mgwr.utils

.. autofunction:: shift_colormap
6 changes: 6 additions & 0 deletions doc/generated/mgwr.utils.truncate_colormap.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
mgwr.utils.truncate\_colormap
=============================

.. currentmodule:: mgwr.utils

.. autofunction:: truncate_colormap
40 changes: 20 additions & 20 deletions mgwr/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ def shift_colormap(cmap, start=0, midpoint=0.5, stop=1.0, name='shiftedcmap'):
middle of the colormap's dynamic range to be at zero

Parameters
-----
cmap : The matplotlib colormap to be altered
start : Offset from lowest point in the colormap's range.
Defaults to 0.0 (no lower ofset). Should be between
0.0 and `midpoint`.
midpoint : The new center of the colormap. Defaults to
0.5 (no shift). Should be between 0.0 and 1.0. In
general, this should be 1 - vmax/(vmax + abs(vmin))
For example if your data range from -15.0 to +5.0 and
you want the center of the colormap at 0.0, `midpoint`
should be set to 1 - 5/(5 + 15)) or 0.75
stop : Offset from highets point in the colormap's range.
Defaults to 1.0 (no upper ofset). Should be between
`midpoint` and 1.0.
----------
cmap : The matplotlib colormap to be altered
start : Offset from lowest point in the colormap's range.
Defaults to 0.0 (no lower ofset). Should be between
0.0 and `midpoint`.
midpoint : The new center of the colormap. Defaults to
0.5 (no shift). Should be between 0.0 and 1.0. In
general, this should be 1 - vmax/(vmax + abs(vmin))
For example if your data range from -15.0 to +5.0 and
you want the center of the colormap at 0.0, `midpoint`
should be set to 1 - 5/(5 + 15)) or 0.75
stop : Offset from highets point in the colormap's range.
Defaults to 1.0 (no upper ofset). Should be between
`midpoint` and 1.0.

Returns
-------
Expand Down Expand Up @@ -66,12 +66,12 @@ def truncate_colormap(cmap, minval=0.0, maxval=1.0, n=100):
'''
Function to truncate a colormap by selecting a subset of the original colormap's values

Input
-----
cmap : Mmatplotlib colormap to be altered
minval : Minimum value of the original colormap to include in the truncated colormap
maxval : Maximum value of the original colormap to include in the truncated colormap
n : Number of intervals between the min and max values for the gradient of the truncated colormap
Parameters
----------
cmap : Mmatplotlib colormap to be altered
minval : Minimum value of the original colormap to include in the truncated colormap
maxval : Maximum value of the original colormap to include in the truncated colormap
n : Number of intervals between the min and max values for the gradient of the truncated colormap

Returns
-------
Expand Down