The copy of Mathematica 8 I am using does not recognize the PlotLegend option for Plot and ListPlot. Specifically, it appears red when used.
A quick online search turns out nothing buggy/unusual, so I'm wondering what the problem is.
You didn't load the necessary package by any chance? That is, did you use:
Needs["PlotLegends`"]
Related
In this screenshot of my vimrc settings, I have installed the plugin vim-airline using vundle. After going through airlines docs, I found the set of lines to customise my airline.
The problem is the ones highlighted in red. The blue highlighted one works fine but the red one does not. The left one is same as right one. I tried using different Unicode symbols but does not work. Any workaround to this situation as this is troubling my OCD :P.
Thanks in advance.
This is a well-known issue related to the font (size and family) used in your terminal.
For a better display, you have two solutions:
Do not use arrows as separators
Configure your terminal emulator to use a patched font with the right size
If you prefer the first solution, make sure you have this code in your .vimrc:
let g:airline_right_sep = ""
let g:airline_left_sep = ""
If you prefer the other solution, take a look at this: https://github.com/powerline/fonts
I have used the Hack font with size 11 for a long time and the arrows are perfectly displayed in my editor...
I want to have a PlotLegend in the top-right corner of the plot, but this option does not work.
How can I add PlotLegend into my Plot? Should I buy Mathematica 8?
u=Sech[x];
w=Cos[x];
v=Sin[x]^2;
Plot[{u,w,v},{x,-5,5},PlotStyle->{Automatic,Dashed,DotDashed},
PlotLegend->{"Sech[x]","Cos[x]","Sin[x]"}]
PlotLegend has always (at least since 2.2) been loaded through an add-on package.
Upgrade if you want, but loading legends using Needs["PlotLegends`"] should do the trick.
I've encountered such a problem, and hope you guys could help me out here.
I have a plot in my GUI, contained multiple lines with different linspecs and a group of legends.
And I've made a context menu which should allow users to open the EXACTLY same plot(retaining all line settings, title, legends, and so forth) in a new window(default figure, where it is able to save/edit the figure).
However I couldn't find a simple way to migrate the plot, except re-run the plot commands which is quite complicated(plot different data, etc.)
So, I am looking for the solution in the following two ways:
is there a simple way to migrate the plot into new figure window?
or is it possible to save the plot directly with current interface?
For 2, I'd like to clarify that I only want to save the plot, not all GUI interface. I've tried saveas(handle.Plot,...) but it saved the GUI interface as an entity.
I hope the point has been made clear, thanks for your time. Cheers.
For this task you can probably use the builtin Matlab function copyobj which does exactly this (i.e. the first option mentionned in your question).
The following piece of code demonstrates its usage:
h1=figure;
a1=plot((1:100),rand(1,100),'r-');
hold on
plot((1:100),rand(1,100),'b+');
legend({'plot1';'plot2'});
h2=figure;
copyobj(get(h1,'children'),h2);
Hope it works as well in your case.
UPDATE: as far as I understand this, your second solution would involve the saveas function which unfortunately works with the figure environment and not with axes (as you experienced it). So a workaround would probably involve copying the desired axes to a new figure with the method given above and then use saveas.
I have a Mathematica Notebook with Plot's, Images, Tables and text that I would like to present in a file. I've tried to append >>> all the stuff in a nb or m put that leads to nothing (the plot comes up as -graphic-).
I'm sure a lot of people have done this before! What is the best approach for such a task?
Why don't you just save your current notebook as PDF, using the File menu, perhaps after applying a suitable stylesheet? or is this Mac only functionality?
Mathematica offers the Notation package to define custom notation, and it seems to work great until I save a notebook with custom notation as a package and try to use Needs["..."] to import the new notation. As documented on the Mathematica mailing list, this causes bizarre syntax errors when evaluating any call to Notation[]. The suggested solution is to manually open the notation notebook and evaluate it into the kernel, but this is a pain for files that I plan on distributing. If anyone has a better workaround for the problem, I'd really appreciate the help!
I think your problem lies in the way Mathematica treats Notation[], quote:
When defining your own notations it is
critically important to use the
notation templates. The reason for
this restriction is that the templates
pasted into a notebook contain
essential tag boxes embedded in the
correct way.
It may not be possible at all to have a package file call Notation[], but there is a suggestion of using ParsedBoxWrapper which I didn't have time to play around with right now.
There is a kludgy solution to your problem, which is that you put all the Notation[] assignments into one cell of the Notebook and make it an initialization cell (right click on the cell edge --> Initalization Cell). This will incidentally also create a .m file with just the contents of that cell (but this file will, alas, not work with Needs[] or <<). After that you can collapse the cell, make it uneditable, unevaluatable, and hey presto! Almost like what you want.
I should note that from a distribution point of view this kludge is rather nice since the .m file gets regenerated every time you load the main file so you don't need to ship multiple files. The only downside is a slightly ugly Notebook (i.e. one hidden cell), and a pop up asking whether you want to evaluate the initialization cells of the Notebook whenever you first evaluate something in that Notebook.