See examples in Graphics.mw
h2w::numeric:=0.55 height to width ratio for text letters,
for text printing it allows to request only height of text.GetBox(L,/rdx,rdy,$)::x1,x2,y1,y2
gets boundaries of L::list of lists of [x,y] points,
where rdx::numeric:=0,rdy::numeric:=rdx are relative extensions of the box,
so that e.g. x1:=x1-rdx*(x2-x1)GetBox2(L,$)::x1,x2,y1,y2
gets boundaries of L::list of plots
using plottools[getdata] command.Spline2(xydata,cod,{degree})::procedure
is the modified CurveFitting[Spline] command,
where xydata,degree::posint:=3,_rest are data, polynomial degree and other arguments to be passed to Spline command
and cod::{0,1,2,12} is used to impose zero-derivative condition to left (1) and right (2) endpoints.
Note that the command Spline2 applies Spline command to xydata and returns a function,
which is undefined beyond the endpoints of xydata.ErrorBar(x0,r,/w,opt,$)
plots vertical error bar at x0
with confidence interval for ordinate r::range,
where w::realcons:=0 is the width of the bar ends (the default is no bar ends)
and opt::list:=[] are options in plottools[line] command.Legend2(L,x,y,a,h,/h2w,symb,{symbw,sep,imx,imy,omx,omy,opts,optt,optb,nobox},$)::plot
plots legend to overcome limitations of the built-in legend,
where
L::list(list) list of [text,color] for each item of the legend;x,y::numeric legend position;a::string legend alignment wrt [x,y],
use L/R for left/right and A/B for above/below, the default is centered;h::numeric text height, all other vertical distances should be given in this unit,
all horizontal distances should be given in unit of h*h2w;symb::string:="line" symbol used in the legend;symbw::numeric:=`if`(symb="line",2,1) symbol width;sep::numeric:=0 symbol-text separation;imx,imy,omx,omy::numeric:=3/4,1/4,1/2,1/4 inner and outer x/y margins of the box;opts::list:=[thickness=2] plot options for legend symbol,optt::list:=[] plot options for legend text,optb::list:=[color="Gray",thickness=0] plot options for legend box,nobox::boolean do not show legend box.TextOnLine(x1,y1,x2,y2,s,h,/h2w,g,rxy,{textover})
plots line and text over it center, where
x1,y1,x2,y2::realcons coordinates of the line;s::string text;h::numeric text height;g::numeric:=0.03 relative gap between line end-points and actually drawn line;rxy::{[rx::numeric],[rx,ry]}:=[0.5] fractional position of the text relative to (x1,y1);textover::boolean alternative approach when a rectangle is drawn above the line below the text
(not working in Maple but suitable for export);_rest is passed to textplot.h2w:=max(h2w,g) and g:=min(h2w,g) to avoid accidental mistakes.Rainbow(n,/before,after,{reverse::boolean},$)::list(COLOR)
generate rainbow colors, where
n::{nonnegint,list} is the number of colors or list of indices for color table
(if more than 11 then cycling is used),
before,after::list:=[] will be inserted into the list.WritePlotData(filename,ls,Xformat,Yformat,/com,{Xlabel,legend,emptycell,sep,overwrite},$)
write plot data to file, where
ls::list(list(list)) list of list of data points as in plot command;Xformat,Yformat::string formatting strings for data;com::string:="" comment;Xlabel::string:="Xvalue",legend::list(string):=[] labels for X and Y columns;emptycell::string:="" to be printed at Y coulmn when its value for given X is absent;sep::character:="\t" separator between numbers in a line.com.Yformat.Xformat.plotps(filename,pl,/opt,cbb,{waittime,eps2pdf,overwrite})
user-friendly postscript plot, where
filename::string has the default extension "eps",
if the extension is "pdf" then pdf-file is produced;pl,_rest are passed to display command;opt::string:=psplotoptions are plot options
for plotsetup,
the default value can be changed by Setup command;cbb::[integer$4]:=[0,0,0,0] is passed to CorrectEPS command;waittime::numeric:=0.1 wait this time before running CorrectEPS command;eps2pdf::string:="eps2pdf.bat" eps2pdf converter,
see here.CorrectEPS(filename::string,cbb::list:=[0,0,0,0],$)
correct EPS-file by cropping Bounding Box by cbb from [left,bottom,right,top].
It also removes "%%Pages" entries.ImageCoreBox(img::Array,threshold::numeric:=1,$)::[x1,y1,x2,y2]
determine the smallest rectangular circumscribing image at given threshold
such that the smallest x-coordinate of the resulting image with HSV[3]<threshold is x1.