Group Abstract Group Abstract

Message Boards Message Boards

Are PlotLegend and axis labeling supported for Wolfram|Alpha?

GROUPS:

How would I add PlotLegends, axis labels, etc. to a plot generated using Wolfram|Alpha? For instance, the following simple command generates three lines:

plot [y/324, y/275, y/221 for y=200 to 1000 ]

I would like to label the first "oil", the second "propane" and the third "gas" instead of having the default legends shown below. Also, I'd like to label the y and x axis...

I'm new to Wolfram|Alpha and haven't been able to find any real documentation on what is supported. Can you provide a link? General Mathematica documentation seems of limited utility.

enter image description here

POSTED BY: Bob Wyman
Answer
1 month ago

Assuming you have Mathematica you could use this rather hackish solution:

Show[ReleaseHold[
WolframAlpha[
"plot [y/324, y/275, y/221 for y=200 to 1000 ]", {{"Plot", 1},
"Input"}]],
AxesLabel -> {HoldForm["x axis!"], HoldForm["y axis!"]},
PlotLabel -> HoldForm["Awesome title!"]]

W|</p><p>In that I'm querying Alpha for the <em>Mathematica</em> expression necessary to create the plot it displays, and <code>Show[]</code>ing it with the options we want. You can add any Plot options you want.</p><p>There's probably an easier way to do this, but this was the first I found.</p><p>Although I'm a little confused as to why you can't just do <code>Plot[{y/324, y/275, y/221}, {y, 200, 1000}]</code>...</p>

				
					<div class=

POSTED BY: Jesse Friedman
Answer
1 month ago

Jesse, I don't have Mathematica. Also, the image you included seems to be from a local drive. The commands you suggested don't work when I try them.

Do you have any other ideas for adding legends or axis labels in Wolfram|Alpha?

POSTED BY: Bob Wyman
Answer
1 month ago

Dear Bob,

I could't immediately make it work on Wolfram Alpha. But if you need the figure the following could work. You sign up for a free (!) account for the Wolfram Programming Cloud:

http://www.wolfram.com/programming-cloud/pricing/

It runs the Wolfram Language and you can achieve what you want by opening a new notebook and typing:

Plot[{y/324, y/275, y/221}, {y, 200, 1000},PlotLegends -> {"Oil", "Propane", "Gas"},Frame-> True]

You should see something like this

enter image description here

The Wolfram Cloud is more powerful than Wolfram Alpha alone - it can make W|A requests. You get a whole lot of functionality for free. It gives you a great deal of flexibility of how to format the output.

Cheers,

Marco

POSTED BY: Marco Thiel
Answer
1 month ago

Marco, Thanks. It is definitely easier to use Cloud, rather than Wolfram|Alpha to create the legend. However, I still can't see how to label the axis...

POSTED BY: Bob Wyman
Answer
1 month ago

Hi Bob,

would this work for you?

Plot[{y/324, y/275, y/221}, {y, 200, 1000}, PlotLegends -> {"Oil", "Propane", "Gas"}, Frame -> True, FrameLabel -> {"x-Axis", "y-Axis"}, 
LabelStyle -> Directive[Bold, 15],RotateLabel-> False]

enter image description here

Actually the RotateLabel function should not be necessary, but the labelling of the y-axis overlapped with the figure without it. I suppose that's a minor glitch in the Cloud.

Cheers,

Marco Marco

POSTED BY: Marco Thiel
Answer
1 month ago

Marco, thanks. That is much closer to what I was looking for.

POSTED BY: Bob Wyman
Answer
1 month ago