Model and data plotting
mplot
Amaru.mplot
— Functionmplot(blocks, filename="", kwargs...)
Plots an array of blocks using PyPlot
backend
Arguments
blocks
: An array of Block
objects. Subarrays are also supported.
filename
= ""` : If provided, a file with the output is saved
See also
See documentation of mplot(mesh, filename="", kwargs...)
for details about keyword arguments.
mplot(mesh, filename="", kwargs...)
Plots a mesh
using PyPlot
backend.
Arguments
mesh
: A finite element mesh
filename = ""
: If provided, a file with the output is saved
Keyword arguments
axis = true
: If true, show axes
lw = 0.5
: Line width
markers = false
: If true, shows node markers
nodelabels = false
: If true, shows node labels
celllabels = false
: If true, shows cell labels
opacity = 1.0
: Opacity,
field = nothing
: If provided, plots corresponding field
fieldmult = 1.0
: Factor multiplied to field
values
fieldlims = ()
: Tuple (min, max)
with field limits
vectorfield = nothing
: If provided, plots corresponding vector field
arrowscale = 0.0
: Factor multiplied to vectorfield
values
colormap = "coolwarm"
: Colormap according to PyPlot
colormaplims = (0.0, 1.0)
: Colormap range to be used
shrinkcolors = false
: If true, shrinks the color scale of the colormap
darkcolors = false
: If true, makes colormap colors darker
lightcolors = false
: If true, makes colormap colors lighter
vividcolors = false
: If true, makes colormap colors more vivid
divergingcolors = false
: If true, makes colormap centralized at zero
colorbarscale = 0.9
: Scale of the colorbar
colorbarlabel = ""
: Label of the colorbar
colorbarlocation = ""
: Location of colorbar (top, bottom, left and right)
colorbarpad = 0.0
: Separation of colorbar from the plot
warpscale = 0.0
: Factor multiplied to "U" field when available
hicells = 0
: Cell number to be highlighted
elev = 30.0
: 3D plot elevation
azim = 45.0
: 3D plot azimute
dist = 10.0
: 3D plot distance from observer
outline = true
: Highlight main edges of 3D meshes in the saved output
figsize = (3,3.0)
: Figure size
leaveopen = false
: If true, leaves the plot open so other drawings can be added
cplot
Amaru.cplot
— Functioncplot(data, filename, kwargs...)
Plots a pyplot line chart.
Arguments
data
: An array of named tuples with information for each line
filename
= "" : The chart filename
Keyword arguments
xlabel = "$x$"
: x label
ylabel = "$y$"
: y label
xbins = 10
: number of bins in x
ybins = 10
: number of bins in y
grid = false
: grid
figsize = (3.2,2.2)
: size of plot
legendloc = "best"
: legend location in plot
legendexpand = false
: expanded version
bbox_to_anchor = nothing
: legend anchor
ncol = 0
: number of columns in horizontal legend
xlim = nothing
: x axis limits
ylim = nothing
: y axis limits
xscale = "linear"
: x axis scale
yscale = "linear"
: y axis scale
xmult = 1.0
: x data multiplier
ymult = 1.0
: y data multiplier
ticksinside = true
: put ticks inside plot
fontsize = 7
: font size
legendfontsize = 0
: defaults to fontsize
labelspacing = 0.5
: spacing between legend labels
textlist = []
: e.g. [ (text="text", pos=(x,y)), ]
tagpos = 0.5
: tag position along data
tagloc = "top"
: tag location relative to curve
tagdist = 0.005
: tag distance from curve
tagfontsize = 0
: default to fontsize
tagcolor = "black"
: "" uses the data color
tagalign = true
: if true the tag is aligned to the curve
quiet = false
:
copypath = ""
: path to copy ouput file
Example
using Amaru
X1 = collect(1:20)
X2 = collect(1:20)
Y1 = log.(X1)
Y2 = log.(X2)*1.1
cplot([
(x=X1, y=Y1, marker="o", color="r", label="curve 1")
(x=X2, y=Y2, marker="s", color="b", label="curve 2")
],
"plot.pdf"
)
Extended example:
using Amaru
X1 = collect(1:20)
X2 = collect(1:20)
Y1 = log.(X1)
Y2 = log.(X2)*1.1
cplot([
(x=X1, y=Y1, lw=0.5, ls="-", ms=2, mfc="w", marker="o", color="r", label="curve 1")
(x=X2, y=Y2, lw=0.5, ls="-", ms=2, mfc="w", marker="s", color="b", label="curve 2")
],
filename = "plot.pdf",
xlabel="$x$", ylabel="$y$", legendloc="best",
xbins=6, ybins=6, grid=true, figsize=(3,2), legendexpand=false, ncol=0,
xlim=(0,20), xscale="linear", yscale="log",
fontsize=7, legendfontsize=0, labelspacing=0.5
)