1
$\begingroup$

When plotting the following data with PlotThemes "Business" or "Web", the lowest dat1 does not get a mesh at all. But without these PlotThemes, it certainly gets a normal mesh. Is it possible to recover a mesh in the same style?

Table[ListPlot3D[{dat1, dat2, dat3}, PlotTheme -> {"Grid", theme}, 
  PlotStyle -> Directive[Opacity[0.8]], 
  ImageSize -> Medium], {theme, {"Business", "Web"}}]

enter image description here

The data are as follows

{dat1, dat2, dat3}={{{-0.499997, 1.1159*10^-24, 0.00166667}, {-0.447933, -0.00745823, 
   0.00193863}, {-0.329345, -0.0251481, 
   0.00258457}, {-0.185936, -0.0478652, 
   0.00341362}, {-0.00466817, -0.0702993, 
   0.00421323}, {0.17738, -0.063759, 
   0.00390719}, {0.291455, -0.0496345, 
   0.00335362}, {0.361163, -0.0380495, 
   0.00291912}, {0.404419, -0.0294144, 
   0.00260623}, {0.431835, -0.023104, 
   0.00238468}, {0.449641, -0.0184808, 
   0.00222726}, {0.461516, -0.0150467, 
   0.00211387}, {0.469674, -0.0124357, 
   0.00203034}, {0.475486, -0.0103782, 
   0.00196665}, {0.479852, -0.00866813, 
   0.00191543}, {0.483422, -0.00713736, 
   0.00187089}, {0.486726, -0.00564181, 
   0.00182817}, {0.490211, -0.00406795, 
   0.00178344}, {0.494104, -0.00238877, 
   0.00173548}, {0.497943, -0.000816103, 
   0.00169024}, {0.499985, -4.80375*10^-6, 0.00166681}, {-0.499997, 
   0., 0.00166667}, {-0.447933, 0., 0.00166667}, {-0.329345, 0., 
   0.00166667}, {-0.185936, 0., 0.00166667}, {-0.00466817, 0., 
   0.00166667}, {0.17738, 0., 0.00166667}, {0.291455, 0., 
   0.00166667}, {0.361163, 0., 0.00166667}, {0.404419, 0., 
   0.00166667}, {0.431835, 0., 0.00166667}, {0.449641, 0., 
   0.00166667}, {0.461516, 0., 0.00166667}, {0.469674, 0., 
   0.00166667}, {0.475486, 0., 0.00166667}, {0.479852, 0., 
   0.00166667}, {0.483422, 0., 0.00166667}, {0.486726, 0., 
   0.00166667}, {0.490211, 0., 0.00166667}, {0.494104, 0., 
   0.00166667}, {0.497943, 0., 0.00166667}, {0.499985, 0., 
   0.00166667}, {-0.499997, -1.1159*10^-24, 0.00166667}, {-0.447933, 
   0.00745823, 0.00193863}, {-0.329345, 0.0251481, 
   0.00258457}, {-0.185936, 0.0478652, 0.00341362}, {-0.00466817, 
   0.0702993, 0.00421323}, {0.17738, 0.063759, 0.00390719}, {0.291455,
    0.0496345, 0.00335362}, {0.361163, 0.0380495, 
   0.00291912}, {0.404419, 0.0294144, 0.00260623}, {0.431835, 
   0.023104, 0.00238468}, {0.449641, 0.0184808, 
   0.00222726}, {0.461516, 0.0150467, 0.00211387}, {0.469674, 
   0.0124357, 0.00203034}, {0.475486, 0.0103782, 
   0.00196665}, {0.479852, 0.00866813, 0.00191543}, {0.483422, 
   0.00713736, 0.00187089}, {0.486726, 0.00564181, 
   0.00182817}, {0.490211, 0.00406795, 0.00178344}, {0.494104, 
   0.00238877, 0.00173548}, {0.497943, 0.000816103, 
   0.00169024}, {0.499985, 4.80375*10^-6, 
   0.00166681}}, {{-0.499775, -2.23009*10^-29, 
   0.015}, {-0.447627, -0.0062654, 0.0174493}, {-0.328834, -0.0211268,
    0.0232669}, {-0.185163, -0.0402156, 
   0.0307354}, {-0.00369302, -0.0590547, 
   0.0379344}, {0.177888, -0.0534841, 
   0.0351482}, {0.291581, -0.041624, 
   0.0301654}, {0.361089, -0.0319073, 
   0.0262588}, {0.404244, -0.0246666, 
   0.0234461}, {0.43161, -0.0193754, 
   0.0214547}, {0.449392, -0.0154988, 
   0.0200398}, {0.461257, -0.0126193, 
   0.0190205}, {0.469412, -0.0104297, 
   0.0182696}, {0.475225, -0.00870432, 
   0.0176971}, {0.479594, -0.00727014, 
   0.0172366}, {0.483169, -0.00598633, 
   0.0168362}, {0.486479, -0.004732, 
   0.0164521}, {0.489972, -0.00341197, 
   0.0160499}, {0.493872, -0.00200358, 
   0.0156187}, {0.497717, -0.000684506, 
   0.015212}, {0.499763, -4.02915*10^-6, 0.0150012}, {-0.499775, 0., 
   0.015}, {-0.447627, 0., 0.015}, {-0.328834, 0., 0.015}, {-0.185163,
    0., 0.015}, {-0.00369302, 0., 0.015}, {0.177888, 0., 
   0.015}, {0.291581, 0., 0.015}, {0.361089, 0., 0.015}, {0.404244, 
   0., 0.015}, {0.43161, 0., 0.015}, {0.449392, 0., 0.015}, {0.461257,
    0., 0.015}, {0.469412, 0., 0.015}, {0.475225, 0., 
   0.015}, {0.479594, 0., 0.015}, {0.483169, 0., 0.015}, {0.486479, 
   0., 0.015}, {0.489972, 0., 0.015}, {0.493872, 0., 
   0.015}, {0.497717, 0., 0.015}, {0.499763, 0., 0.015}, {-0.499775, 
   2.23009*10^-29, 0.015}, {-0.447627, 0.0062654, 
   0.0174493}, {-0.328834, 0.0211268, 0.0232669}, {-0.185163, 
   0.0402156, 0.0307354}, {-0.00369302, 0.0590547, 
   0.0379344}, {0.177888, 0.0534841, 0.0351482}, {0.291581, 0.041624, 
   0.0301654}, {0.361089, 0.0319073, 0.0262588}, {0.404244, 0.0246666,
    0.0234461}, {0.43161, 0.0193754, 0.0214547}, {0.449392, 0.0154988,
    0.0200398}, {0.461257, 0.0126193, 0.0190205}, {0.469412, 
   0.0104297, 0.0182696}, {0.475225, 0.00870432, 
   0.0176971}, {0.479594, 0.00727014, 0.0172366}, {0.483169, 
   0.00598633, 0.0168362}, {0.486479, 0.004732, 0.0164521}, {0.489972,
    0.00341197, 0.0160499}, {0.493872, 0.00200358, 
   0.0156187}, {0.497717, 0.000684506, 0.015212}, {0.499763, 
   4.02915*10^-6, 0.0150012}}, {{-0.499375, -1.99206*10^-21, 
   0.025}, {-0.447075, -0.00311103, 0.0290871}, {-0.327912, -0.010491,
    0.0387955}, {-0.183768, -0.0199738, 
   0.0512644}, {-0.00193427, -0.0293216, 
   0.0632699}, {0.178798, -0.0264874, 
   0.0585302}, {0.291806, -0.0206033, 
   0.0502241}, {0.360955, -0.0157925, 
   0.0437245}, {0.403929, -0.0122092, 
   0.0390471}, {0.431205, -0.00959079, 
   0.0357357}, {0.448944, -0.00767234, 
   0.0333829}, {0.460791, -0.00624721, 
   0.0316879}, {0.46894, -0.00516351, 
   0.0304392}, {0.474755, -0.00430945, 
   0.0294868}, {0.47913, -0.0035995, 
   0.0287209}, {0.482714, -0.00296393, 
   0.0280548}, {0.486035, -0.00234293, 
   0.0274159}, {0.489541, -0.00168937, 
   0.0267468}, {0.493454, -0.000992039, 
   0.0260294}, {0.497311, -0.000338924, 
   0.0253527}, {0.499362, -1.99498*10^-6, 0.0250021}, {-0.499375, 0., 
   0.025}, {-0.447075, 0., 0.025}, {-0.327912, 0., 0.025}, {-0.183768,
    0., 0.025}, {-0.00193427, 0., 0.025}, {0.178798, 0., 
   0.025}, {0.291806, 0., 0.025}, {0.360955, 0., 0.025}, {0.403929, 
   0., 0.025}, {0.431205, 0., 0.025}, {0.448944, 0., 
   0.025}, {0.460791, 0., 0.025}, {0.46894, 0., 0.025}, {0.474755, 0.,
    0.025}, {0.47913, 0., 0.025}, {0.482714, 0., 0.025}, {0.486035, 
   0., 0.025}, {0.489541, 0., 0.025}, {0.493454, 0., 
   0.025}, {0.497311, 0., 0.025}, {0.499362, 0., 0.025}, {-0.499375, 
   1.99206*10^-21, 0.025}, {-0.447075, 0.00311103, 
   0.0290871}, {-0.327912, 0.010491, 0.0387955}, {-0.183768, 
   0.0199738, 0.0512644}, {-0.00193427, 0.0293216, 
   0.0632699}, {0.178798, 0.0264874, 0.0585302}, {0.291806, 0.0206033,
    0.0502241}, {0.360955, 0.0157925, 0.0437245}, {0.403929, 
   0.0122092, 0.0390471}, {0.431205, 0.00959079, 
   0.0357357}, {0.448944, 0.00767234, 0.0333829}, {0.460791, 
   0.00624721, 0.0316879}, {0.46894, 0.00516351, 
   0.0304392}, {0.474755, 0.00430945, 0.0294868}, {0.47913, 0.0035995,
    0.0287209}, {0.482714, 0.00296393, 0.0280548}, {0.486035, 
   0.00234293, 0.0274159}, {0.489541, 0.00168937, 
   0.0267468}, {0.493454, 0.000992039, 0.0260294}, {0.497311, 
   0.000338924, 0.0253527}, {0.499362, 1.99498*10^-6, 0.0250021}}}
