The examples in this notebook were taken from the Maxima documentation.
First set the default plot options to SVG output so that Maxima-Jupyter can capture the output.
set_plot_option([svg_file, "maxplot.svg"]);
set_plot_option([plot_format,gnuplot]);
contour_plot
Example¶plot2d ([contour, y^2+x^2], [x,-4,4], [y,-4,4]);
julia
Example¶julia (-0.55, 0.6, [iterations, 36], [x, -0.3, 0.2],
[y, 0.3, 0.9], [grid, 400, 400], [color_bar_tics, 0, 6, 36])$
mandelbrot
Example¶mandelbrot ([iterations, 30], [x, -2, 1], [y, -1.2, 1.2],
[grid,400,400]);
plot2d
Example¶plot2d (sin(x), [x, -%pi, %pi])$
plot3d
Example¶plot3d (u^2 - v^2, [u, -2, 2], [v, -3, 3], [grid, 100, 100],
[mesh_lines_color,false])$
draw
Plots¶First load the draw
package and set the default terminal to svg
.
load("draw")$
set_draw_defaults(file_name="maxplot.svg",terminal='svg)$
draw2d
Example¶draw2d(explicit(((1+x)**2/(1+x*x))-1,x,-10,10))$
draw3d
Example¶draw3d(
colorbox = "Magnitude",
enhanced3d = true,
explicit(x^2+y^2,x,-1,1,y,-1,1))$
draw
Example¶draw(
gr2d(
key="sin (x)",grid=[2,2],
explicit(
sin(x),
x,0,2*%pi
)
),
gr2d(
key="cos (x)",grid=[2,2],
explicit(
cos(x),
x,0,2*%pi
)
)
)$
animated_gif
Example¶set_draw_defaults(terminal=animated_gif)$
sp(ang):=gr3d(enhanced3d = true,
color = green,
logcb = true,
logz = true,
palette = [-15,24,-9],
view=[60,ang],
explicit(exp(x^2-y^2), x,-2,2,y,-2,2))$
draw(delay=50,
terminal = animated_gif,
makelist(sp(mod(i, 360)),i,5,365,30))$
descriptive
Plots¶First load descriptive
and distrib
.
load ("descriptive")$
load ("distrib")$
set_draw_defaults(terminal=svg)$
barsplot
Example¶l1:makelist(random(10),k,1,50)$
l2:makelist(random(10),k,1,100)$
barsplot(
l1,l2,
box_width = 1,
fill_density = 1,
bars_colors = [black, grey],
frequency = relative,
sample_keys = ["A", "B"])$
boxplot
Example¶s2 : read_matrix(file_search("wind.data"))$
boxplot(s2,
box_width = 0.2,
title = "Windspeed in knots",
xlabel = "Stations",
color = red,
line_width = 2)$
histogram
Example¶s1 : read_list (file_search ("pidigits.data"))$
histogram (
s1,
nclasses = 8,
title = "pi digits",
xlabel = "digits",
ylabel = "Absolute frequency",
fill_color = grey,
fill_density = 0.6)$
piechart
Example¶piechart(
s1,
xrange = [-1.1, 1.3],
yrange = [-1.1, 1.1],
title = "Digit frequencies in pi")$
scatterplot
Example¶s2 : read_matrix (file_search ("wind.data"))$
scatterplot(
submatrix(s2, 1,2,3),
title = "Data from stations #4 and #5",
point_type = diamant,
point_size = 2,
color = blue)$
starplot
Example¶starplot(
l1, l2,
stars_colors = [blue,red],
sample_keys = ["1st sample", "2nd sample"],
star_center = [1,2],
star_radius = 4,
proportional_axes = xy,
line_width = 2 ) $
stemplot
Example¶stemplot(
random_normal(15, 6, 100),
leaf_unit = 0.1)$
implicit_plot
Example¶load(implicit_plot)$
implicit_plot (x^2 = y^3 - 3*y + 1, [x, -4, 4], [y, -4, 4])$