7
$\begingroup$

In a ListPlot3D[ ] I want to have the Mesh at the same positions as the ticks. For some reason this isn't default if both are chosen Automatic.

So my question is if there is some function to read (or reproduce) the automatically generated Ticks as a list e.g. xTicksList and yTicksList and than use this like

Mesh-> {xTicksList,yTicksList}

Alternative solutions are of course also welcome. But no solutions with explicite values, this isn't what I want, because finally I want to use this in a more general recipe.

Edit:

Easy call:

SetDirectory["./"]
data = Import["file.dat"];
ListPlot3D[data, ViewPoint -> {0, -2, 4}]

Data to work on:

     -1.300000000000       0.210526315789       0.980235619886
     -1.163157894737       0.210526315789       0.979505821537
     -1.026315789474       0.210526315789       1.097953636927
     -0.889473684211       0.210526315789       1.102989687180
     -0.752631578947       0.210526315789       1.098700823572
     -0.615789473684       0.210526315789       1.125990693356
     -0.478947368421       0.210526315789       1.211353461701
     -0.342105263158       0.210526315789       1.815613507388
     -0.205263157895       0.210526315789       1.045807948880
     -0.068421052632       0.210526315789       0.000001971641
      0.068421052632       0.210526315789       0.000001971641
      0.205263157895       0.210526315789       1.045807948880
      0.342105263158       0.210526315789       1.815613507388
      0.478947368421       0.210526315789       1.211353461701
      0.615789473684       0.210526315789       1.125990693356
      0.752631578947       0.210526315789       1.098700823572
      0.889473684211       0.210526315789       1.102989687180
      1.026315789474       0.210526315789       1.097953636927
      1.163157894737       0.210526315789       0.979505821537
      1.300000000000       0.210526315789       0.980235619886
     -1.300000000000       0.421052631579       0.980942994071
     -1.163157894737       0.421052631579       0.981933173223
     -1.026315789474       0.421052631579       1.103154056150
     -0.889473684211       0.421052631579       1.107281088495
     -0.752631578947       0.421052631579       1.106941920492
     -0.615789473684       0.421052631579       1.146919259544
     -0.478947368421       0.421052631579       1.309678535944
     -0.342105263158       0.421052631579       0.584224780318
     -0.205263157895       0.421052631579       0.700847812228
     -0.068421052632       0.421052631579       0.000006770074
      0.068421052632       0.421052631579       0.000006770074
      0.205263157895       0.421052631579       0.700847812228
      0.342105263158       0.421052631579       0.584224780318
      0.478947368421       0.421052631579       1.309678535944
      0.615789473684       0.421052631579       1.146919259544
      0.752631578947       0.421052631579       1.106941920492
      0.889473684211       0.421052631579       1.107281088495
      1.026315789474       0.421052631579       1.103154056150
      1.163157894737       0.421052631579       0.981933173223
      1.300000000000       0.421052631579       0.980942994071
     -1.300000000000       0.631578947368       0.982279600261
     -1.163157894737       0.631578947368       0.986279051512
     -1.026315789474       0.631578947368       1.111702792051
     -0.889473684211       0.631578947368       1.114982129224
     -0.752631578947       0.631578947368       1.122873224846
     -0.615789473684       0.631578947368       1.194737734850
     -0.478947368421       0.631578947368       1.930464394003
     -0.342105263158       0.631578947368       0.560661235292
     -0.205263157895       0.631578947368       0.615345975499
     -0.068421052632       0.631578947368       0.964754106066
      0.068421052632       0.631578947368       0.964754106066
      0.205263157895       0.631578947368       0.615345975499
      0.342105263158       0.631578947368       0.560661235292
      0.478947368421       0.631578947368       1.930464394003
      0.615789473684       0.631578947368       1.194737734850
      0.752631578947       0.631578947368       1.122873224846
      0.889473684211       0.631578947368       1.114982129224
      1.026315789474       0.631578947368       1.111702792051
      1.163157894737       0.631578947368       0.986279051512
      1.300000000000       0.631578947368       0.982279600261
     -1.300000000000       0.842105263158       0.984506863561
     -1.163157894737       0.842105263158       0.993017144639
     -1.026315789474       0.842105263158       1.123329136135
     -0.889473684211       0.842105263158       1.127086080172
     -0.752631578947       0.842105263158       1.151323601756
     -0.615789473684       0.842105263158       1.316936571158
     -0.478947368421       0.842105263158       0.533092973179
     -0.342105263158       0.842105263158       0.546076002707
     -0.205263157895       0.842105263158       0.576957097781
     -0.068421052632       0.842105263158       0.684846595150
      0.068421052632       0.842105263158       0.684846595150
      0.205263157895       0.842105263158       0.576957097781
      0.342105263158       0.842105263158       0.546076002707
      0.478947368421       0.842105263158       0.533092973179
      0.615789473684       0.842105263158       1.316936571158
      0.752631578947       0.842105263158       1.151323601756
      0.889473684211       0.842105263158       1.127086080172
      1.026315789474       0.842105263158       1.123329136135
      1.163157894737       0.842105263158       0.993017144639
      1.300000000000       0.842105263158       0.984506863561
     -1.300000000000       1.052631578947       0.988041894481
     -1.163157894737       1.052631578947       1.002844293634
     -1.026315789474       1.052631578947       1.137460222080
     -0.889473684211       1.052631578947       1.145431494008
     -0.752631578947       1.052631578947       1.204639094902
     -0.615789473684       1.052631578947       2.034283267433
     -0.478947368421       1.052631578947       0.527426104920
     -0.342105263158       1.052631578947       0.536322515501
     -0.205263157895       1.052631578947       0.555643903601
     -0.068421052632       1.052631578947       1.542776620591
      0.068421052632       1.052631578947       1.542776620591
      0.205263157895       1.052631578947       0.555643903601
      0.342105263158       1.052631578947       0.536322515501
      0.478947368421       1.052631578947       0.527426104920
      0.615789473684       1.052631578947       2.034283267433
      0.752631578947       1.052631578947       1.204639094902
      0.889473684211       1.052631578947       1.145431494008
      1.026315789474       1.052631578947       1.137460222080
      1.163157894737       1.052631578947       1.002844293634
      1.300000000000       1.052631578947       0.988041894481
     -1.300000000000       1.263157894737       0.993507698008
     -1.163157894737       1.263157894737       1.016663871059
     -1.026315789474       1.263157894737       1.153029591526
     -0.889473684211       1.263157894737       1.173527252601
     -0.752631578947       1.263157894737       1.324259264609
     -0.615789473684       1.263157894737       0.520310839569
     -0.478947368421       1.263157894737       0.523127565540
     -0.342105263158       1.263157894737       0.529437718570
     -0.205263157895       1.263157894737       0.542365083073
     -0.068421052632       1.263157894737       1.251779214963
      0.068421052632       1.263157894737       1.251779214963
      0.205263157895       1.263157894737       0.542365083073
      0.342105263158       1.263157894737       0.529437718570
      0.478947368421       1.263157894737       0.523127565540
      0.615789473684       1.263157894737       0.520310839569
      0.752631578947       1.263157894737       1.324259264609
      0.889473684211       1.263157894737       1.173527252601
      1.026315789474       1.263157894737       1.153029591526
      1.163157894737       1.263157894737       1.016663871059
      1.300000000000       1.263157894737       0.993507698008
     -1.300000000000       1.473684210526       1.001780955507
     -1.163157894737       1.473684210526       1.035419641030
     -1.026315789474       1.473684210526       1.168300600319
     -0.889473684211       1.473684210526       1.218742366781
     -0.752631578947       1.473684210526       1.820497914358
     -0.615789473684       1.473684210526       0.517801652652
     -0.478947368421       1.473684210526       0.519782526335
     -0.342105263158       1.473684210526       0.524378305806
     -0.205263157895       1.473684210526       1.497512379500
     -0.068421052632       1.473684210526       1.158442502764
      0.068421052632       1.473684210526       1.158442502764
      0.205263157895       1.473684210526       1.497512379500
      0.342105263158       1.473684210526       0.524378305806
      0.478947368421       1.473684210526       0.519782526335
      0.615789473684       1.473684210526       0.517801652652
      0.752631578947       1.473684210526       1.820497914358
      0.889473684211       1.473684210526       1.218742366781
      1.026315789474       1.473684210526       1.168300600319
      1.163157894737       1.473684210526       1.035419641030
      1.300000000000       1.473684210526       1.001780955507
     -1.300000000000       1.684210526316       1.013974303940
     -1.163157894737       1.684210526316       1.059492763356
     -1.026315789474       1.684210526316       1.180869891090
     -0.889473684211       1.684210526316       1.299514133592
     -0.752631578947       1.684210526316       0.516453133533
     -0.615789473684       1.684210526316       0.515737848476
     -0.478947368421       1.684210526316       0.517124685004
     -0.342105263158       1.684210526316       0.520545139810
     -0.205263157895       1.684210526316       1.214149849511
     -0.068421052632       1.684210526316       1.111669990419
      0.068421052632       1.684210526316       1.111669990419
      0.205263157895       1.684210526316       1.214149849511
      0.342105263158       1.684210526316       0.520545139810
      0.478947368421       1.684210526316       0.517124685004
      0.615789473684       1.684210526316       0.515737848476
      0.752631578947       1.684210526316       0.516453133533
      0.889473684211       1.684210526316       1.299514133592
      1.026315789474       1.684210526316       1.180869891090
      1.163157894737       1.684210526316       1.059492763356
      1.300000000000       1.684210526316       1.013974303940
     -1.300000000000       1.894736842105       1.031151313623
     -1.163157894737       1.894736842105       1.087145840815
     -1.026315789474       1.894736842105       1.188079272660
     -0.889473684211       1.894736842105       1.480552497483
     -0.752631578947       1.894736842105       0.514891129597
     -0.615789473684       1.894736842105       0.514017825943
     -0.478947368421       1.894736842105       0.514975893386
     -0.342105263158       1.894736842105       1.653213278836
     -0.205263157895       1.894736842105       1.132316352893
     -0.068421052632       1.894736842105       1.083852929370
      0.068421052632       1.894736842105       1.083852929370
      0.205263157895       1.894736842105       1.132316352893
      0.342105263158       1.894736842105       1.653213278836
      0.478947368421       1.894736842105       0.514975893386
      0.615789473684       1.894736842105       0.514017825943
      0.752631578947       1.894736842105       0.514891129597
      0.889473684211       1.894736842105       1.480552497483
      1.026315789474       1.894736842105       1.188079272660
      1.163157894737       1.894736842105       1.087145840815
      1.300000000000       1.894736842105       1.031151313623
     -1.300000000000       2.105263157895       1.053263797252
     -1.163157894737       2.105263157895       1.112054099666
     -1.026315789474       2.105263157895       1.187887756512
     -0.889473684211       2.105263157895       2.414939312234
     -0.752631578947       2.105263157895       0.513547775105
     -0.615789473684       2.105263157895       0.512568414028
     -0.478947368421       2.105263157895       0.513214034428
     -0.342105263158       2.105263157895       1.234630789787
     -0.205263157895       2.105263157895       1.093026423469
     -0.068421052632       2.105263157895       1.065649778360
      0.068421052632       2.105263157895       1.065649778360
      0.205263157895       2.105263157895       1.093026423469
      0.342105263158       2.105263157895       1.234630789787
      0.478947368421       2.105263157895       0.513214034428
      0.615789473684       2.105263157895       0.512568414028
      0.752631578947       2.105263157895       0.513547775105
      0.889473684211       2.105263157895       2.414939312234
      1.026315789474       2.105263157895       1.187887756512
      1.163157894737       2.105263157895       1.112054099666
      1.300000000000       2.105263157895       1.053263797252
     -1.300000000000       2.315789473684       1.076657703675
     -1.163157894737       2.315789473684       1.123492475408
     -1.026315789474       2.315789473684       1.179776702031
     -0.889473684211       2.315789473684       0.517636004512
     -0.752631578947       2.315789473684       0.512380796022
     -0.615789473684       2.315789473684       0.511335258693
     -0.478947368421       2.315789473684       0.519172187319
     -0.342105263158       2.315789473684       1.138037117826
     -0.205263157895       2.315789473684       1.070113678169
     -0.068421052632       2.315789473684       1.052968436145
      0.068421052632       2.315789473684       1.052968436145
      0.205263157895       2.315789473684       1.070113678169
      0.342105263158       2.315789473684       1.138037117826
      0.478947368421       2.315789473684       0.519172187319
      0.615789473684       2.315789473684       0.511335258693
      0.752631578947       2.315789473684       0.512380796022
      0.889473684211       2.315789473684       0.517636004512
      1.026315789474       2.315789473684       1.179776702031
      1.163157894737       2.315789473684       1.123492475408
      1.300000000000       2.315789473684       1.076657703675
     -1.300000000000       2.526315789474       1.091865153557
     -1.163157894737       2.526315789474       1.114876898745
     -1.026315789474       2.526315789474       1.164983245160
     -0.889473684211       2.526315789474       0.516400089510
     -0.752631578947       2.526315789474       0.511360095534
     -0.615789473684       2.526315789474       0.510277474936
     -0.478947368421       2.526315789474       1.335414688817
     -0.342105263158       2.526315789474       1.094672456667
     -0.205263157895       2.526315789474       1.055241265973
     -0.068421052632       2.526315789474       1.043728713057
      0.068421052632       2.526315789474       1.043728713057
      0.205263157895       2.526315789474       1.055241265973
      0.342105263158       2.526315789474       1.094672456667
      0.478947368421       2.526315789474       1.335414688817
      0.615789473684       2.526315789474       0.510277474936
      0.752631578947       2.526315789474       0.511360095534
      0.889473684211       2.526315789474       0.516400089510
      1.026315789474       2.526315789474       1.164983245160
      1.163157894737       2.526315789474       1.114876898745
      1.300000000000       2.526315789474       1.091865153557
     -1.300000000000       2.736842105263       1.089274605713
     -1.163157894737       2.736842105263       1.091729061725
     -1.026315789474       2.736842105263       1.145851846320
     -0.889473684211       2.736842105263       0.515298422848
     -0.752631578947       2.736842105263       0.510461989727
     -0.615789473684       2.736842105263       0.509366151457
     -0.478947368421       2.736842105263       1.174696797334
     -0.342105263158       2.736842105263       1.070314416559
     -0.205263157895       2.736842105263       1.044899739158
     -0.068421052632       2.736842105263       1.036763511509
      0.068421052632       2.736842105263       1.036763511509
      0.205263157895       2.736842105263       1.044899739158
      0.342105263158       2.736842105263       1.070314416559
      0.478947368421       2.736842105263       1.174696797334
      0.615789473684       2.736842105263       0.509366151457
      0.752631578947       2.736842105263       0.510461989727
      0.889473684211       2.736842105263       0.515298422848
      1.026315789474       2.736842105263       1.145851846320
      1.163157894737       2.736842105263       1.091729061725
      1.300000000000       2.736842105263       1.089274605713
     -1.300000000000       2.947368421053       1.070982617491
     -1.163157894737       2.947368421053       1.064870984592
     -1.026315789474       2.947368421053       1.124857239675
     -0.889473684211       2.947368421053       0.514306616086
     -0.752631578947       2.947368421053       0.509667542587
     -0.615789473684       2.947368421053       2.571106436571
     -0.478947368421       2.947368421053       1.113772367051
     -0.342105263158       2.947368421053       1.054892518975
     -0.205263157895       2.947368421053       1.037352203431
     -0.068421052632       2.947368421053       1.031369828620
      0.068421052632       2.947368421053       1.031369828620
      0.205263157895       2.947368421053       1.037352203431
      0.342105263158       2.947368421053       1.054892518975
      0.478947368421       2.947368421053       1.113772367051
      0.615789473684       2.947368421053       2.571106436571
      0.752631578947       2.947368421053       0.509667542587
      0.889473684211       2.947368421053       0.514306616086
      1.026315789474       2.947368421053       1.124857239675
      1.163157894737       2.947368421053       1.064870984592
      1.300000000000       2.947368421053       1.070982617491
     -1.300000000000       3.157894736842       1.047866508842
     -1.163157894737       3.157894736842       1.041164829929
     -1.026315789474       3.157894736842       1.103940126372
     -0.889473684211       3.157894736842       0.513409767406
     -0.752631578947       3.157894736842       0.508961575187
     -0.615789473684       3.157894736842       1.326407622207
     -0.478947368421       3.157894736842       1.082011967173
     -0.342105263158       3.157894736842       1.044357195862
     -0.205263157895       3.157894736842       1.031641411387
     -0.068421052632       3.157894736842       1.027100715053
      0.068421052632       3.157894736842       1.027100715053
      0.205263157895       3.157894736842       1.031641411387
      0.342105263158       3.157894736842       1.044357195862
      0.478947368421       3.157894736842       1.082011967173
      0.615789473684       3.157894736842       1.326407622207
      0.752631578947       3.157894736842       0.508961575187
      0.889473684211       3.157894736842       0.513409767406
      1.026315789474       3.157894736842       1.103940126372
      1.163157894737       3.157894736842       1.041164829929
      1.300000000000       3.157894736842       1.047866508842
     -1.300000000000       3.368421052632       1.027707541691
     -1.163157894737       3.368421052632       1.022670717601
     -1.026315789474       3.368421052632       1.084322269326
     -0.889473684211       3.368421052632       0.512595867665
     -0.752631578947       3.368421052632       0.508332439171
     -0.615789473684       3.368421052632       1.179765630236
     -0.478947368421       3.368421052632       1.062774142729
     -0.342105263158       3.368421052632       1.036767743753
     -0.205263157895       3.368421052632       1.027197425050
     -0.068421052632       3.368421052632       1.023659622763
      0.068421052632       3.368421052632       1.023659622763
      0.205263157895       3.368421052632       1.027197425050
      0.342105263158       3.368421052632       1.036767743753
      0.478947368421       3.368421052632       1.062774142729
      0.615789473684       3.368421052632       1.179765630236
      0.752631578947       3.368421052632       0.508332439171
      0.889473684211       3.368421052632       0.512595867665
      1.026315789474       3.368421052632       1.084322269326
      1.163157894737       3.368421052632       1.022670717601
      1.300000000000       3.368421052632       1.027707541691
     -1.300000000000       3.578947368421       1.012740556267
     -1.163157894737       3.578947368421       1.009098441749
     -1.026315789474       3.578947368421       1.066618101119
     -0.889473684211       3.578947368421       0.511854868108
     -0.752631578947       3.578947368421       0.507778141612
     -0.615789473684       3.578947368421       1.119870247076
     -0.478947368421       3.578947368421       1.050022506614
     -0.342105263158       3.578947368421       1.031080838687
     -0.205263157895       3.578947368421       1.023660489456
     -0.068421052632       3.578947368421       1.020842841204
      0.068421052632       3.578947368421       1.020842841204
      0.205263157895       3.578947368421       1.023660489456
      0.342105263158       3.578947368421       1.031080838687
      0.478947368421       3.578947368421       1.050022506614
      0.615789473684       3.578947368421       1.119870247076
      0.752631578947       3.578947368421       0.507778141612
      0.889473684211       3.578947368421       0.511854868108
      1.026315789474       3.578947368421       1.066618101119
      1.163157894737       3.578947368421       1.009098441749
      1.300000000000       3.578947368421       1.012740556267
     -1.300000000000       3.789473684211       1.002490308916
     -1.163157894737       3.789473684211       0.999480129131
     -1.026315789474       3.789473684211       1.051031597371
     -0.889473684211       3.789473684211       0.511178259186
     -0.752631578947       3.789473684211       2.115303346236
     -0.615789473684       3.789473684211       1.087590009962
     -0.478947368421       3.789473684211       1.041038314858
     -0.342105263158       3.789473684211       1.026687653195
     -0.205263157895       3.789473684211       1.020792862745
     -0.068421052632       3.789473684211       1.018506330614
      0.068421052632       3.789473684211       1.018506330614
      0.205263157895       3.789473684211       1.020792862745
      0.342105263158       3.789473684211       1.026687653195
      0.478947368421       3.789473684211       1.041038314858
      0.615789473684       3.789473684211       1.087590009962
      0.752631578947       3.789473684211       2.115303346236
      0.889473684211       3.789473684211       0.511178259186
      1.026315789474       3.789473684211       1.051031597371
      1.163157894737       3.789473684211       0.999480129131
      1.300000000000       3.789473684211       1.002490308916
     -1.300000000000       4.000000000000       0.995814193962
     -1.163157894737       4.000000000000       0.992838080577
     -1.026315789474       4.000000000000       1.037528228234
     -0.889473684211       4.000000000000       0.510558796548
     -0.752631578947       4.000000000000       1.344611311368
     -0.615789473684       4.000000000000       1.067648040164
     -0.478947368421       4.000000000000       1.034420877924
     -0.342105263158       4.000000000000       1.023210238365
     -0.205263157895       4.000000000000       1.018431506605
     -0.068421052632       4.000000000000       1.016545718957
      0.068421052632       4.000000000000       1.016545718957
      0.205263157895       4.000000000000       1.018431506605
      0.342105263158       4.000000000000       1.023210238365
      0.478947368421       4.000000000000       1.034420877924
      0.615789473684       4.000000000000       1.067648040164
      0.752631578947       4.000000000000       1.344611311368
      0.889473684211       4.000000000000       0.510558796548
      1.026315789474       4.000000000000       1.037528228234
      1.163157894737       4.000000000000       0.992838080577
      1.300000000000       4.000000000000       0.995814193962