$\endgroup$

1 Answer 1

1
$\begingroup$

MeshFunctions for the two themes is Function[{x,y,z},z]. So an almost flat surface does not show any mesh lines.

MeshFunctions /. Charting`ResolvePlotTheme["Business", Plot3D]

{Function[{System`PlotThemeDump`x, System`PlotThemeDump`y, System`PlotThemeDump`z}, System`PlotThemeDump`z]}

An alternative is to add the option MeshFunctions -> {#2&}. But then we do not get mesh lines equally spaced in the z direction:

Table[ListPlot3D[{dat1, dat2, dat3}, PlotTheme -> {"Grid", theme}, 
  MeshFunctions -> {#2 &}, PlotStyle -> Directive[Opacity[0.8]], 
  ImageSize -> Medium], {theme, {"Business", "Web"}}]

enter image description here

To get the mesh lines to look equally-spaced, we can plot dat1 separately with the option MeshFunctions -> {#2&} and combine the plots using Show:

Module[{colors =
   ("DefaultPlotStyle" /. (Method /. Charting`ResolvePlotTheme[#, Plot3D]))[[;; 3]]},        
  Show[ListPlot3D[{dat2, dat3}, PlotTheme -> {"Grid", #}, 
     PlotStyle -> colors[[2 ;;]], BaseStyle -> FaceForm[Opacity[.8]], 
     ImageSize -> Medium], 
    ListPlot3D[dat1, PlotTheme -> {"Grid", #}, 
     MeshFunctions -> {#2 &}, BaseStyle -> FaceForm[Opacity[.8]]], 
    PlotRange -> All]] & /@ {"Business", "Web"}

enter image description here

$\endgroup$
2
  • $\begingroup$ Thanks again for your solution! One minor question: why do the meshes for dat2 dat3 become denser than the original? $\endgroup$
    – xiaohuamao
    Mar 7, 2020 at 19:08
  • $\begingroup$ @xiaohuamao, meshes for dat2 and dat3 are denser than the original because the same number of meshes is drawn in a smaller vertical interval (vertical range of dat2 and dat3 is smaller than the vertical range for the three data sets). $\endgroup$
    – kglr
    Mar 7, 2020 at 21:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.