Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have some data partitioned into three sublists:

data = {{2776.37, 2016.64, 1483.51, 1027.35, 500.878, 94.1385, 
    310.402, 282.548, 257.886, 224.359, 218.688, 209.312, 215.776, 
    198.78}, {40.5063, 24.633, 12.069, 8.3151, 6.35135, 15.0977, 
    8.74372, 15.5125, 9.34959, 9.70696, 11.125, 12.1457, 10.8075, 
    9.7561}, {113.08, 124.633, 75.9698, 59.5186, 55.9459, 7.81528, 
    57.4372, 69.5291, 80.4878, 88.2784, 105.563, 127.935, 148.571, 
    148.78}};

Each sublist can be represented by a label,

samp = {"x", "y", "z"};

I want to create a ListLogPlot with a Tooltip with the sample name that appears when the mouse hovers over each subset. I have tried,

ListLogPlot[Tooltip[data, samp], Joined -> True]

enter image description here

but this flashes "{x,y,z}" for each subset. How do I achieve the desired effect?

share|improve this question
add comment

3 Answers

up vote 6 down vote accepted

It seems to me you just need to add Thread:

ListLogPlot[Thread @ Tooltip[data, samp], Joined -> True]
share|improve this answer
add comment
data = {
   {2776.37, 2016.64, 1483.51, 1027.35,
    500.878, 94.1385, 310.402, 282.548,
    257.886, 224.359, 218.688, 209.312,
    215.776, 198.78},
   {40.5063, 24.633, 12.069, 8.3151,
    6.35135, 15.0977, 8.74372, 15.5125,
    9.34959, 9.70696, 11.125, 12.1457,
    10.8075, 9.7561},
   {113.08, 124.633, 75.9698, 59.5186,
    55.9459, 7.81528, 57.4372, 69.5291,
    80.4878, 88.2784, 105.563, 127.935,
    148.571, 148.78}};

samp = {"x", "y", "z"};

ListLogPlot[
 Tooltip @@@ Transpose[{data, samp}],
 Joined -> True]
share|improve this answer
add comment

Well I just used your previous question to get this working. You cannot just wrap evrything in ToolTip - you need to wrap each data set in it with its specific label:

ListLogPlot[
  MapThread[
   Tooltip, {data, 
    Style[#, 15, Bold, FontFamily -> "Georgia"] & /@ {"Sample X", 
      "Sample Y", "Sample Z"}}], Joined -> True, 
  Ticks -> {Transpose[{Range[14], xaxis}], Automatic}, 
  PlotStyle -> Thick, GridLines -> {Range[14], Automatic}, 
  GridLinesStyle -> Opacity[.5], Mesh -> All, 
  MeshStyle -> Directive[PointSize[.015], Opacity[.5]]] // Magnify

enter image description here

share|improve this answer
    
Very nice :) Sorry for the repetitive example but I needed to know both answers and I thought it would be clumsy to put them in one question... –  geordie Sep 5 '13 at 4:06
    
@geordie I understand. I am not sure what moderators would advise. I personally would still put it in the same question, saying I need 1) x-labels 2) ToolTips - because basically you joining all this in one single object correct? –  Vitaliy Kaurov Sep 5 '13 at 4:32
    
I guess the issue is that people who are searching for answers to their burning questions might miss one or the other solution if the question title doesn't explicitly describe both. –  geordie Sep 5 '13 at 4:58
    
@geordie I see your point. BTW did you look through the site for similar questions? I feel like similar things were asked before. –  Vitaliy Kaurov Sep 5 '13 at 5:03
    
I tried.. this is always one of the issues with searching for existing answers. A lot of questions don't have a very descriptive title and may not be cataloged properly. It can be quite difficult for a casual SE user to know whether or not their particular question is a duplicate. –  geordie Sep 5 '13 at 5:35
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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