Contour Edge of Plot Issue

3 visualizaciones (últimos 30 días)
Brendan Whalen
Brendan Whalen el 8 de Jun. de 2020
Respondida: Walter Roberson el 10 de Jun. de 2020
I am attempting to plot temperature at different locations in an x-z crosssection. For some reason the contour plot seems to have issues handling the edge of the plot where the contour lines end. Here is a picture of what it looks like (the issue can be seen on the left edge of the plot):
The issue becomes worse as the plot is restricted in size and more contours hit the left edge. I've also attached the code that I am running.
  2 comentarios
Walter Roberson
Walter Roberson el 8 de Jun. de 2020
Are you referring to the fact that the lines appear to touch? That can happen with sufficiently steep gradient with plots that are not zoomed in sufficiently far.
Brendan Whalen
Brendan Whalen el 8 de Jun. de 2020
I am referring to the fact that the contour on the lowest contour does not end at the edge of the plot. Here is another image where 2 contour lines can be seen with the same issue when they hit the left edge of the plot:

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 10 de Jun. de 2020
[W,Z] = meshgrid(WD,ZD);
Your WD and ZD each have duplicates inside them. Your resulting W and Z have duplicates. You griddata() at those places, so you get duplicate outputs.
You should be doing something like
N = 500;
minWD = min(WD); maxWD = max(WD);
minZD = min(ZD); maxZD = max(ZD);
WD_vec = linspace(minWD, maxWD, N);
ZD_vec = linspace(minZD, maxZD, N);
[W, Z] = meshgrid(WD_vec, ZD_vec);
Or if you prefer compactness
[W, Z] = meshgrid( linspace(min(WD), max(WD), N), linspace(min(ZD), max(ZD), N));

Categorías

Más información sobre Contour Plots en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by