Consider the following graph of the function -ln(|x|).
Plot[-Log[Abs[x]], {x, -2, 2}, PlotRange -> {Automatic, {-1, 3.5}},
Axes -> False, Frame -> True, PlotPoints -> 100, FrameLabel -> {"x",
"y"}]
How is it possible to make the y-axis point downwards (I need this
because in half-space problems within the solid mechanics the possitive
vertical axis is pointed into the half-space)?
Thanks in advance.
Dimitris
Hi Dimitris,
You will find detail explanations from Bob Hanlon and David Park on the
following threads "help - how to invert the x or y axis.." at
http://groups.google.com/group/comp.soft-sys.math.mathematica/browse_thread/thread/8e1dbacb8a768054/3929283d6a0dacb5?lnk=gst&q=downward+y-axis&rnum=1&hl=en#3929283d6a0dacb5
In your case, the following should work (note that I have also adjusted
the plot range accordingly):
In[1]:=
Plot[Log[Abs[x]], {x, -2, 2},
PlotRange -> {Automatic, {1, -3.5}},
Axes -> False,
Frame -> True,
PlotPoints -> 100,
FrameLabel -> {"x", "y"},
FrameTicks -> {Automatic, Table[{i, -i}, {i, -4, 1}], None,
None}];
Regards,
Jean-Marc
Show[p1/.{x_,y_}->{x,-y},
PlotRange->{Automatic,{1,-3.5}},
Axes->False,Frame->True,
FrameLabel->{"x","y"},
FrameTicks->{Automatic,
AbsoluteOptions[p1,FrameTicks][[1,2,2]]/.{y_?NumericQ,r___}->{-y,r},
Automatic,Automatic},
DisplayFunction->$DisplayFunction];
Bob Hanlon
Hi Dimitris,
unfortunately I've just found this complicated FrameTicks option:
(Note, that -f[x] has to be plotted)
Block[{lbl},
Plot[Log[Abs[x]], {x, -2, 2}, PlotRange -> {Automatic, {-3.5, 1}},
Axes -> False, Frame -> True, PlotPoints -> 100, FrameLabel -> {"x", "y"},
FrameTicks -> {Automatic,
lbl = Flatten[{#1,
If[IntegerQ[#1], {ToString[-#1], {3/400, 0}}, {"", {3/800, 0}}]}, 1]&
/@ (Range[-15, 5] / 5), None, lbl /. _String -> ""}]]
But I'm sure, David Park will find an elegant solution :-)
Peter
Regards
Dimitris
>Consider the following graph of the function -ln(|x|).
>Plot[-Log[Abs[x]], {x, -2, 2}, PlotRange -> {Automatic, {-1, 3.5}},
>Axes -> False, Frame -> True, PlotPoints -> 100, FrameLabel -> {"x",
>"y"}]
>How is it possible to make the y-axis point downwards (I need this
>because in half-space problems within the solid mechanics the
>possitive vertical axis is pointed into the half-space)?
I am not sure I understand what you mean by "make the y-axis
point downwards". I am guessing you want the increasingly
positive tick values to appear toward the bottom of the page. If
I have this right perhaps you will find the following satisfactory
Plot[-Log[Abs[x]], {x, -2, 2}, PlotRange -> {Automatic, {-1,
3.5}}, Axes -> False, Frame -> True, PlotPoints -> 100,
FrameLabel -> {"x",
"y"}, FrameTicks -> {Automatic, Transpose[{
Range[0, 3], Range[3, 0, -1]}], {}, {}}];
--
To reply via email subtract one hundred and four
Dimitris