Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

FrameLabel-type axes labels without setting Frame->True

531 views
Skip to first unread message

Andrew Moylan

unread,
May 4, 2007, 4:29:43 AM5/4/07
to
Hi,

When plotting, I usually want my axes labels placed where FrameLabel-
>{"x", "y"} puts them (underneath the plot for the x-axis label, and
written vertically to the left of the plot for the y-axis label). But
sometimes I don't want a rectangular frame around my plot, which is
what I get when I use Frame->True.

What's the best way to have FrameLabel-style axes labels while still
having regular old axes instead of a rectangular frame?

Cheers,
Andrew


Albert

unread,
May 5, 2007, 6:02:49 AM5/5/07
to
Hi,

> What's the best way to have FrameLabel-style axes labels while still
> having regular old axes instead of a rectangular frame?
>

don't know whether this fits your definition of best, but it looks easy
and does what I think you want:

Plot[x, {x, 0,1},
Frame -> {True, True, False, False},
FrameLabel -> {"x", "y"}
]


albert

Carl Woll

unread,
May 5, 2007, 6:08:06 AM5/5/07
to
Andrew Moylan wrote:

>Hi,
>
>When plotting, I usually want my axes labels placed where FrameLabel-
>
>
>>{"x", "y"} puts them (underneath the plot for the x-axis label, and
>>
>>
>written vertically to the left of the plot for the y-axis label). But
>sometimes I don't want a rectangular frame around my plot, which is
>what I get when I use Frame->True.
>

>What's the best way to have FrameLabel-style axes labels while still
>having regular old axes instead of a rectangular frame?
>

>Cheers,
>Andrew
>
>
I don't know if this is possible in version 5.2, but with version 6 it's
easy. This is because plots are no longer side effects, and because of
the new function Labeled. For example:

Labeled[ Plot[Sin[x], {x, 0, 2 Pi}], {x, y}, {Bottom, Left}]

produces what you want.

Carl Woll
Wolfram Research

Bill Rowe

unread,
May 5, 2007, 6:31:23 AM5/5/07
to
On 5/4/07 at 4:18 AM, andrew....@gmail.com (Andrew Moylan)
wrote:

>When plotting, I usually want my axes labels placed where FrameLabel-
>>{"x", "y"} puts them (underneath the plot for the x-axis label, and
>written vertically to the left of the plot for the y-axis label).
>But sometimes I don't want a rectangular frame around my plot, which
>is what I get when I use Frame->True.

>What's the best way to have FrameLabel-style axes labels while still
>having regular old axes instead of a rectangular frame?

Take a look at the following:

In[1]:=
Plot[x, {x, 0, 1}, Frame -> {True, True, False, False},
FrameLabel -> {"x-axis", "y-axis"}];
--
To reply via email subtract one hundred and four

Jean-Marc Gulliet

unread,
May 5, 2007, 6:34:34 AM5/5/07
to

You can pass a list of arguments to the option Frame to tell Mathematica
where parts of the frame must be drawn. For instance,

In[1]:=
Plot[Sin[x], {x, 0, 2*Pi}, Frame ->
{True, True, None, None}, FrameLabel ->
{"x", "y"}];

Regards,
Jean-Marc

dimitris

unread,
May 7, 2007, 5:53:53 AM5/7/07
to
This setting of Frame option was undocumentated until now.
(search in my archives for relevant questions of mine).

But it is well documentated in the new version. See here

http://reference.wolfram.com/mathematica/ref/Frame.html

Here are all possible combinations

In[20]:=
frs = Tuples[{True, False}, 4]

Out[20]=
{{True, True, True, True}, {True, True, True, False}, {True, True,
False, True}, {True, True, False, False},
{True, False, True, True}, {True, False, True, False}, {True, False,
False, True}, {True, False, False, False},
{False, True, True, True}, {False, True, True, False}, {False, True,
False, True}, {False, True, False, False},
{False, False, True, True}, {False, False, True, False}, {False,
False, False, True}, {False, False, False, False}}

And here are the respective graphs.

In[28]:=
(Plot[x, {x, -2, 2}, Axes -> False, PlotStyle -> Thickness[0.01],
Frame -> #1, PlotLabel -> ToString[#1]] & ) /@ frs;

Cheers
Dimitris


=CF/=C7 Andrew Moylan =DD=E3=F1=E1=F8=E5:

Murray Eisenberg

unread,
May 8, 2007, 5:47:08 AM5/8/07
to
Of course lose that semi-colon at the end of the In[28] expression if
you want to see anything!

An old, pre-6.0 habit to unlearn: suppressing result "-Graphics-" output
by terminating graphics statements with semi-colons.

dimitris wrote:
> This setting of Frame option was undocumentated until now.
> (search in my archives for relevant questions of mine).
>
> But it is well documentated in the new version. See here
>
> http://reference.wolfram.com/mathematica/ref/Frame.html
>
> Here are all possible combinations
>
> In[20]:=
> frs = Tuples[{True, False}, 4]
>
> Out[20]=
> {{True, True, True, True}, {True, True, True, False}, {True, True,
> False, True}, {True, True, False, False},
> {True, False, True, True}, {True, False, True, False}, {True, False,
> False, True}, {True, False, False, False},
> {False, True, True, True}, {False, True, True, False}, {False, True,
> False, True}, {False, True, False, False},
> {False, False, True, True}, {False, False, True, False}, {False,
> False, False, True}, {False, False, False, False}}
>
> And here are the respective graphs.
>
> In[28]:=
> (Plot[x, {x, -2, 2}, Axes -> False, PlotStyle -> Thickness[0.01],
> Frame -> #1, PlotLabel -> ToString[#1]] & ) /@ frs;
>
> Cheers
> Dimitris
>
>
> =CF/=C7 Andrew Moylan =DD=E3=F1=E1=F8=E5:

--
Murray Eisenberg mur...@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305

0 new messages