ListContourPlot sometimes leaves out requested contours
- To: mathgroup at smc.vnet.net
- Subject: [mg14016] ListContourPlot sometimes leaves out requested contours
- From: Adalbert Hanszen <hsse at amath01.amath.zeiss.de>
- Date: Wed, 16 Sep 1998 14:11:58 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Hello, Mathematica users!
The following problem arises with Mathematica 2.2 for X-Windows, with
Mathematica 2.2.3 for MS-Windows 3.x and for Mathematica 3.0.1 on
Windows-NT. Perhaps, it is present in all versions on all platforms.
ListContourPlot has an option Contours to select which contours shall be
drawn. Using
Contours->{z1,z2,...}
I experienced cases, where one or more contour lines were not drawn,
although they should show up. (In the examples which I have
investigated, they were missing around a local maximum totally within
the rectangle to be displayed and totally surrounded by a lower contour
line.) The funny thing is, that by leaving out one row of data points,
sometimes the missing contour line is drawn! - See the example below.
A similar question (in essence) was rised on June 26, 1997 in this
group, but there was only a single "Re" telling, that one has observed
similar things without being able to always reproduce it. The problem
itself was not solved, I think it was not really brought to the point.
1.) Can anybody enlighten us with the internals of ListContourPlot?
2.) Does anybody know, how ListContourPlot searches starting points for
the contours to be displayed?
3.) Does the used searching algorithm guarantee, if there are
neighbouring data points on the grid zLow, zHigh such that
zLow<zContour<=zHigh or zLow<=zContour<zHigh where zContour is one of
the requested contour line from Contours->..., that a contour line for
zContour is found and displayed between the neighbouring points?
The basic problem seems to be, to find *all* places f(z)=zContour for a
sufficiently continuous function f interpolating the data points. This
problem is non-trivial for the one dimensional case (but not, if f is
piecewise linear or quadratic). As the contour lines belong to some
interpolating function (maybe defined through the smoothed contour
lines), at least all contour lines for the conditions mentioned above
should be found!
4.) If the search starts with an initial set of starting points less
than the given data points: how can I increase the size of this set?
There is no option PlotPoints in ListContourPlot (it would not be
necessary. I also find no option to influence the kind of interpolation
used for display other than smoothing).
5.) Would it be possible to Unprotect[...] and redefine the relavant
subfunction of ListContourPlot to exchange the current search algorithm
used in ListContourPlot by a better one?
6.) has anybody out there a better ListContourPlot than the built-in
one?
The problem probably also explains, why LabelContourLines in TWJ-Packs
sometimes puts the wrong numbers at some lines. I have not yet gone
into this in full depth.
Here is a practical example which arose in my work:
list1=Get["list1",StandardForm];
list2=Table[list1[[i]],{i,1,14}];
(* watch at line 6: all requested contour lines are shown....*)
ListContourPlot[list2,Contours->{7.0,7.50,7.75}]; ListPlot[list2[[6]]];
(* But now: just add one line of data points far away at the top... *)
list3=Table[list1[[i]],{i,1,15}];
(* the 7.75-contour line is not shown, although
it should be there between the 12/13 and
between the 16/17-th data point!... *)
ListContourPlot[list3,Contours->{7.0,7.50,7.75}]; ListPlot[list3[[6]]];
The example data list1 are given at the very end.
Thanks for your help
Dipl-Math. Adalbert Hanszen <hsse at amath01.amath.zeiss.de>
=-=-=-=-=-=-=-=-=-=-=- list1 following: -=-=-=-=-=-=-=-=-=-=-=-=-=
{{6.869325565627659, 6.857446808180289, 6.84698416452472,
6.839044013465366,
6.835444160898676, 6.838852388710257, 6.852798575241432,
6.881354743109187, 6.928181744098699, 6.994654797396585,
7.077146868619937, 7.164544473802138, 7.238444442863809,
7.278535528488228, 7.272100230498775, 7.221257763984616,
7.141698944189755, 7.054062482428515, 6.975094170415043,
6.91376501445003, 6.872082501928315, 6.847822555552206,
6.837072928864801, 6.835845134205293, 6.84082633954687,
6.849584653564301, 6.860507483131376},
{6.848606869351836, 6.836551106963296, 6.825441561115646,
6.81655680454321, 6.812107405905901, 6.815557261599827,
6.831867741924336, 6.867380720881377, 6.928812585981121,
7.020628967212311, 7.140350166026214, 7.272971668894657,
7.389106082182595, 7.453451034240708, 7.44306440734425,
7.361798660875765, 7.237781854259043, 7.106273940942552,
6.99313245770147, 6.909565462216552, 6.855642082697267,
6.825922021553251, 6.813612440639452, 6.812690027396614,
6.81860345055071, 6.828253510252547, 6.839709016532673},
{6.831166586023586, 6.818804796218802, 6.806822202431263,
6.796557051130921, 6.79049499812875, 6.792824072057539,
6.810035433817112, 6.851240397180393, 6.927419588773187,
7.048185363285409, 7.214412318770605, 7.407213724886268,
7.581210478835789, 7.678514008785894, 7.662812830312304,
7.540012380127651, 7.355318811453724, 7.166242659558683,
7.011314741460387, 6.903063629338904, 6.837300521430444,
6.803521587045906, 6.791062231303412, 6.791500519714738,
6.799011573731299, 6.809921489878079, 6.822099589628805},
{6.817043971397372, 6.804487442871054, 6.791656471365898,
6.779804490475294, 6.7714859644461, 6.77135947230377,
6.787231204398493,
6.831032047612374, 6.918729720680725, 7.066877849955929,
7.282072641473021, 7.541296451056316, 7.775368510226098,
7.898166562884262, 7.87927791353267, 7.720756302741492,
7.470947261065594, 7.218671913458327, 7.020747685678399,
6.890058179238629, 6.815776282969779, 6.780840526080832,
6.770218487128766, 6.77314277418751, 6.782755059704049,
6.795052100053613, 6.807893242126157},
{6.806362108360374, 6.793987523625182, 6.780666428312756,
6.767415763746458, 6.756589666568626, 6.752882797639427,
6.764800264255748, 6.806387417746168, 6.898114727333193,
7.063710760226269, 7.316392321645329, 7.627699947925949,
7.894292920704887, 7.995723600082916, 7.985634212586519,
7.835896262540917, 7.543359718208297, 7.24094904129291,
7.011159300698578, 6.867390752489567, 6.791348917578932,
6.759415938013053, 6.752779895150521, 6.759028872274202,
6.770841445375238, 6.784271539779322, 6.797401423985501},
{6.799196257902635, 6.787645460723926, 6.774578428872485,
6.760661202603423, 6.747786840127027, 6.740166931960198,
6.746079082566222, 6.780213339826242, 6.865551878113858,
7.03093212557181, 7.295236283699719, 7.627259313017956,
7.902970343400872, 7.996110302248572, 7.987659414957541,
7.844665806473557, 7.53738885908768, 7.215402531548791,
6.97746932837246,
6.836183774752383, 6.767206272917278, 6.742488583431381,
6.741311745479563, 6.750935980260122, 6.764379123653909,
6.778189127512978, 6.790883748974068},
{6.795441504213237, 6.785564635167139, 6.773849610046728,
6.760580633535126, 6.747031321333164, 6.736500292596074,
6.736093506835191, 6.759351101707673, 6.828854299165366,
6.974949956599778, 7.220814190462863, 7.542447317973985,
7.829541091530026, 7.9620692975927, 7.943383448626827,
7.764894721637197,
7.453982997867057, 7.145466823376087, 6.926775774655749,
6.804154802278788, 6.749736584700658, 6.734591732377261,
6.738703044256149, 6.75053592584682, 6.764224546869137,
6.777149162291618, 6.788376700768024},
{6.794697276462893, 6.787421832246713, 6.778352152376936,
6.767463017733423, 6.755416719630179, 6.744416090268848,
6.739771057016515, 6.75239388809188, 6.801686192537496,
6.915657585282088, 7.119735865018216, 7.404004124166268,
7.686687594398495, 7.847385605376641, 7.821630590859125,
7.618588813192664, 7.323588872601439, 7.055980279390967,
6.877227343884191, 6.783484520310445, 6.746418064934555,
6.739901761960156, 6.747023873329745, 6.758657388086038,
6.770525822975606, 6.780955291636678, 6.789528015252598},
{6.796200946991733, 6.792336312625754, 6.787117104294887,
6.780355952250216, 6.772260746815418, 6.764029939369476,
6.759015644178421, 6.76471000548955, 6.795343672818852,
6.872998368186963, 7.020922115367739, 7.240108063466045,
7.476116583471624, 7.623179936322296, 7.598701614300163,
7.417115553871529, 7.176544123145663, 6.973803850224111,
6.84624627369554, 6.783611374063736, 6.761485490560134,
6.759713929069829, 6.766103293356892, 6.774508616286978,
6.782309244935895, 6.788655921699076, 6.793487473481822},
{6.798843532548795, 6.798864003980891, 6.798267211398282,
6.796852455855644, 6.794573298246401, 6.791851752528667,
6.790236127569599, 6.793601855062521, 6.809880299306096,
6.852243305580604, 6.936040842143472, 7.06534822862427,
7.210537802571185, 7.304261613575677, 7.28847574195284,
7.173658599499304, 7.027289897920135, 6.908998106789416,
6.837486100954453, 6.803623736569726, 6.791859773455964,
6.790397167296545, 6.79256282306449, 6.795254892839097,
6.797317227735535, 6.798499273676815, 6.798909527673434},
{6.801283697965363, 6.805157261023293, 6.809231497554554,
6.813359171108611, 6.817346106748447, 6.820991545034754,
6.824220121769551, 6.827389937259499, 6.831841819884529,
6.840505282901545, 6.857607689946297, 6.885558414681534,
6.918664057449437, 6.940765997827593, 6.937008471045154,
6.910113263656908, 6.87715762472071, 6.851997861276829,
6.83755183645306,
6.83039593991549, 6.826498926538191, 6.823391927355683,
6.820061489768098, 6.816308716274791, 6.812263537647862,
6.808132796434858, 6.804099817453189},
{6.802145170545397, 6.809273864209884, 6.8172306967026,
6.825860613291387,
6.834754230299275, 6.843035521148423, 6.849024467605643,
6.849777219066632, 6.840678136343654, 6.815720503385994,
6.769878212185215, 6.705025136149717, 6.637228682091514,
6.595361826521358, 6.602327920078329, 6.654070533694507,
6.723571008896335, 6.784241782976494, 6.824271607969944,
6.844394104095141, 6.850317425307452, 6.847790357210231,
6.840963416486971, 6.832395178795731, 6.823510395265032,
6.815033376006613, 6.807289270333292},
{6.800249703627458, 6.809554680648106, 6.819896349125625,
6.830943984417198, 6.841862457018158, 6.85088354824925,
6.854629245430264, 6.847223206399466, 6.819626528804421,
6.76060359302745, 6.662028890465112, 6.530415356594877,
6.398583488581318, 6.319447386577963, 6.332505286765577,
6.430881705091884, 6.567406804090728, 6.69221862701556,
6.780021698844278, 6.829584709840593, 6.850741618912278,
6.854424473690285, 6.848817233421117, 6.839041081406548,
6.827963705723939, 6.817049411744977, 6.806965748088736},
{6.794819297112645, 6.804951639529726, 6.81580871286505,
6.826689466265042, 6.836105036765136, 6.841196817181458,
6.836905189493197, 6.815081868796712, 6.764370446168952,
6.672870182360744, 6.536373004050822, 6.371413048149445,
6.221075895377967, 6.137296291279374, 6.15079364689932,
6.256641872481329, 6.416153396417787, 6.57673264107763,
6.701755630981128, 6.781435975108895, 6.82320993167174,
6.839365368887625, 6.84049889683353, 6.833867180181343,
6.823850894493469, 6.812871760718681, 6.802162017984143},
{6.785588568741793, 6.795200209663352, 6.804761214427468,
6.813073155293877, 6.817890207403784, 6.815277669232163,
6.798826396915947, 6.759123045400022, 6.68465510547851,
6.566452446333961,
6.408494217242655, 6.239297094839491, 6.106266779905343,
6.04265678451334,
6.052316040121886, 6.135709223622327, 6.282917230445919,
6.453390250570421, 6.602389924830453, 6.708544539585568,
6.772622872460932, 6.805044485541785, 6.817011015609027,
6.817131938311185, 6.8110814187891, 6.802269782470764,
6.792609602902421}}