1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 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
|
"""
The PlotDesign method
=====================
The goal of this example is to present the features of the PlotDesign static method.
"""
# %%
# Distribution
# ------------
# %%
import matplotlib.pyplot as plt
import openturns as ot
import openturns.viewer as otv
# %%
# In two dimensions
# -----------------
# %%
dim = 2
X = [ot.Uniform()] * dim
distribution = ot.JointDistribution(X)
# %%
sampleSize = 10
sample = distribution.getSample(sampleSize)
# %%
# With default parameters the bounds are computed from the sample.
# %%
fig = otv.PlotDesign(sample)
# %%
# Set the bounds.
# %%
bounds = distribution.getRange()
# %%
fig = otv.PlotDesign(sample, bounds)
# %%
# Configure the size of the plot.
# %%
fig = otv.PlotDesign(sample)
fig.set_size_inches(10, 10)
# %%
# Configure the number of subdivisions in each direction.
# %%
fig = otv.PlotDesign(sample, subdivisions=[10, 5])
# %%
# Disable the ticks.
# %%
fig = otv.PlotDesign(sample, enableTicks=False)
# %%
# Configure the marker.
# %%
fig = otv.PlotDesign(sample, plot_kw={"marker": ".", "color": "red"})
# %%
# Create the figure beforehand.
# %%
fig = plt.figure()
fig.suptitle("My suptitle")
fig = otv.PlotDesign(sample, figure=fig)
# %%
# In three dimensions
# -------------------
# %%
dim = 3
X = [ot.Uniform()] * dim
distribution = ot.JointDistribution(X)
# %%
sampleSize = 10
sample = distribution.getSample(sampleSize)
# %%
fig = otv.PlotDesign(sample)
fig.set_size_inches(10, 10)
# %%
# Configure the number of subdivisions.
# %%
fig = otv.PlotDesign(sample, subdivisions=[12, 6, 3])
fig.set_size_inches(10, 10)
# %%
# Configure the bounds.
# %%
bounds = distribution.getRange()
fig = otv.PlotDesign(sample, bounds)
fig.set_size_inches(10, 10)
# %%
# Display all figures
otv.View.ShowAll()
|