866 views

Skip to first unread message

Jan 15, 2007, 4:58:22 AM1/15/07

to

Hello!

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

Jan 16, 2007, 1:58:32 AM1/16/07

to

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

Jan 16, 2007, 1:59:36 AM1/16/07

to

p1=Plot[-Log[Abs[x]],{x,-2,2},

PlotRange->{Automatic,{-1,3.5}},Frame->True,

PlotPoints->100,DisplayFunction->Identity];

PlotRange->{Automatic,{-1,3.5}},Frame->True,

PlotPoints->100,DisplayFunction->Identity];

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

Jan 16, 2007, 2:01:39 AM1/16/07

to

dimitris schrieb:

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

Jan 16, 2007, 2:08:53 AM1/16/07

to

Thanks to Peter, Bob and Jean Marc for their replies.

Also thank to Jean-Marc for bringing in my attention the following

relevant thread

Also thank to Jean-Marc for bringing in my attention the following

relevant thread

Regards

Dimitris

Jan 16, 2007, 2:19:07 AM1/16/07

to

On 1/15/07 at 5:35 AM, dimm...@yahoo.com (dimitris) wrote:

>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

Jan 17, 2007, 6:08:49 AM1/17/07

to

Thanks Bill.

Dimitris

Reply all

Reply to author

Forward

0 new messages

Search

Clear search

Close search

Google apps

Main menu