3
$\begingroup$

Is there any way to place tick marks on the x-axis above the axis? Note that I am talking about marks on the axis, not on a frame (because my graph has no frame). To be more specific, here's the reason I need that: I have a graph of a lower semi-circle with some shading generated by the following code:

ClearAll[x, y, a];
gthick = Thickness[0.005];
g1 = RegionPlot[x^2 + y^2 < 1 , {x, -1, 1}, {y, -0.6, 0}, Frame -> False];
g2 = Plot[-Sqrt[1 - x^2], {x, -1, 1}, PlotStyle -> {Red, gthick}];
g3 = ListLinePlot[{{-0.8, -0.6}, {0.8, -0.6}}, PlotStyle -> {Blue, gthick}];
g4 = Graphics[{Dashing[Small], Line[{{-0.8, -0.6}, {-0.8, 0}}],
   Line[{{0.8, -0.6}, {0.8, 0}}]}];
Show[{g1, g2, g3, g4}, PlotRange -> {{-1.2, 1.2}, {-1.2, 0.2}},
   AspectRatio -> Automatic, Axes -> True, AxesOrigin -> {0, 0},
   Ticks -> {{{-1.05, -1, 0}, {-0.65, -Sqrt[1 - a^2], 0}, {0.65, Sqrt[1 - a^2], 0},
   {1.05, 1, 0}}, None}, TicksStyle -> Directive[FontSize -> 15]]

And the output (anybody can check that) is:

enter image description here

Anybody can see that on a picture like this, so that it looks nice, tick labels should be above the x-axis. But how?

P.S. (edited) I know that I can add text on the graph at desired positions. But can it be achieved with tick labels being tick labels, thru some options?

$\endgroup$
6
  • $\begingroup$ Hello, please see the linked question for an answer. That question talks about flipping it for the y-axis, but it should be easily extendable. In particular, I think Istvan's answer already addresses this. $\endgroup$
    – rm -rf
    Commented Feb 13, 2014 at 1:39
  • $\begingroup$ Even without that, here's a simple modification to yours that achieves the same look: Show[{g1, g2, g3, g4}, PlotRange -> {{-1.2, 1.2}, {-1.2, 0}}, AspectRatio -> Automatic, Axes -> True, AxesOrigin -> {0, 0}, FrameTicks -> {{{-1.05, -1, 0}, {-0.65, -Sqrt[1 - a^2], 0}, {0.65, Sqrt[1 - a^2], 0}, {1.05, 1, 0}}, None}, TicksStyle -> Directive[FontSize -> 15], Frame -> {False, False, True, False}, PlotRangePadding -> 0] $\endgroup$
    – rm -rf
    Commented Feb 13, 2014 at 1:44
  • $\begingroup$ @rm-rf: Yes, that one (from the linked question) kinda does answer my question... except for what he suggested there is a smart way of placing text on the graph at the positions of the desired tick labels. I was wondering if there are some options for Mathematica's own tick labels for that, but it looks like probably not... $\endgroup$
    – zipirovich
    Commented Feb 13, 2014 at 1:45
  • $\begingroup$ Please see my second comment above... it's simple if you use frames and frame ticks. $\endgroup$
    – rm -rf
    Commented Feb 13, 2014 at 1:51
  • 1
    $\begingroup$ Hmm... ok. Unfortunately, ticks are a sore point in Mathematica and I'm afraid that the cumbersome approach in the linked post is the best general solution available right now. If you have trouble implementing the answer there for your example above, please ping me and I'll try to help. :) $\endgroup$
    – rm -rf
    Commented Feb 13, 2014 at 2:04

0

Browse other questions tagged or ask your own question.