Skip to content

Commit 8fbede3

Browse files
authored
Merge pull request #633 from LinkedEarth/modeplot
Simple change to documentation to make explicitly clear where to change parameter values and fix to geo mapping function
2 parents af4d62c + e390d0f commit 8fbede3

File tree

3 files changed

+41
-3
lines changed

3 files changed

+41
-3
lines changed

pyleoclim/core/geoseries.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,25 @@ def map(self, projection='Orthographic', proj_default=True,
344344
Draws major lakes.
345345
If a dictionary of formatting arguments is supplied (e.g. color, alpha), will draw according to specifications.
346346
Default is off (False).
347+
348+
fig : matplotlib.pyplot.figure, optional
349+
See matplotlib.pyplot.figure <https://matplotlib.org/3.5.0/api/_as_gen/matplotlib.pyplot.figure.html#matplotlib-pyplot-figure>_.
350+
The default is None.
347351
352+
gridspec_slot : Gridspec slot, optional
353+
If generating a map for a multi-plot, pass a gridspec slot.
354+
The default is None.
355+
356+
title : string
357+
Title for the plot. Default is None
358+
359+
size : string, optional
360+
Grouping variable that will produce points with different sizes. Expects to be associated with numeric values (e.g., 'elevation' has values). Any data without a value for the size variable will be filtered out.
361+
The default is None.
362+
363+
edgecolor : color (string) or list of rgba tuples, optional
364+
Color of marker edge. The default is 'w'.
365+
348366
figsize : list or tuple, optional
349367
The size of the figure. The default is None.
350368
@@ -361,6 +379,18 @@ def map(self, projection='Orthographic', proj_default=True,
361379
362380
scatter_kwargs : dict, optional
363381
Parameters for the scatter plot. The default is None.
382+
383+
cmap : string or list, optional
384+
Matplotlib supported colormap id or list of colors for creating a colormap. See `choosing a matplotlib colormap <https://matplotlib.org/3.5.0/tutorials/colors/colormaps.html>`_.
385+
The default is None.
386+
387+
colorbar : bool, optional
388+
Whether the draw a colorbar on the figure if the data associated with hue are numeric.
389+
Default is True.
390+
391+
gridspec_kwargs : dict, optional
392+
Function assumes the possibility of a colorbar, map, and legend. A list of floats associated with the keyword `width_ratios` will assume the first (index=0) is the relative width of the colorbar, the second to last (index = -2) is the relative width of the map, and the last (index = -1) is the relative width of the area for the legend.
393+
For information about Gridspec configuration, refer to `Matplotlib documentation <https://matplotlib.org/3.5.0/api/_as_gen/matplotlib.gridspec.GridSpec.html#matplotlib.gridspec.GridSpec>`_. The default is None.
364394
365395
legend : bool; {True, False}, optional
366396
Whether to plot the legend. The default is True.
@@ -406,8 +436,10 @@ def map(self, projection='Orthographic', proj_default=True,
406436
407437
408438
'''
439+
scatter_kwargs = {} if scatter_kwargs is None else scatter_kwargs.copy()
440+
409441
if markersize != None:
410-
scatter_kwargs['markersize'] = markersize
442+
scatter_kwargs['s'] = markersize
411443

412444
if type(title)==bool:
413445
if title == False:

pyleoclim/core/multivardecomp.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ def modeplot(self, index=0, figsize=[8, 8], fig=None, savefig_settings=None,gs=N
187187
188188
Includes: The temporal coefficient (PC or similar), its spectrum, and the loadings (EOF or similar), possibly geolocated.
189189
If the object does not have geolocation information, a spaghetti plot of the standardized series is displayed.
190+
191+
To see how to use the different parameters, consult the following tutorial: http://linked.earth/PyleoTutorials/notebooks/L2_principal_component_analysis.html
190192
191193
Parameters
192194
----------
@@ -246,7 +248,7 @@ def modeplot(self, index=0, figsize=[8, 8], fig=None, savefig_settings=None,gs=N
246248
- scalar_mappable: matplotlib.cm.ScalarMappable; can be used to pass a matplotlib scalar mappable. See pyleoclim.utils.plotting.make_scalar_mappable for documentation on using the Pyleoclim utility, or the `Matplotlib tutorial on customizing colorbars <https://matplotlib.org/stable/users/explain/colors/colorbar_only.html>`_.
247249
248250
scatter_kwargs : dict, optional
249-
Optional arguments configuring how data are plotted on a map. See description of scatter_kwargs in pyleoclim.utils.mapping.scatter_map
251+
Optional arguments configuring how data are plotted on a map. This allows you to configure information about the style of markers (e.g., triangle, squares, circles), their size (through `markersize`), edgecolor, etc...) See description of scatter_kwargs in pyleoclim.utils.mapping.scatter_map
250252
251253
hue : str, optional
252254
(only applicable if using scatter map) Variable associated with color coding for points plotted on map. May correspond to a continuous or categorical variable.
@@ -258,7 +260,7 @@ def modeplot(self, index=0, figsize=[8, 8], fig=None, savefig_settings=None,gs=N
258260
259261
marker : string, optional
260262
(only applicable if using scatter map) Grouping variable that will produce points with different markers. Can have a numeric dtype but will always be treated as categorical.
261-
The default is None, which will produce circle markers. Alternatively, pass the name of a categorical variable, e.g. 'archiveType'. If 'archiveType' is specified, will attempt to use pyleoclim archiveType markers mapping, defaulting to '?' where values are unavailable.
263+
The default is None, which will produce circle markers. Alternatively, pass the name of a categorical variable, e.g. 'archiveType'. If 'archiveType' is specified, will attempt to use pyleoclim archiveType markers mapping, defaulting to '?' where values are unavailable. Caution: this is different from the `marker` argument in matplotlib. If you want to specify a marker style (e.g., cirle, square, triangle, use scatter_kwargs)
262264
263265
264266
Returns

pyleoclim/tests/test_core_GeoSeries.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ def test_map_t1(self, pinkgeoseries, title):
167167
ax['map'].get_title() == 'Untitled'
168168
pyleo.closefig(fig)
169169
pyleo.closefig(fig)
170+
171+
def test_map_t2(self,pinkgeoseries):
172+
ts = pinkgeoseries
173+
fig,ax = ts.map(markersize=100)
170174

171175

172176
def test_segment():

0 commit comments

Comments
 (0)