I wanted to make a plot with custom frame ticks. For example, lets say I want to make a plot
ListPlot[{{1.1,3.9},{2.9,3.1}},
Axes->None,Frame->{{True,False},{True,False}},PlotRange->{{1,3},{3,4}}
]
but I want to change the frame ticks so that only 1, 2, and 3 show up on the x-axis, and there are only ticks at 3 and 4 on the y-axis and these ticks say "low" and "hi" respectively.
In the documentation for frameticks it gives the example
Plot[Sin[x], {x, 0, 10},
Frame -> True,
FrameTicks -> {{{0, 0 \[Degree]}, {Pi, 180 \[Degree]}, {2 Pi, 360 \[Degree]}, {3 Pi, 540 \[Degree]}}, {-1/2, 1/2}}
]
This is also the pattern suggested in this answer.
Following this pattern, it seems I should try
ListPlot[{{1.1,3.9},{2.9,3.1}},
Axes->None,Frame->{{True,False},{True,False}},PlotRange->{{1,3},{3,4}},
FrameTicks->{{1,2,3},{{3,"low"},{4,"high"}}}
]
however, this produces an error. I have also tried
Show[
ListPlot[{{1.1,3.9},{2.9,3.1}},
Axes->None,Frame->{{True,False},{True,False}},PlotRange->{{1,3},{3,4}}
],
FrameTicks->{{1,2,3},{{3,"low"},{4,"high"}}}
]
but this also produces an error. Somehow putting FrameTicks
in quotes in the previous line fixes the error:
Show[
ListPlot[{{1.1,3.9},{2.9,3.1}},
Axes->None,Frame->{{True,False},{True,False}},PlotRange->{{1,3},{3,4}}
],
"FrameTicks"->{{1,2,3},{{3,"low"},{4,"high"}}}
]
But I feel like I am doing this wrong way. Is there a better way to do this?