Items tagged with contourplot

I'm trying to plot contours in Maple, but the 2d contour plot output is not pretty. I tried the following command:

contourplot(-(1/2)*y^2-(1/2)*x^2-(1-.3)/sqrt((x+.3)^2+y^2)+((-1)*.3)/sqrt((x-1+.3)^2+y^2), x = -1.5 .. 1.5, y = -1.5 .. 1.5, axes = boxed)

and the plot is so much uglier than the 3d one:

contourplot3d(-(1/2)*y^2-(1/2)*x^2-(1-.3)/sqrt((x+.3)^2+y^2)+((-1)*.3)/sqrt((x-1+.3)^2+y^2), x = -1.5 .. 1.5, y = -1.5 .. 1.5, view = -2 .. -1.3, axes = boxed)

Is there any way I can get the same detail in the 2d one as there is in the 3d one.

Thanks in advance!

 

Here is my unsuccessful try

>restart; plots:-contourplot(exp(2*x/(x^2+y^2)), x = -2 .. 2, y = -2 .. 2,
grid = [100, 100], coloring = [blue, red], contours = [.1, .3, .5, 1, 2]);

This post is my attempt to answer the question from here .  

The procedure  ContoursWithLabels  has 2 required parameters: Expr  is an expression in  x  and  y  variables,  Range1  and  Range2  are ranges for  x  and  y . In this case, the output is the list of floats for the contours and 8 black contours (with labels) (the axis of coordinates as a box). 

The optional parameters: Number is positive integer - the number of contours (by default Number=8),  S is a set of real numbers  C  for contours (for which Expr=C) (by default  S={}),  GraphicOptions  is a list of graphic options for plotting (by default  GraphicOptions=[color = black, axes = box]),  Coloring  is an equality  Coloring=list of color options for  plots[dencityplot]  command (by default Coloring=NULL). 

The code of the procedure:

restart;

ContoursWithLabels := proc (Expr, Range1::(range(realcons)), Range2::(range(realcons)), Number::posint := 8, S::(set(realcons)) := {}, GraphicOptions::list := [color = black, axes = box], Coloring::`=` := NULL)

local r1, r2, L, f, L1, h, S1, P, P1, r, M, C, T, p, p1, m, n, A, B, E;

uses plots, plottools;

f := unapply(Expr, x, y);

if S = {} then r1 := rand(convert(Range1, float)); r2 := rand(convert(Range2, float));

L := [seq([r1(), r2()], i = 1 .. 205)];

L1 := convert(sort(select(a->type(a, realcons), [seq(f(op(t)), t = L)]), (a, b) ->is(abs(a) < abs(b))), set);

h := (L1[-6]-L1[1])/Number;

S1 := [seq(L1[1]+(1/2)*h+h*(n-1), n = 1 .. Number)] else

S1 := convert(S, list)  fi;

print(Contours = evalf[2](S1));

r := k->rand(20 .. k-20); M := []; T := [];

for C in S1 do

P := implicitplot(Expr = C, x = Range1, y = Range2, op(GraphicOptions), gridrefine = 3);

P1 := [getdata(P)];

for p in P1 do

p1 := convert(p[3], listlist); n := nops(p1);

if n < 500 then m := `if`(40 < n, (r(n))(), round((1/2)*n)); M := `if`(40 < n, [op(M), p1[1 .. m-11], p1[m+11 .. n]], [op(M), p1]); T := [op(T), [op(p1[m]), evalf[2](C)]] else

if 500 <= n then h := floor((1/2)*n); m := (r(h))(); M := [op(M), p1[1 .. m-11], p1[m+11 .. m+h-11], p1[m+h+11 .. n]]; T := [op(T), [op(p1[m]), evalf[2](C)], [op(p1[m+h]), evalf[2](C)]]

fi; fi; od; od;

A := plot(M, op(GraphicOptions));

B := plots:-textplot(T);

if Coloring = NULL then E := NULL else E := ([plots:-densityplot])(Expr, x = Range1, y = Range2, op(rhs(Coloring)))  fi;

display(E, A, B);

end proc:

 

Examples of use:

ContoursWithLabels(x^2+y^2, -3 .. 3, -3 .. 3);

                             

 

 

ContoursWithLabels(x^2-y^2, -5 .. 5, -5 .. 5, {-20, -15, -10, -5, 0, 5, 10, 15, 20}, [color = black, thickness = 2, axes = box], Coloring = [colorstyle = HUE, colorscheme = ["White", "Red"], style = surface]);

                           

 

 

The next example, I took from here:

ContoursWithLabels(sin(1.3*x)*cos(.9*y)+cos(.8*x)*sin(1.9*y)+cos(.2*x*y), -5 .. 0, 2 .. 5, {seq(-2 .. 2, 0.5)}, [color = black, axes = box], Coloring = [colorstyle = HUE, colorscheme = ["Cyan", "Red"], style = surface]);

                                 

 

There are many more examples can be found in the attached file. 

ContoursWithLabels1.mw

 

Edit. The attached file has been corrected.

please I want a clear explanation for the command (contourplot) in the maple?

 

contourplot

hi friends

i have a question and i could find the answer in existing questions but it was not clear at all!!!

i want to label my contours and i know that i should use lebelledcontourplot command.

But how?!
i could find an answer:

"1- First download the files located on his webpage.  Advisor6.zip    It should be zipped with 3 files in it. 

2 - Unzip them and copy them into a directory which you name, probably somewhere in the maple directory named advisor.  c:\maple12\advisor

3 - Then create a maple.ini in the maple12 directory with the following line to match your directory location  
libname:= `c:/maple12/advisor`, libname:  just like on the instruction installation page."

these are my questions:

1-how can i create a maple.ini?!
2-what should i do with the file i will create?

please explain more about the third phrase and explain exactly what should i do step by step.

thanks a lot

I am having difficulty with the contourplot3d.  When I hit enter it comes back with a blank plot.  Either Im doing somthing wrong or my machine can't handle it.

I have a surfdata-plot which - by interpolation - goes through different circles with different inclinations with respect to each other. The surface is color-coded with zhue from violet to red. In order to see the valleys behind peaks I would like to have a filled 2D-plot of my zhue-surfdata colors with contours wherever the surface passes z-coordinate integers located somewhere below the surface (e.g. at z=-7). Unfortunately, I haven't found examples of contourplots for surfdata plots so far.

restart

with(plots);

[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fieldplot, fieldplot3d, gradplot, gradplot3d, graphplot3d, implicitplot, implicitplot3d, inequal, interactive, interactiveparams, intersectplot, listcontplot, listcontplot3d, listdensityplot, listplot, listplot3d, loglogplot, logplot, matrixplot, multiple, odeplot, pareto, plotcompare, pointplot, pointplot3d, polarplot, polygonplot, polygonplot3d, polyhedra_supported, polyhedraplot, rootlocus, semilogplot, setcolors, setoptions, setoptions3d, spacecurve, sparsematrixplot, surfdata, textplot, textplot3d, tubeplot]

(1)

with(CurveFitting);

[ArrayInterpolation, BSpline, BSplineCurve, Interactive, LeastSquares, PolynomialInterpolation, RationalInterpolation, Spline, ThieleInterpolation]

(2)

R := [30, 32.5, 37.5, 42.5, 47.5, 50]:

incl := [0, .5, 1, -2, 5, 0]:

phases := [0, (1/12)*Pi, (1/8)*Pi, (1/4)*Pi, (1/2)*Pi, 0]:

colors := [grey, black, blue, red, green, grey]:

orbit := [R[j]*cos(t), R[j]*sin(t), incl[j]*cos(t-phases[j])]:

display(seq(spacecurve(orbit, t = 0 .. 2*Pi, color = colors[j], view = [-56 .. 56, -56 .. 56, -15 .. 15], labels = ["x [AU]", "y [AU]", "z [AU]"]), j = 1 .. 6));

 

NULL

R := [30, 32.5, 37.5, 42.5, 47.5, 50]:

incl := [0, .5, 1, -2, 2*evalf(Pi)-1.75, 0]:

pointplot(R, incl, color = [grey, red, blue, green, black, grey], labels = ["radius", "incl"]);

 

NewR := [seq(30+.4*i, i = 0 .. 50)]:

Newincl := ArrayInterpolation(R, incl, NewR, method = spline):

pointplot(NewR, Newincl, labels = ["radius", "incl"]);

 

phases := [0, (1/12)*evalf(Pi)+.3, 3*evalf(Pi)*(1/4), (1/4)*evalf(Pi)+.2, evalf(Pi)/(2.5)+.5, 0]:

pointplot(R, phases, labels = ["radius", "phase"]);

 

Newphases := ArrayInterpolation(R, phases, NewR, method = spline):

pointplot(NewR, Newphases, labels = ["radius", "phase"]);

 

t := [seq(0+i*(2*Pi*(1/50)), i = 0 .. 50)]:

f := proc (i, j) options operator, arrow; [NewR[i]*cos(t[j]), NewR[i]*sin(t[j]), Newincl[i]*cos(t[j]-Newphases[i])] end proc;

