matplotlib – Implementation of a contour plot [Python]

I am trying to make a contour plot using meshgrid with Python. My dependent variable is not a direct function of the two, but I enter the values by hand. Consider the following example code:

import numpy as np
import matplotlib.pyplot as plt

Array1 = np.arange(-5,5,0.5)
Array2 = np.arange(-5,5,0.5)

X, Y = np.meshgrid(Array1, Array2)

Z = np.ones(X.shape)
Z((1,2)) = 3
Z((1,5)) = 8
Z((3,4)) = -3

plt.contour(X, Y, Z, 500)

This creates a contour plot that spans X values between -5 and 5, but Y values only between -5 and -2. Why does this happen, that part of the plot stays blank without contour lines. I expected lines to cover the whole plane, for -5 <X <5 and for -5 < Y < 5.

Thanks.

plotting – List contour plot with peaks

I have this table that i imported this way

data = Import["C:\nivel\data.dat", "Table"]
xy = data[[All, {1, 2, 3}]]

And i wanted to make a list contour plot of it but got stuck in this:

ListContourPlot[xy, PlotTheme -> "Web", ColorFunction -> "DarkRainbow", PlotRange -> All]

enter image description here

This happens because over the red line the function values are much higher than the rest so i tried to get more definition in the blue part by using 2500 Contours, which apparently wasn´t the answer. I was trying to plot something like this:

enter image description here

I can´t find the way to show sort of information of the variations over the blue part which can be seen here, where the Plot Range wasn´t used but got that white line instead

enter image description here

plotting – Need help to plot Talbot’s Contour (Newbie question)

I would like to plot these following parametrizations:

$$s(theta)=sigma+lambda s_{nu}(theta),quad s_{nu}(theta)=thetacot(theta) + inutheta,quad thetain(-pi,pi)$$

For more details, please see: The accurate numerical inversion of Laplace Transform by A. Talbot.
The parameters $sigma$, $lambda$, and $nu$ are adjustable.
The Talbot’s contour should looks like these two:
Pic1
Or
pic2

My attempt:

(Sigma) := 1
(Lambda) := 1/2
(Nu) := 1
s1 := (Theta)*Cot ((Theta)) + (I (Nu) (Theta))
eqn := (Sigma) + ((Lambda) s1), Assumptions -> -Pi <= (Theta) <= Pi
ParametricPlot({Re(eqn), Im(eqn)}, {f, -5, 2}, AspectRatio -> 1)

Sorry, i can’t give further attempt since i’m not really familiar with Mathematica. Hope you can help me. Thanks in advance.

plotting – Contour map without filled color

I would like to get a picture of a contour map like this:
enter image description here

I tried to modify the following code to remove the filled color on the contour map. So far I didn’t succeed.

 contourPotentialPlot1 = ContourPlot[-3600. h^2 + 0.02974 h^4 - 5391.90 s^2 + 
   0.275 h^2 s^2 + 0.125 s^4, {h, -400, 400}, {s, -300, 300}, 
 PlotRange -> {-1.4*10^8, 2*10^7}, Contours -> 15, Axes -> False, 
 PlotPoints -> 30, PlotRangePadding -> 0, Frame -> False, ColorFunction -> "DarkRainbow"];

