1
$\begingroup$

In 3DListPlot, I am plotting data such that I have discretized a contineous function. While plotting, I automatically get the ticks labeling, marking the discrete points. I want to replace the labeling with the labeling of my continuous data, means instead of going from 0 to 1000 points, I want to mark it as going form -5 to 5.

3DPlot of discrete data

$\endgroup$
2
$\begingroup$

Use the option DataRange to specify the actual range of coordinates:

ListPlot3D[Table[Sin[i/10 + j/100], {i, 0, 10, 1}, {j, 0, 100, 0.1}]]

enter image description here

ListPlot3D[Table[Sin[i/10 + j/100], {i, 0, 10, 1}, {j, 0, 100, 0.1}], 
 DataRange -> {{-5, 5}, {0, 10}}]

enter image description here

Update: you can label the ticks the way you wish using the option Ticks:

ListPlot3D[Table[Sin[i/10 + j/100], {i, 0, 10, 1}, {j, 0, 100, 0.1}], 
 DataRange -> {{-5, 5}, {0, 10}}, 
 Ticks -> {{{-5, Row[{-5, Pi/2}]}, {0, Row[{0, Pi/2}]}, {5, Row[{5, Pi/2}]}}, 
         Automatic, Automatic}]

enter image description here

$\endgroup$
  • $\begingroup$ @zenith, my pleasure. Welcome to mma.se. $\endgroup$ – kglr Oct 9 '14 at 9:11
  • $\begingroup$ may I ask one more thing? What if I want to add some constant term in ticks label. Means if I want to label ticks as -5X to 5X where X is some constant. $\endgroup$ – zenith Oct 9 '14 at 9:19
  • $\begingroup$ I tried it. The problem is that if x is say x=Pi/2, then in plot it is automatically multiplying -5 with Pi/2 and plotting in terms of answer. My interest was to show on plot -5x rather than multiplied number. $\endgroup$ – zenith Oct 9 '14 at 9:31
  • $\begingroup$ @zenith, you can use the option Ticks: e.g. with x predefined (say x=10), add the option Ticks -> {{{-5, -5 x}, {0, 0 x}, {5, 5 x}}, Automatic, Automatic} to Plot3D. Or, perhaps, something like Ticks -> {{{-5, Row[{-5, Pi/2}]}, {0, Row[{0, Pi/2}]}, {5, Row[{5, Pi/2}]}}, Automatic, Automatic}.. $\endgroup$ – kglr Oct 9 '14 at 9:32
  • $\begingroup$ Alright. Let me try this. Thanks again for contentious help. $\endgroup$ – zenith Oct 9 '14 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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