1
$\begingroup$

Here is my code:

xticks = {{1 -> "Country"}, {2 -> "Classic"}, {3 -> "Pop"}, {4 -> "Rock"}}; ListPlot[{101.861, 101.971, 97.796, 98.541}, Joined -> True, PlotRange -> {{1, 4}, {97, 103}}, FrameLabel -> {"Music Genre", "PSNR"}, GridLines -> Automatic, FrameTicks -> {{Automatic, None}, {xticks, None}}, Frame -> True]

I am trying to have the labels: Country, Classic, Pop and Rock at x-axis values of 1,2,3 and 4. However, it seems I am doing something wrong. What is the right code to do this?

$\endgroup$
2
$\begingroup$

You are almost there. You only need to place comma instead of the arrow in the ticks. Try this:

xticks = {{1, Rotate["Country", 70 Degree]}, {2, 
   Rotate["Classic", 70 Degree]}, {3, Rotate["Pop", 70 Degree]}, {4, 
   Rotate["Rock", 70 Degree]}}; 

ListPlot[{101.861, 101.971, 97.796, 
  98.541}, Joined -> True, PlotRange -> {{1, 4}, {97, 103}}, 
 FrameLabel -> {"Music Genre", "PSNR"}, GridLines -> Automatic, 
 FrameTicks -> {{Automatic, None}, {xticks, None}}, Frame -> True]

Returning this:

enter image description here

Have fun!

| improve this answer | |
$\endgroup$

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.