potential1 = Plot3D[-3600. h^2 + 0.02974 h^4 - 5391.90 s^2 + 0.275 h^2 s^2 + 
    0.125 s^4, {h, -400, 400}, {s, -300, 300}, 
   PlotRange -> {-1.4*10^8, 2*10^7}, ClippingStyle -> None, 
   MeshFunctions -> {#3 &}, Mesh -> 15, MeshStyle -> Opacity[.5], 
   MeshShading -> {{Opacity[.3], Blue}, {Opacity[.8], Orange}}, Lighting -> "Neutral"];

level = -1.2 10^8; gr = Graphics3D[{Texture[contourPotentialPlot1], EdgeForm[], 
Polygon[{{-400, -300, level}, {400, -300, level}, {400, 300, level}, {-400, 300, level}}, 
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]}, Lighting -> "Neutral"];

Show[potential1, gr, PlotRange -> All, BoxRatios -> {1, 1, .6}, FaceGrids -> {Back, Left}]

If we run the above code we would get a picture like this:
enter image description here

image processing – Simple shape matching, refine ‘best’ candidate based on contour deviation ? Or alternative (Python/C++ and OpenCV etc.)

apologies if this question is not composed correctly I can revise if necessary.

I am essentially doing template matching from a large array of candidate images. I am actually interested in the ‘best’ available match – best being subjective, but ultimately what a human would likely perceive as closest (smooth outline, retaining shape, etc).

I have done a lot of work on identifying close matches, but Hu and Zernike scoring aren’t getting me that final step.

The image I have attached shows (I just drew these, to illustrate the point, they are not actual data) a template and two matches showing the deviation from the templates contour.

The red image shows (theoretical) deviations for a lower quality match and green a better quality match. Essentially I am defining the lower quality match as more extreme swings in the deviation from my templates contour – which I am trying to illustrate on my (poorly drawn) graph – I’m not sure how to extract this data, or analyze it effectively – just considering it.enter image description here

I am really looking for advice or concepts on how I can refine my ‘top 500’ hu scored matches to get the best defined shape match (or, at least improve my ranking). My actual data is a similar complexity ie not photos and I am certainly seeing some better matches with a worst hu score in my current ranking. I’m primarily using Python/C++ and OpenCV etc.

Any advice ?

plotting – Ugly streaks caused by Arg in a contour plot

I had a more general question about a similar problem more than two years ago, Getting rid of discontinuities in plots caused by square roots, logarithms, `Arg`, etc, which got lots of interesting feedback but no definite answer.

So I decided to focus on something more obviously urgent and simple.

Here is the result of

ContourPlot[Log[Abs[Sinh[Sinh[x+I y]]]],{x,-4,4},{y,-4,4},
 MeshFunctions->{Arg[Sinh[Sinh[#1+I #2]]]&},
 Mesh->11,PlotPoints->150,Contours->50]

enter image description here

I guess I don’t even need to ask: I want to get rid of those rough thick black lines, that’s all.

PS Heard rumours that it might be incorporated in version 12. I have 11.0.1.0, but still, let me know if this is the case.

plotting – Contour plot in Mathematica with logarithmic scale

Thanks for contributing an answer to Mathematica Stack Exchange!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.

To learn more, see our tips on writing great answers.

laplace transform – ML inequality for Bromwich contour

So i’m applying the inverse Laplace Transform to the following function:
$$
frac{1}{s} exp(-sqrt{s/k}x)
$$

Thus, the inverse Laplace transform is given by:
$$
u(x,t) = frac{1}{2pi i}int^{gamma+iinfty}_{gamma-iinfty} frac{1}{s}expbigg(-sqrt{frac{s}{k}}xbigg) exp(st) ds.
$$

the following contour is used as we have a multivalued function:
(enter image description here)(1)

For the line AB. we parameterise by letting $s = u exp (i pi)$

For the line ED, we parameterise by letting $s = u exp (-i pi)$

For the small circle C, we parameterise by letting $s = epsilon exp(i theta)$

we can assume that $K$ and $F$ go to zero as $R rightarrow infty$.

My question is:

I want to prove that the arcs given by $K$ and $F$ go to zero as $R rightarrow infty$.
How do you parameterise the arcs $K$ and $F$ so that they go to zero as $R rightarrow infty$?
I know that you are supposed to use the ML inequality/estimation lemma but these arcs do not look like a semicircular arc or a quarter of a circle so I’m stuck here.
(1): https://i.stack.imgur.com/TCyaJ.png

contour integration – Should we ignore negative term in ML inequality?

I have this problem:
$$L: z=-xi+iR,, xiin[-gamma,0]$$
Which $R$ is a big number goes to infinity and $gamma$ is a finite number.

Then,
$$begin{align}
left|int_{L} e^{zt} Bbb dzright|
&leq -int_{-gamma}^{0} |e^{-xi cos Rt}|,|ie^{-xi}sin Rt| Bbb d xi
end{align}$$

Since there’s a negative term there, means the integral value must be negative. But is it possible to produce the negative value since the integrand is inside the modulus? Btw the contour is move from right to the left.

plotting – How to plot3D contour plot and contour3D

I want to plot 3D plot and contour plot separate and if we want to combine them how is it possible. It does not make even simple draw. Kindly help me pointing out error and correct the code

{`(Alpha) = 2/10; (Beta)1 = 5/10;(*k=5/10;Fr=20/10;*)S1 = 6/10; (Delta)1 = 7/10; R1 = 3/10; Ec =5/10; Pr = 6.78;sol = ParametricNDSolve({(1 + 1/(Beta)1)*2* f'''((Eta)) - (1 + 1/(Beta)1)*k*f'((Eta)) +2*f((Eta))*f''((Eta)) - f'((Eta))*f'((Eta)) + g((Eta))*g((Eta)) - Fr*f'((Eta))*f'((Eta)) == 0, (1 + 1/(Beta)1)*(g''((Eta)) - k*g((Eta))) + 2*f((Eta))*g'((Eta)) - 2*f'((Eta))*g((Eta)) -Fr*g((Eta))*g((Eta)) == 0, (1 + 4/3*R1)*j''((Eta)) + Pr*f((Eta))*j'((Eta)) + 6*Pr *Ec*f'((Eta))*f'((Eta)) + 2*(1 + 1/(Beta)1)*Pr *Ec*f''((Eta))*f''((Eta)) + 2*(1 + 1/(Beta)1)*Pr *Ec*g'((Eta))*g'((Eta)) == 0,f(0) == S1, f'(0) == (Delta)1, f'(10) == 0, g(0) == 1,g(10) == 0, j(0) == 1, j(10) == 0}, {f, g, j}, {(Eta), 0,10}, {Fr, k});A2 = Plot3D(Evaluate((f'(Fr, 0.3)((Eta))) /. sol), {(Eta), 0, 8}, {Fr, 0, 3},PlotRange -> All) A3 = ContourPlot(Evaluate((f'(Fr, 0.3)((Eta))) /. sol), {(Eta), 0, 8}, {Fr, 0, 3},PlotRange -> All) A4 = ContourPlot3D(Evaluate((f'(Fr, 0.3)((Eta))) /. sol), {(Eta), 0, 8}, {Fr, 0, 3}) A5 = ContourPlot3D(Evaluate((f'(Fr, k)(0)) /. sol), {k, 0, 8}, {Fr, 0, 3})`}