$\endgroup$
5
  • $\begingroup$ Take a look at AbsoluteOptions[] $\endgroup$ Apr 29, 2014 at 17:52
  • $\begingroup$ Yes I thought about this too, but then I have to Plot everything twice (what takes some time) ... but if there is no other way I'll try this. $\endgroup$
    – PeMa
    Apr 29, 2014 at 18:16
  • $\begingroup$ :-) AbsoluteOptions[] gives: {Ticks -> Automatic} . $\endgroup$
    – PeMa
    Apr 29, 2014 at 18:30
  • $\begingroup$ Related: minor grid lines (2D case). Please provide data to work on. $\endgroup$
    – Kuba
    Apr 29, 2014 at 18:43
  • $\begingroup$ I added some data. In the plot you see 6 Mesh lines from 0 to 1 on the x-axes while there are only 5 Ticks. $\endgroup$
    – PeMa
    Apr 29, 2014 at 19:33

2 Answers 2

4
$\begingroup$

Create a custom ticks function that, with some additional tuning/styling, can reproduce the Automatic-ally produced ticks:

ClearAll[tickF];
tickF[div1_, div2_: - 1] := (If[div2 == -1,
        Thread[{#, #, {.02, 0}}, List, 2] &@FindDivisions[{#1, #2}, div1],
        Join @@ MapAt[Join @@ # &, {Thread[{#, #, {.02, 0}}, List, 2] &@#[[1]], 
           Thread[{#, "", {.01, 0}}, List, 2] & /@ #[[2]]} &@
                  FindDivisions[{#1, #2}, {div1, div2}], {2}]]) &

Usage:

plt1 = Plot3D[Sin[x y], {x, 0, 4}, {y, 0, 4}, FaceGrids -> All,ImageSize -> 400, 
    Ticks -> Evaluate@({(t1 = {##}; tickF[8, 5][##]) &,
            (t2 = {##}; tickF[8, 5][##]) &,
           (t3 = {##}; N /@ tickF[8, 5][##]) &}),
    Mesh -> {(tickF[8] @@ t1)[[All, 1]], (tickF[8] @@ t2)[[All, 1]]}];
plt2 = Plot3D[Sin[x y], {x, 0, 4}, {y, 0, 4}, FaceGrids -> All, ImageSize -> 400,
    Mesh -> None];
Row[{plt2, plt1}, Spacer[5]]//Panel

enter image description here

With OP's data

lp2 = ListPlot3D[data, ViewPoint -> {0, -2, 4},  ImageSize -> 400];
lp1 = ListPlot3D[data, ViewPoint -> {0, -2, 4},  ImageSize -> 400, 
   Ticks -> Evaluate@({(t1 = {##}; tickF[4, 5][##]) &,
           (t2 = {##}; tickF[4, 5][##]) &,
           (t3 = {##}; N /@ tickF[4, 5][##]) &}),
Mesh -> {(tickF[4] @@ t1)[[All, 1]], (tickF[4] @@ t2)[[All, 1]]}];
Row[{lp2, lp1}, Spacer[5]] // Panel

enter image description here

$\endgroup$
10
  • $\begingroup$ I'm not sure that the generated divisions will always match the elusive internal routine.In my machine a PlotRange of {x, 10, 40} (as an example) gives different results $\endgroup$ Apr 30, 2014 at 1:24
  • $\begingroup$ @belisarius, I agree; we don't know how the second argument of FindDivisions is selected internally. I also get different x-ticks for {x,10,40}; it does take some trial-and-error to find that tickF[5, 5] gives the same ticks. $\endgroup$
    – kglr
    Apr 30, 2014 at 1:44
  • $\begingroup$ In fact I don't believe the internal stuff was done using FindDivisions[](it was new in V.7) $\endgroup$ Apr 30, 2014 at 1:50
  • $\begingroup$ @belisarius, can't recollect the source of my hunch that internal tick generation uses FindDivisions; definitely nothing "official" - most likely some comments/Q/As on this site :) $\endgroup$
    – kglr
    Apr 30, 2014 at 1:57
  • $\begingroup$ Did I understand it right, that you tried to imitate mathematica's internal procedure to create the ticks, but it's not entirely working? $\endgroup$
    – PeMa
    Apr 30, 2014 at 5:23
6
$\begingroup$

I know this seems utterly complicated for the task at hand, but as FullGraphics[] isn't implemented for Graphics3D[] and AbsoluteOptions[] doesn't work for Ticks[], I don't know an easier way:

s1 = ListPlot3D[data, Ticks -> #, PlotStyle -> None, Mesh -> None] & /@ 
               {{Automatic, None, None}, {None, Automatic, None}};
mesh = Map[ToExpression@ StringJoin[#[[All, 1]]] &, (GatherBy[#, #[[2]] &] & /@ 
           (Cases[#, Text[t_, {_, y_}, __] :> {t, y}, Infinity] & /@ (First@
           ImportString[ExportString[#, "EPS" ], "EPS"] & /@  s1))), {2}];

ListPlot3D[data, Mesh -> mesh]

Mathematica graphics

$\endgroup$
1
  • $\begingroup$ Amazing, thanks! But I need to modify this, to get meshlines at minor ticks as well. So, is there a way to write a scale to the minor ticks? $\endgroup$
    – PeMa
    Apr 30, 2014 at 5:14

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.