uqtils.plots
Module for plotting utilities.
Includes:
ax_default
- Nice default plt formatting for x-y dataplot_slice
- Plots a grid of 1d slices of a multivariate functionndscatter
- Plots a grid of 1d and 2d marginals in a "corner plot" for n-dimensional data (especially for MCMC)
ax_default(ax, xlabel='', ylabel='', legend=None, cmap='tab10')
Nice default plt formatting for plotting X-Y data.
PARAMETER | DESCRIPTION |
---|---|
ax
|
the axes to apply these settings to
TYPE:
|
xlabel
|
the xlabel to set for
DEFAULT:
|
ylabel
|
the ylabel to set for
DEFAULT:
|
legend
|
will display a legend if bool(legend) is truthy, can pass a dict of legend kwargs here (optional)
DEFAULT:
|
cmap
|
colormap to use for cycling
DEFAULT:
|
Source code in src/uqtils/plots.py
ndscatter(samples, labels=None, tick_fmts=None, plot1d=None, plot2d='scatter', cmap='viridis', bins=20, cmin=0, z=None, cb_label=None, cb_norm='linear', subplot_size=3, cov_overlay=None)
Triangle scatter plots of n-dimensional samples.
Warning
Best for dim < 10
. You can shrink the subplot_size
to assist graphics loading time.
PARAMETER | DESCRIPTION |
---|---|
samples
|
TYPE:
|
labels
|
list of axis labels of length
TYPE:
|
tick_fmts
|
list of str.format() specifiers for ticks, e.g
TYPE:
|
plot1d
|
'hist' or 'kde' for 1d marginals, defaults to plot2d if None
TYPE:
|
plot2d
|
'hist' for 2d hist plot, 'kde' for kernel density estimation, 'hex', or 'scatter' (default)
TYPE:
|
cmap
|
the matplotlib string specifier of a colormap
DEFAULT:
|
bins
|
number of bins in each dimension for histogram marginals
DEFAULT:
|
cmin
|
the minimum bin count below which the bins are not displayed
DEFAULT:
|
z
|
TYPE:
|
cb_label
|
label for color bar (if
DEFAULT:
|
cb_norm
|
DEFAULT:
|
subplot_size
|
size in inches of a single 2d marginal subplot
DEFAULT:
|
cov_overlay
|
DEFAULT:
|
RETURNS | DESCRIPTION |
---|---|
the |
Source code in src/uqtils/plots.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 |
|
plot_slice(funs, bds, x0=None, x_idx=None, y_idx=None, N=50, random_walk=False, xlabels=None, ylabels=None, cmap='viridis', fun_labels=None)
Helper function to plot 1d slices of a function(s) over inputs.
PARAMETER | DESCRIPTION |
---|---|
funs
|
function callable as
|
bds
|
list of tuples of
TYPE:
|
x0
|
the default values for all inputs; defaults to middle of
TYPE:
|
x_idx
|
list of input indices to take 1d slices of
TYPE:
|
y_idx
|
list of output indices to plot 1d slices of
TYPE:
|
N
|
the number of points to take in each 1d slice
TYPE:
|
random_walk
|
whether to slice in a random d-dimensional direction or hold all params const while slicing
TYPE:
|
xlabels
|
list of labels for the inputs
TYPE:
|
ylabels
|
list of labels for the outputs
TYPE:
|
cmap
|
the name of the matplotlib colormap to use
DEFAULT:
|
fun_labels
|
the legend labels if plotting multiple functions on each plot
DEFAULT:
|
RETURNS | DESCRIPTION |
---|---|
|
Source code in src/uqtils/plots.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|