Maxima - draw 2d shape within contour plot

1k views Asked by At

I produced a contour plot in wxmaxima and would like to draw a polygon on top (defined by its corner points). Something like this, but in one plot:

lx:[-0.5,1.5,2,-1.5]$
ly:[-1,-0.5,1,1.5]$

wxcontour_plot(20*exp(-x^2-y^2)-10,[x,-2,2],[y,-2,2],[yx_ratio,1],[xlabel,"x[m]"],[ylabel,"y[m]"],
    [gnuplot_preamble, "set cntrparam levels 18; set grid; set size ratio -1; set key outside top rmargin"],
    [grid,2,100])$
wxdraw2d(polygon(lx,ly))$
1

There are 1 answers

0
AudioBubble On BEST ANSWER

Here is some workaround with use of gnuplot_preamble:

lx:[-0.5,1.5,2,-1.5]$
ly:[-1,-0.5,1,1.5]$

wxcontour_plot(20*exp(-x^2-y^2)-10,[x,-2,2],[y,-2,2],[yx_ratio,1],[xlabel,"x[m]"],[ylabel,"y[m]"],
[gnuplot_preamble, "set cntrparam levels 18; set grid; set size ratio -1; 
set key outside top;
set object 1 polygon from -0.5,-1. to 1.5,-0.5 to 2.,1. to -1.5,1.5 to -0.5,-1. fs solid fc rgb 'red';"],
[grid,2,100])$

If you want your polygon to be opaque, add front into polygon definition.

enter image description here