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$

1 Answer 1

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!

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.