0
$\begingroup$

Maybe the question is stupid or already has been asked, however, I cannot find an answer while searching Q&A.

Assume you have a

Table[x*y,{x,1,4},{y,1,4}]

Now applying ListDensityPlot will bring the values 1 to 4 to the frameaxis, which reflects somehow col and row of the table.

But how to assign arbitrary values or even a string to these frameaxis of a ListDensityPlot? Anybody can help?

MWE

$\endgroup$
2
  • $\begingroup$ You want to modify the FrameTicks I think $\endgroup$
    – Jason B.
    Apr 11 '16 at 12:55
  • $\begingroup$ @JasonB - I tried Frame -> True, FrameTicks -> {{{-1, 1, 1}, None}, {{-1, 1, 1}, None}} But it's not really working. Even worse with FrameTicks -> {{"-a", "a"}, {"-b", "c"}}. What am I doing wrong? $\endgroup$
    – Kay
    Apr 11 '16 at 13:02
1
$\begingroup$

For random values,

ListDensityPlot[Table[x*y, {x, 1, 4}, {y, 1, 4}], FrameTicks ->
  {{Transpose[{Range[4], RandomReal[1, 4]}], Automatic},
   {Transpose[{Range[4], RandomReal[1, 4]}], Automatic}}]

enter image description here

For string labels,

ListDensityPlot[Table[x*y, {x, 1, 4}, {y, 1, 4}], FrameTicks ->
  {{{{1, "hello"}, {3, "world"}}, Automatic},
   {{{1.5, "a"}, {3.2, "b"}}, Automatic}}]

enter image description here

$\endgroup$
2
  • $\begingroup$ Looks good! I will study that!! Thank you! $\endgroup$
    – Kay
    Apr 11 '16 at 13:04
  • $\begingroup$ I got it! one has to link the original value to the new one. Make sens! $\endgroup$
    – Kay
    Apr 11 '16 at 13:06

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.