proc (i, j) options operator, arrow; [NewR[i]*cos(t[j]), NewR[i]*sin(t[j]), Newincl[i]*cos(t[j]-Newphases[i])] end proc

(3)

Surface := [seq([seq([NewR[i]*cos(t[j]), NewR[i]*sin(t[j]), Newincl[i]*cos(t[j]-Newphases[i])], i = 1 .. 51)], j = 1 .. 51)]:

plots[surfdata](Surface, labels = ["x [AU]", "y [AU]", "z [AU]"]);

 

``


Download Worksheet_Surfdata-contourplot.mwWorksheet_Surfdata-contourplot.mw

As stated, contourplot3d is not displaying contours. Even in the Maple Help examples the contours are not displayed in the help screen.

In this example:

contourplot3d(-5*x/(x^2+y^2+1), x = -3 .. 3, y = -3 .. 3, filledregions = true);

which is directly from Maple Help, the surface is plotted (with boxed axes), but no contours appear.

When I try

contourplot3d(-5*x/(x^2+y^2+1), x = -3 .. 3, y = -3 .. 3);

the plot shows nothing except boxed axes.

I've also tried

plot3d(-5*x/(x^2+y^2+1), x = -3 .. 3, y = -3 .. 3, contours=6);

and the surface shows but without countours. Furthermore, the Maple scripts that worked previously in earlier versions (showing contours via plot3d) now do not show contours in Maple 18. This occurs on both Win 7 and Win 8 laptops.

Thanks!

 

Contour lines must be ordinary circles. In fact, we get:

plots[contourplot](1/(x^2+y^2), x=-1..1, y=-1..1);

 

 

If we use the additional options, the result is even worse:

plots[contourplot](1/(x^2+y^2), x=-1..1,y=-1..1, numpoints=10000);

 

 

Consider the following two variable funtion:

f(x,y)=x^2+y^2-5

then we want to draw a contourplot:

contourplot(f,x=-10..10,y=-10..100)

My problem is that I want maple to diplay the value of the function "f" relating to each curve on the contour plot!
How can I do this?

Please see the following code.

Example.mw

Hi experts,

the standard resolution for maple contourplots is 72 dpi wich is not suitable for publication purposes. I need at least a resolution between 500 - 1000 dpi. How do I get better resolutions for my contourplots when exporting them to .bmp or .jpg-files?
Somebody any ideas?

Hi everyone,

restart:with(plots):

lambda1:=(S+sqrt(S^2+4*alpha))/(2);

lambda2:=(S-sqrt(S^2+4*alpha))/(2);

plot3d({lambda1,lambda2}, S=-10..10, alpha=-5..5, contours=50,grid=[100,100]);

plot([subs(alpha=-5,lambda1),subs(alpha=-4,lambda1),subs(alpha=-3,lambda1),subs(alpha=-2,lambda1)

,subs(alpha=-1,lambda1),subs(alpha=-0.5,lambda1),subs(alpha=0.0,lambda1),subs(alpha=0.5,lambda1)

,subs(alpha=1,lambda1),subs(alpha=2,lambda1),subs(alpha=3,lambda1),subs(alpha=4,lambda1)

,subs(alpha=5,lambda1),subs(alpha=-5,lambda2),subs(alpha=-4,lambda2),subs(alpha=-3,lambda2)

,subs(alpha=-2,lambda2),subs(alpha=-1,lambda2),subs(alpha=-0.5,lambda2),subs(alpha=0.0,lambda2)

,subs(alpha=0.5,lambda2),subs(alpha=1,lambda2),subs(alpha=2,lambda2),subs(alpha=3,lambda2)

,subs(alpha=4,lambda2),subs(alpha=5,lambda2)],S=-10...10,axes=box,color=[red,green]);

contourplot({lambda1,lambda2}, S=-10..10, alpha=-5..5, contours=50,grid=[100,100]);

 

 

How to minimize the disconnect in the 3d plot and countourplot to get a smooth plot?

 

Hi all

 
i am solving a system of four coupled differential equations using bvp[midrich]approach..

The code i am using is in the attach files 

command is like

> A1 := dsolve({bc, eq1, eq2, eq3, eq4}, numeric, output = array([seq(0+0.5e-2*i, i = 0 .. 200*bb)]), method = bvp[midrich]);

with(plots)

Dear sir, 

 i want to plot labelled contour plot in maple 13, 

here is the code

labelledcontourplot(x^3-y^2,x=-3..3,y=-3..2,axes=boxed);

thanks 

1 2 3 Page 1 of 3