1
$\begingroup$

I have some discrete data and want to make a density plot as

ListDensityPlot[{{1, 1, 1, 1}, {1, 2, 1, 2}, {1, 1, 3, 1}, {1, 2, 1,  4}}, Frame -> True, FrameLabel -> {"a", "b"}]

Output of ListDensityPlot

What if I want to add "t" along vertical axis as 1.0t 1.5t 2.0t, 2.5t, 3.0t, 3.5t 4.0t, where t is some constant.

$\endgroup$
2
  • $\begingroup$ Have a look at FrameTicks and search the site for custom ticks, which should help you already, e.g. here: mathematica.stackexchange.com/q/32831/131. $\endgroup$
    – Yves Klett
    Nov 27, 2014 at 13:40
  • $\begingroup$ Since there are so many helpful answers, I´d go for re-opening. $\endgroup$
    – Yves Klett
    Nov 28, 2014 at 8:29

3 Answers 3

7
$\begingroup$

Is this what you had in mind?

data = {{1, 1, 1, 1}, {1, 2, 1, 2}, {1, 1, 3, 1}, {1, 2, 1, 4}};

ticks = {#, ToString[# t]} & /@ Range[4]

ListDensityPlot[data, Frame -> True, FrameLabel -> {"a", "b"}, FrameTicks -> {ticks, ticks}]

enter image description here

$\endgroup$
3
  • $\begingroup$ Closer to what I wanted, and I tried to modify your suggestion according to what was my target. I obtained the required things. Thanks $\endgroup$
    – zenith
    Nov 27, 2014 at 11:01
  • $\begingroup$ @zenith The site might get better answers if you wait a little longer to accept. Often 24 hours are suggested. Some people skip questions with accepted answers. $\endgroup$
    – Michael E2
    Nov 27, 2014 at 13:26
  • $\begingroup$ alright, i may wait then 24 hours $\endgroup$
    – zenith
    Nov 27, 2014 at 15:06
3
$\begingroup$

You mean like this:

t = Pi/2;
ListDensityPlot[{{1, 1, 1, 1}, {1, 2, 1, 2}, {1, 1, 3, 1}, {1, 2, 1, 
   4}},
 Frame -> True,
 FrameLabel -> {"a", "b"},
 FrameTicks -> {{{0, t, 2 t, 3 t}, None}, {{0, t, 2 t, 3 t}, None}}
 ]

enter image description here

or like this :

ListDensityPlot[{{1,1,1,1},{1,2,1,2},{1,1,3,1},{1,2,1,4}},
Frame->True,
FrameLabel->{"a","b"},
FrameTicks->
{{{{0,"Null"},{t,"t"},{2t,"2 t"},{3t,"3 t"}},None},
{{{0,"Null"},{t,"t"},{2t,"2 t"},{3t,"3 t"}},None}}
]

enter image description here

$\endgroup$
0
$\begingroup$

This was what I wanted

  data = {{1, 1, 1, 1}, {1, 2, 1, 2}, {1, 1, 3, 1}, {1, 2, 1, 4}};

ticks = {{1, "t"}, {2, "2 t"}, {3, "3 t"}, {4, "4 t"}}

ListDensityPlot[data, Frame -> True, FrameLabel -> {"a", "b"},  FrameTicks -> {{ticks, None}, {Automatic, None}}]

enter image description here

$\endgroup$

Your Answer

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

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