Skip to content
This repository has been archived by the owner on Nov 5, 2020. It is now read-only.

Commit

Permalink
Allow to set contour levels at quantiles instead of KDE fractions (close
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Apr 9, 2019
1 parent 03b4d7d commit e94fc27
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
@@ -1,4 +1,5 @@
0.9.2
- Allow to set contour levels at quantiles instead of KDE fractions (#180)
- Allow to manually select contour levels
- Pin numpy version to <=1.13.0 to prevent ValueError caused
by chaco testing whether an array object is contained in another
Expand Down
8 changes: 7 additions & 1 deletion docs/sec_interface.rst
Expand Up @@ -352,7 +352,13 @@ Scatter plot:
Contour plot:
Enable or disable contour plots, modify contour plot parameters,
and select the title and color for each scatter plot.


.. versionadded:: 0.9.2

Contour lines can now be plotted at KDE data quantiles (percentiles/100)
instead of at fractions of the overall KDE using the
`contour level mode` option. A contour line at a 0.95 quantile
contains 5% of all data points.


.. _ui_expert:
Expand Down
3 changes: 1 addition & 2 deletions shapeout/gui/confparms.py
Expand Up @@ -38,8 +38,7 @@ def get_config_entry_choices(key, subkey, ignore_axes=[]):
elif subkey == "isoelastics":
choices = ["not shown", "analytical", "numerical", "legacy"]
elif subkey == "contour level mode":
choices = ["fraction"]
#choices = ["fraction", "quantile"]
choices = ["fraction", "quantile"]
elif key == "analysis":
if subkey == "regression model":
choices = ["lmm", "glmm"]
Expand Down
6 changes: 4 additions & 2 deletions shapeout/gui/plot_contour.py
Expand Up @@ -153,8 +153,10 @@ def set_contour_data(plot, analysis):
if mode == "fraction":
plev = list(np.nanmax(density) * levels)
elif mode == "quantile":
raise NotImplementedError("TODO")
#plev = list(np.nanpercentile(density, q=levels*100))
pdensity = mm.get_kde_scatter(xax=xax, yax=yax,
kde_type=kde_type,
kde_kwargs=kde_kwargs)
plev = list(np.nanpercentile(pdensity, q=levels*100))
else:
raise ValueError("Unknown contour level mode `{}`!".format(mode))

Expand Down

0 comments on commit e94fc27

Please sign in to comment.