Message Boards Message Boards

Are PlotLegend and axis labeling supported for Wolfram|Alpha?

Posted 9 years ago

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
6 Replies

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

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

W|A graph with axis labels

In that I'm querying Alpha for the Mathematica expression necessary to create the plot it displays, and Show[]ing it with the options we want. You can add any Plot options you want.

There's probably an easier way to do this, but this was the first I found.

Although I'm a little confused as to why you can't just do Plot[{y/324, y/275, y/221}, {y, 200, 1000}]...

POSTED BY: Jesse Friedman
Posted 9 years 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

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:

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.



POSTED BY: Marco Thiel
Posted 9 years 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

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.


Marco Marco

POSTED BY: Marco Thiel
Posted 9 years ago

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

POSTED BY: Bob Wyman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract