Message Boards Message Boards

0
|
8173 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Replace numeric by string "description" on x-axis of a ListPlot?

Hey there!

I would like to rename some results in a ListPlot on the x-axis with a description, however, I am not possible to do so. I though it would work with Ticks, it doesn't. Can someone please help me?

Here the code:

parameters = {{1, 0.910299}, {2, 0.98625}, {3, 1.09987}, {4, 
    0.98742}, {5, 0.935837}};
seplus = {{1, 0.910299 + (2*0.0426755)}, {2, 
    0.98625 + (2*0.0441949)}, {3, 1.09987 + (2*0.0494856)}, {4, 
    0.98742 + (2*0.0442918)}, {5, 0.935837 + (2*0.0418519)}};
seminus = {{1, 0.910299 - (2*0.0426755)}, {2, 
    0.98625 - (2*0.0441949)}, {3, 1.09987 - (2*0.0494856)}, {4, 
    0.98742 - (2*0.0442918)}, {5, 0.935837 - (2*0.0418519)}};

plotindex = 
  ListPlot[parameters, Frame -> True, Joined -> False, 
   AxesOrigin -> {1, 1}, 
   Ticks -> {Automatic, {{1, "Text1"}, {2, "Text2"}, {3, "Text3"}, {4,
        "Text4"}, {5, "Text5"}}, Automatic}, PlotStyle -> Gray];
plotseplus = 
  ListPlot[{seplus, seminus}, Frame -> True, Joined -> False, 
   Filling -> {1 -> {2}}, AxesOrigin -> {1, 1}, 
   Ticks -> {Automatic, {{1, "Text1"}, {2, "Text2"}, {3, "Text3"}, {4,
        "Text4"}, {5, "Text5"}}, Automatic}, PlotStyle -> Black];
tailindices = Show[plotseplus, plotindex]

It would be great if someone could help me, thank you in advance!

Best regards Alex

3 Replies

Yes, that is what I was looking for, thank you very much! :)

Hey Alexander,

Is this what you looking for? ......Regards, Jos

enter image description here

parameters = {{1, 0.910299}, {2, 0.98625}, {3, 1.09987}, {4, 
    0.98742}, {5, 0.935837}};
seplus = {{1, 0.910299 + (2*0.0426755)}, {2, 
    0.98625 + (2*0.0441949)}, {3, 1.09987 + (2*0.0494856)}, {4, 
    0.98742 + (2*0.0442918)}, {5, 0.935837 + (2*0.0418519)}};
seminus = {{1, 0.910299 - (2*0.0426755)}, {2, 
    0.98625 - (2*0.0441949)}, {3, 1.09987 - (2*0.0494856)}, {4, 
    0.98742 - (2*0.0442918)}, {5, 0.935837 - (2*0.0418519)}};

plotindex = ListPlot[parameters
   , Frame -> True
   , Joined -> False
   , AxesOrigin -> {1, 1}
   , FrameTicks -> {{Automatic, 
      Automatic}, {{{1, "Text1"}, {2, "Text2"}, {3, "Text3"}, {4, 
        "Text4"}, {5, "Text5"}}, Automatic}}
   , PlotStyle -> Gray];

plotseplus = ListPlot[{seplus, seminus}
   , Frame -> True
   , Joined -> False
   , Filling -> {1 -> {2}}
   , AxesOrigin -> {1, 1}
   , FrameTicks -> {{Automatic, 
      Automatic}, {{{1, "Text1"}, {2, "Text2"}, {3, "Text3"}, {4, 
        "Text4"}, {5, "Text5"}}, Automatic}}
   , PlotStyle -> Black];

tailindices = Show[plotseplus, plotindex]
POSTED BY: Jos Klaps
Posted 7 years ago

You are using a frame (Frame->True) so you need to use FrameTicks

plotindex = 
 ListPlot[parameters, Frame -> True, Joined -> False, 
  AxesOrigin -> {1, 1}, 
  FrameTicks -> {{Automatic, 
     None}, {{{1, "Text1"}, {2, "Text2"}, {3, "Text3"}, {4, 
       "Text4"}, {5, "Text5"}}, None}}, PlotStyle -> Gray]
POSTED BY: Will Smith
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract