This is inspired by MapleTA, but applies to Maple in general. According to the documentation, bitmap plot devices do not allow for font selection, meaning the recommended textplot(...,font=[SYMBOL]) fails to render greek characters such as π in plots which are rendered for embedding in web pages. This seems like a gaping omission, so we're hoping we've just missed something here. Is there any way to get the symbol for pi onto a jpeg or gif plot?
Allegedly, exporting an entire worksheet to HTML using the GUI can accomplish this, but this seems an awkward method in general and is entirely unusable for us in MapleTA or in scripted desktop environments. What gives? Has anybody encountered any clever workarounds?
Thanks in advance for any suggestions...
Phil
Another piece of
Another piece of information: You don't need to export the *entire* worksheet to HTML to get a good gif; right-clicking on an image in a worksheet and exporting as GIF works, too.
Unfortunately, this still seems to be useless on the command line or in MapleTA.
PR
Plots with LaTeX in Sage
In Sage it is as simple as (an example from David Joyner's post)
sage: P1 = plot(sin(x), (x,-pi,pi)) sage: P2 = text("$y=\sin(x),\ -\pi\leq x\leq \pi$", (1.5,4)) sage: p=P1+P2 sage: p.save("sin.png")Alec
recommended?
Who recommends using textplot and the SYMBOL font, when using Maple's Standard GUI?
Can you not simply use the techniques described on the ?plot,typesetting help-page?
See ?plot,device and ?plot,setup if you are not familiar with how to programatically export plots to gif, jpeg, etc.
acer
Command line
I just tried to use command line to get a gif of jpeg output with π, and I was not able to (beside using external tools such as pstogif).
If there is a way to getting it from a command line, I would like to know about that.
Alec
sort of
Taking your plot above as an example, in the Standard GUI I might do it something like this,
That produces the plot in the output file, with the greek symbol for pi, and no mouse action required.
It would be nice the mathematical typsetting power separated away from Maple's semantic preconceptions. See above, the trick needed to typeset pi < x < pi.
I don't know of a way entirely programatically to get the symbol for pi in the output file from the commandline interface, without resorting to textplot and changing the font in the plot call. In that interface, one can also issue plotsetup(maplets) and then export with the mouse from the pop-up plotting Maplet's menu. But it's not the same.
acer
Standard vs. command line
Yes, in standard GUI one can do much more than in command line Maple. If I understand the original question correctly, (s)he wanted to do that from a command line.
Alec
misunderstood
I didn't understand the original question correctly, sorry. I don't know a way to get typeset greek symbols (or 2D Math) into a bmp/gif/jpeg image of a plot directly from the commandline interface, using only scripted Maple.
acer
Exactly
Yes, the GUI does everything as expected; the particular command line interface that's causing problems for me is the MapleTA "plotmaple()" call, which only allows functionality roughly equivalent to Maple's text-mode interface (which has the same issue, since both appear to use the mplotgif and mplotjpeg backends). This is in addition to the fact that MapleTA in particular (and I suspect various other web-related tasks for which people may want to use Maple) is limited to web-standard image formats, GIF and JPEG, the plot devices for which cannot (according to the Maple documentation) honor non-Roman character sets.
I have to say I really liked the Sage idea; I'll have to keep that trick in mind in the future. I don't think I will be able to use it in this particular case, but the output posted above seems to be very well rendered (and more accurate than Maple's bitmap devices which seem to displace the axes by a few pixels). ps2gif had occurred to me as well, and may work for others with similar problems, but it will probably not work with MapleTA.
Phil
(edit: I posted this in the wrong place; it was intended as a reply to "Standard vs. command line" amongst Alec's and acer's posts)
This site
This site has a lot of html and javascript errors which are not fixed for years. This thing, when you post a reply to a comment, and instead it appears as a new post in a thread, happens with me a lot.
I'm not sure about Tim, but Will is competent. He, probably, just doesn't have time to fix that.
Alec
shifting axes
pregier, do you have an example where you see Maple shifting axes? I only know of this being done with axes=boxed and axes=framed, in order to avoid obscuring lines that might lie right under the axes? It shouldn't do it anywhere else.
David Clayworth Maplesoft GUI Developer
Summarising
I thought I'd summarise the situation.
As of Maple 11, when full math typesetting was introduced to Maple 2D plots, font=SYMBOL is no longer the recommended way of getting non-Roman characters into plots. The recommended way in the Standard GUI is to use the typesetting mechanism, as acer said. You can export individual plots using menus or plotdevice/plotsetup, all of which recognise math in plots when used from the Standard GUI. Doing this is very easy. You can export many plots (to GIF) by exporting the worksheet to HTML, or in any format by specifying the file to write to in the worksheet before each plot, just like the Sage example. Create a worksheet with the plots you need, add a plotdevice statement before each to set the filename and format, and execute the worksheet in Standard GUI.
The drivers available in command line Maple are not nearly as powerful (since command line Maple isn't intended for plotting) and don't support typeset math. This isn't usually an issue. I'm not familiar with the way MapleTA uses these drivers, but you might consider re-asking this question on the MapleTA forum, where somebody might know another approach.
David Clayworth Maplesoft GUI Developer
Thanks
Thanks, David; this is useful information, and certainly sheds light on the problem. In particular, you are correct that the Standard GUI does not generate inaccurate bitmap plots; I had overlooked this fact. The following sequence generates a good plot in xmaple, but suggests a root near x=0.5 in command-line maple:
plotsetup(gif,plotoptions="width=350,height=250");
plot([x,x^3,x=-2..2],filled=false,x=-2..2,y=-5..5);
The fact that "command line Maple isn't intended for plotting" would appear to be the whole of the problem here; I can certainly try the MapleTA forum, but I think I know what I will find there. From what I can tell, the MapleTA plot generation functions *ARE* the command-line Maple drivers; in both cases an 'mplotgif' process is spawned, and the output is visually indistinguishable. If it is indeed the fact that command line Maple is not intended for plotting and if this necessarily means that command line Maple cannot produce full-featured bitmap plots, then the chance that a workaround exists for MapleTA is essentially nil.
This is why I posted in the general Maple forum, and I think I have my answer; again, the information you've provided is greatly appreciated. If anybody else has any other creative solutions, I'm all ears.
Phil
Command line Maple output for above:
MapleTA output:
What is the issue?
It is not a correct appreciation: exporting plots with typesetted math from the command line is an issue, and a rather important one.
I really do not believe that this functionallity is only available through menues. Somewhere there should be undocumented commands for these purposes, kept in secret.
GUI features from command line
I can't be certain, but I think it is actually possible for these features to be strictly GUI-only; I get the impression that much of Maple's current GUI functionality resides in the Java layer, and that the Java code can use the legacy features but of course the legacy code cannot use Java features. I suspect OpenMaple may alleviate this problem for some tasks, but I have not found documentation to verify this and would probably not be able to make use of it if I did.
I agree that this is an important issue, but I'm not terribly surprised either, and it would appear that there is little if anything to be done about it (and I would rather know that than waste countless hours trying to achieve the impossible). If I do happen to find any useful tricks, I will certainly post them here.
It is true
I'm afraid the typeset math plots are only available in the Standard GUI; through plotdevice as well as menus, but only in the Standard GUI. There are no 'secret' commands that we are keeping from you, jakubi. I'm not sure why we would want to do that - it's in our interest to make this functionality as widely available as possible.
David Clayworth Maplesoft GUI Developer
"secret" commands
There are many cases of such undocumented commands. We can begin to discuss on this issue, case by case if you wish. May be better in another thread as it might be a long discussion. Do you want to do that?
On the other hand, if its in your interest to make this functionality as widely available as possible, it would help a lot if you make it accesible from the command line and document it properly.
I do not see any problem of principle with Java code. Presumably external calling should be able to make it accesible, isn't it?
Not in this case
I'm sorry Jakubi, I did not mean to imply that there were no undocumented commands at all in Maple; as I'm sure you're aware there are. I did mean to say that there were no undocumented commands that do the functionality we were talking about.
David Clayworth Maplesoft GUI Developer
plotting
I agree with you that the task of wholly scripted generation of plots (in any interface of Maple) is important. As far as I know, that is not possible (in any interface) if the plot must have typeset 2D Math and be exported as bmp/gif/jpeg. For some people, the bit about it being wholly scripted is important.
The statement that commandline interface is not "intended" for plotting reads as doublethink for me.
But it could be true that there is no secret, hidden command to get the desired effects. In the commandline interface, plot will eventually call INTERFACE_PLOT. I suspect that is a call to something which is not a Library function, nor a kernel built-in, but rather a function of the interface itself. In Standard, there likely is java code which does the rest of the work, and in commandline it is something inside the cmaple binary.
Trying to fool the commandline interface, by some crude assignments like the following, didn't bypass anything.
IsWorksheetInterface():=true: Plot:-CheckStandardInterface(('feature') = "caption"):=true:Now consider, if the commandline interface can fire up the java runtime in order to throw up graphical plots when the plotdevice is set to 'maplets' (and indeed it can and does!) then it could in principle start it up to access Standard's plot export functions too. It should be fixable.
acer
plots in MapleTA
Maple TA 4.0 supports using MapleNet as the infrastructure to evaluate commands. Using this setup you will get the GUI's plot renderer in Maple TA instead of the commandline version's. Greek characters such as &pi will render correctly.