Hi all. How do I plot sin(x) such that only Pi/2, Pi/, 3Pi/2 and 2Pi appear on the x axis and the values 0, -1 and 1 appear on the y-axis and the axes x and y appear at the appropriate axes?
Right click on the plot. Go to Axes, then select Properties. Uncheck the box that says: Let the renderer chosse tickmarks. Clcik the Custom Spacing Circle. Then check off the box that says: Multiply by Pi. If the default range is not long enough, then you can change it by assinging a range value to x.
>plot(sin(x),x=-15..15);
I believe this is available in Maple 11 as well. If you are using an earlier version, then see this link.
The plot command received a number of new options that provide users with greatly improved tools for creating nice plots. In addition to tickmarks (and xtickmarks and ytickmarks), you should take a look at the axis and typesetting options. Each of these has its own help page:
?plot,tickmarks
?plot,axis
?plot,typesetting
I hope this gives you some new and useful tools.
Doug
---------------------------------------------------------------------
Douglas B. Meade <><
Math, USC, Columbia, SC 29208 E-mail: mailto:meade@math.sc.edu
Phone: (803) 777-6183 URL: http://www.math.sc.ed
Hi all. Thank you for all the help, in particular Georgios Kokovidis's suggestion (with the link).
There were a couple of problems I encountered. The plot went beautifully.
However, when I tried exporting the graph to an eps file so that I can include it in my LaTeX file, 2 problems arises after latexing the file and "pdfing" it. One, the file was rotated anticlockwise by 90 degrees. Second, where I had -2Pi and -3Pi/2 plotted in Maple 12, the negative signs became "plus and minus" signs in the PDF file generated from LaTeX (the plus and minus signs I am referring to if you use LaTeX is \pm.).
You will have, in general, better success with math expressions in plot captions, etc., if you use the typesetting capabilities built-in to plot. For example,
plot( 2*cos(x/2-Pi/6), x=-2*Pi..2*Pi,
tickmarks=[spacing(Pi/2,0),3],
title=typeset("A plot of one period of \n", y=2*cos(x/2-Pi/6)) );
As far as creating plots for use in LaTeX, my current process is to manually export the plot to a GIF or JPEG file, then convert each image to a PDF file, which can now be brought into my (pdf)LaTeX documents. (The exporting to a file can be automated using plotsetup.
I think you'll have much more success with this approach.
Doug
---------------------------------------------------------------------
Douglas B. Meade <><
Math, USC, Columbia, SC 29208 E-mail: mailto:meade@math.sc.edu
Phone: (803) 777-6183 URL: http://www.math.sc.ed
Doug, the above plot command does not actually label the plot with y=2*cos(x/2-Pi/6)). Maple "simplifies" and labels it as y=2*sin(x/2+Pi/3). I realize that these are the same, but the typeset command should just label the plots with whatever we tell it to label them with, and not automatically simplify into another trigonometric form, regardless of the equality of the two statements.
> plot( 2*cos(x/2-Pi/6), x=-2*Pi..2*Pi,
tickmarks=[spacing(Pi/2,0),3],
title=typeset("A plot of one period of \n", y='2*cos(x/2-Pi/6)') );
That is still not perfect: it gives you . So I tried this, which worked:
> plot( 2*cos(x/2-Pi/6), x=-2*Pi..2*Pi,
tickmarks=[spacing(Pi/2,0),3],
title=typeset("A plot of one period of \n", y=Typesetting[Typeset](2*cos(x/2-Pi/6)) ));
I did not pay enough attention to catch this. You are correct, and I understand why Maple did this. Maybe the typeset option should be modified to prevent automatic simplification of its arguments.
For this example, I avoided this problem by putting cos in single quotes, 'cos'. While this prevented the automatic simplificaiton it did not affect the typesetting of the fractions. For that, you need Robert's solution.
Doug
---------------------------------------------------------------------
Douglas B. Meade <><
Math, USC, Columbia, SC 29208 E-mail: mailto:meade@math.sc.edu
Phone: (803) 777-6183 URL: http://www.math.sc.ed
The real reason you're seeing the difference in the titles is because of standard and extended typesetting. The plot system currently uses standard typesetting, even when the user changes the default to extended. However, the call to Typesetting[Typeset] generates the extended typesetting output. We hope to resolve some of these standard/extended typesetting issues in the future. In the meantime, you can use Typesetting[Typeset] to achieve the desired result, but it's one of those "use at your own risk" routines. It's meant to be an internal undocumented routine, but there is some information about it on the Typesetting help page, as it can be useful to users in some cases.
If you are not restricted to generating all parts of the plot programmatically and can adjust it interactively, then the easiest way to get the desired title is to edit the title in place using the context menu.
I agree that the context menus are the easiest way to customize a plot, but I wish there was a way to get Maple to return the command needed to (re)produce the plot from the command line. This seems like it should not be too difficult to achieve. What are the chances it could appear in the near future?
Doug
---------------------------------------------------------------------
Douglas B. Meade <><
Math, USC, Columbia, SC 29208 E-mail: mailto:meade@math.sc.edu
Phone: (803) 777-6183 URL: http://www.math.sc.ed
Doug writes: "I agree that the context menus are the easiest way to customize a plot, but I wish there was a way to get Maple to return the command needed to (re)produce the plot from the command line. This seems like it should not be too difficult to achieve. What are the chances it could appear in the near future?"
For the very near future, I don't think the chances of getting this feature are good. In general, plots can be created through a combination of library commands, context-menu actions and drag-and-drop actions. For anything other than the most simple cases, I'd think it would be difficult to recover a library command to generate an arbitrary plot.
However, in the long term, there may be other features that will make it easier to keep track of changing options in plots. As some of you have noticed, there have been steady improvements in plots over the past few releases. I expect that making plots better and easier to use will continue to be a priority in the future.
For me, this menu method is the more difficult way to customize plots, as it makes much more harder to produce similar customization for multiple plots or for variations of the same plot along multiple sessions. No register is kept of such menu actions and I would not remember what I did time before.
So, I see this impossibility to recover the library commands as a very bad design.
There are different questions being asked here. The one that Doug asked was, "Can I get a Maple command that reproduces a particular plot that might have undergone context-menu changes?" Another question is, "How do I keep track of context-menu actions I've made?" Other questions not explicitly asked, but which I assume are of interest, are "Can I get a library command that corresponds to a context-menu action?" (slightly different from the first question) and "How do I keep track of current option values?"
I was responding to the first question from Doug about retrieving a plot command. I don't see this feature appearing in the very near future, but I wouldn't go so far as to call it an "impossibility". However, it may be more useful to provide, in future releases, better ways of keeping track of current plot option values and setting defaults that can be applied to multiple plots. We do have the plots[setoptions] command right now, but it has some limitations.
The graph plotted beautifully. The plot is to show y=2cos(x/2-Pi/6) is merely a shift of y=2cos(x/2) with period 4Pi, displacement Pi/3, limits -2 and 2 and the graph starting at Pi/3 and ending at 13Pi/3. The only downfall was that Pi was not outputted as a symbolic form in the plot. It just gave y=2cos(x/2-Pi/6) instead of giving the symbol Pi where appropriate.
Maple should design the software such that the commands that works in Maple 12 should also work in the Classic Worksheet as well.
Agreed. I have been vocal about your concerns in this forum for a long time. A while ago I addressed this issue with a workaround using textplot. It is rather painful in that you have to figure out exactly where to place the symbol, but if you "must" have the symbolic version, you can do it. See a previous thread here.
Almost all of the new plotting features added in versions of Maple after Maple 9 are available for the Standard Worksheet interface only. Certainly, some users have good reason to stay with the Classic Worksheet, as it requires less memory to run. However, if this is not an issue for you, then I recommend using the Standard Worksheet, particularly for plots. I believe that most would agree with me that plotting in the Standard interface is far superior in Maple 12 than plotting in the Classic interface.
Some users stick with the Classic interface because they don't like the new 2-d math input available with the Standard interface but are unaware that you can actually set the input mode to 1-d math in the Standard worksheet (by going to the Options dialog in the Tools menu) and enter commands just as you would in the Classic worksheet. The difference is that you'll still be able to use all the new plotting features, including typesetting, although I'd still maintain that getting typeset math in plots is easier if you do enable 2-d input.
Paulina, thanks for your input. I use Standard Interface with 1-d math. Having two different interfaces adds confusion. How about 1 interface, with a toggle mode to go between 1-d and 2-d. That way you have the best of both worlds. As you can see from the questions that users are posting here, this item comes up on a regular basis. Either have all of the features available in Classic, or do away with it completely, and offer a seamless method to switch between modes for legacy users and new users who do not care about 1-d math mode.
Unfortunately, this code will not work on the normal Maple worksheet (non classic). It keeps complaining about an error with p5 (which is the pointplot).
"Error, (in plots:-display) expecting plot structures but received: {plots:-pointplot*([[(1/3)*Pi, 0], [(4/3)*Pi, 0], [(7/3)*Pi, 0], [(10/3)*Pi, 0], [(13/3)*Pi, 0], [2*Pi, 0], [3*Pi, 0], [4*Pi, 0], [0, 2], [0, -2]], symbol = CROSS)}"
From this, I have learned:
(1) "Classic Worksheet Maple 12" is not compatible with "Maple 12". That shouldn't be the case! If it works in Classic Worksheet, it should also work in the normal worksheet.
(2) When the plot is done, I right clicked on the plot, go to "Export As" , choose "Encapsulated Postscript (EPS)" and save it as a eps file. Problems then arises when trying to embed this eps file into LaTeX with the usual begin{figure}, etc. Problem 1: The plot is rotated anti clockwise by 90 degrees. Problem 2: Whenever there is a minus sign in front of some Pi symbols, Maple converts it to "plus or minus" signs -- the \pm sign if you use LaTeX. See my second post.
Hopefully, developers of Maple will do some changes to tackle these problems for the new release. We don't want Maple to be like another "you know who" suite where problems just rolled over.
kris2099, I'm guessing your error is caused by the space after "pointplot" in the assignment to p5. This is because, in 2-D math, there is support for implicit multiplication, so an expression of the form "x (y)" is interpreted as x*y. You have to remove the space for this input to work in 2-d math.
Please note that this has nothing to do with Standard vs. Classic, but it is a difference between 1-d and 2-d input. If you set the input mode to 1-d in the Standard worksheet, your commands will work just like they do in Classic. As I mentioned in my previous message, problems with 2-d input should not prevent you from using the Standard worksheet as you can easily switch to the 1-d mode that's used in Classic.
Georgios, I do agree with you that the two interfaces can be confusing. However, some users still need to use Classic if their machines don't have enough memory to support Standard. For users who don't have this problem, I recommend switching to Standard. Some people just prefer to stay with Classic because of the faster response time. Fair enough ... but you have to give up a lot of new features when you do that. it really depends on what your Maple needs are.
As pagan points out, it is possible to easily toggle between 1-d and 2-d input modes in the Standard worksheet, so the new input mode should not be a barrier to using the Standard worksheet.
I know there are mixed opinions about 2-d input, but my personal feeling is that both 1-d and 2-d input modes are useful. There are different circumstances in which one or the other is better suited to the task, and in the Standard worksheet, you can use both.
I have made the appropriate changes (getting rid of the extra space) and now it works on the Standard worksheet as well as the Classic Worksheet.
However, my point number 2 still stands -- regarding the EPS file and LaTeX problem. The problem should not be happening -- with the changes to the "plus/minus" signs and the rotation.
To get around it, I had to copy the graph from Maple and paste it into Adobe Illustrator CS3 and then save it as a EPS file. This is a pain but it is a temporary fix.
The fonts that you get that way may look bad as well (I didn't test that.) Usually people just create plot without tickmarks or any other text in Maple, and then add tickmarks and othetr text in Adobe Illustrator. Last time I did that (a couple, or maybe, 3 years ago), the results were satisfactory, and definitely much better than trying to use Maple for Pi or some other text.
Hi Alec. I had to use it -- no choice. I tried exporting the Maple plot to an EPS file and then integrating it into LaTeX. And I got the problem (see "The concluding saga to: "How to plot" with success! ") I thought my command in LaTeX was wrong, so I opened the EPS file by itself and it gave the same dreadful plot (which was wrong).
So copying the Maple plot and pasting it into Adobe Illustrator CS3 and then saving it as a EPS file was the only quick fix that I came up with......unless Paulina could come up with something better?????
Did you try converting the whole worksheet to LaTeX? As far as I recall, the resulting eps files looked better (at some point in Maple history) - at least were not rotated by 90 degrees.
Hi Alec. I don't need the whole worksheet to be converted. Just the plots. Yes, I have done this before in previous versions of Maple and had no problems with it.
Why don't you try it yourself with the new Classic Worksheet Maple 12?
Once the graph is plotted, right click on it, then choose "Export As" and then "Encapsulated Postscript (EPS)". Then try opening this file with extension eps or try putting it into your normal LaTeX code (I used \begin{figure},etc). You will see what I mean in the negative x axis.
All are welcomed to try this code and see if it happens to you?! Paulina --- if you could please try this, it would be greatly appreciated.
BTW, what is this "point system"? Everytime I post a new post, I get 1 point. What does these points enable you to do?
Did you try that in Standard Maple? As far as I remember, In Maple 12 it was better than in Classic. I have Maple 12 discs, but didn't have time to install them yet (because I don't use Maple personally). I might try to do that later though - and not just to help you :)
If I changed elements like `-p/2` to `- p/2`, with a space after the minus sign, then it appeared better in the exported .eps file. The symbol showed as minus rather than plusminus, and the extra whitespace didn't seem too glaring.
But then I tried something else. There is also a programmatic way to export the plot. before the display call, I added this command,
That command will make plots get written directly to the file. The plot won't also appear visually. Using the exporter, I found that the original syntax you used of `-p/2` would come out with the correct minus sign in the .eps file.
I used ghostview to preview the .eps file, rather than embedding it into latex.
Is the "90 degree rotation" issue just one of portrait versus landscape, for Postscript?
It's fun, no, that Maple has (at least) three distinct Postscript converters? (Ie, the menu driven one in Standard, the menu driven one in Classic, and that programmatic command available in each interface.)
The command plotsetup(default) will reset the plot device to its original default setting (ie, visual display of plots).
Not sure whether fun or sad. I find that the Maple system keeps accumulating different versions for most features, though not maintaining many of them.
For me, there are so many (free) tools around there for plotting, and so many of them are supersedding of any of Maple possibilities by (I don'y know how to name that) a generation or two ahead, why anybody would use Maple for that?
Hi Alec. I just tried it with the standard worksheet. The graph was not rotated -- it was upright as it should be! The "plus and minus" signs disappeared in the x axis including the minus signs in the negative x axis! D'OH!
Now, seriously, if Maple 12 was written properly, why would you get 2 different outputs from the Classic Worksheet and the Standard Worksheet?!
Anyone else besides Alec around??? :)
Urmm......Alec, could you please shed some light in the "points" system as previously mentioned?
I suspect that he is referring to the Mapleprimes points system.
For example, by clicking on the number beside your "red leaf". And so one can get to the rankings here.
To try to answer the question, about what they are used for, not much except to indicate how many posts have been made from the given member-handle. I believe that some ability to edit own's own posts (or perhaps to post blog entries?) is enabled once one attains a number (10?) of posts.
The eps file exported from Classic GUI using the menu, opens in Ghostscript upside-down and with plus-minus signs at tickmarks that should be -3*Pi/2 and -2*Pi.
The default plotting device for Classic and Standard GUI are different. Frequently, Standard device plots look better (I understand that it is the only one under active development), though for some plots I prefer the Classic version.
You can use 'plotsetup(maplet)' to see plots in Classic GUI with the Standard (Java) device (though not for export, apparently)
You're very welcome. You caught the fact that when using the plotsetup command (to specify the "ps" driver) the extra space after the minus sign may not be necessary, yes?
My first try would be to use Maple's Standard interface. Robert Israel's reply seemed nice (as usual).
I didn't see where you might have written why you prefer to use Classic over Standard. I use Standard with Worksheets instead of Documents, and 1D Maple input instead of 2D Math input (as the global defaults for all new sessions, configurable under the Options menus) when I want to use a GUI.
Unfortunately, the removal of the space in `-3 Pi/2` and `-2 Pi` (using Maple 12 Classic Worksheet) still results in a plus/minus sign when viewed in Ghostview 4.9. Using Adobe Illustrator CS3, it becomes a small empty little box instead of a negative sign.
With the menu-driven Postscript exporter in Classic, `-p/2` produces plusminus Pi/2 when using the SYMBOL font, but works OK and produces -Pi/2 with the programmatic exporter. But `-3p/2` produces plusminus in both.
A curious bug. I'm glad that adding a space after the minus sign was some sort of workaround.
kris2099, I'm not that knowledgeable about how plot exports work but I'll see if one of my colleagues can shed some light on this matter. (I maintain many of the library plotting commands but a large part of the plotting system is maintained by my colleagues in the GUI Group). You might not get an answer right away though. Not all of us read MaplePrimes on the weekend. :-)
Once the plot is displayed on the screen, I right-clicked on the plot, choose "Export As" -> "Encapsulated Postscript (EPS)" and then type in a name to save it.
Using Ghostview 4.9 to open this saved (eps) file, the resultant was that the graph is rotated anticlockwise by 90 degrees. The negative 3Pi/2 and negative 2Pi that are on the x axis becomes "plus or minus 3Pi/2" and "plus or minus 2Pi".
I have also tried to open this saved (eps) file using Adobe Illustrator CS3. The graph is still rotated anticlockwise by 90 degrees. The negative 3Pi/2 and negative 2Pi that are on the x axis becomes "box 3Pi/2" and "box 2Pi". The box means that an empty small square box is given instead of a negative sign.
One possible solution as suggested by Acer is to put a space in between the negative sign and 3p/2 in the textplot line p2 which would "cure" it. And to cure the rotation by 90 degrees problem, Acer suggested to insert an additional code:
> plotsetup(ps,plotoutput=`sine.eps`,plotoptions=`portrait,noborder`);
which will write the output to a file without showing the actual graph on the Maple worksheet.
Another completely new problem is for the code found below. Is there any other simpler way of doing this in the Classic Worksheet Maple 12? The code below is long and tedious.
Paulina asked me to respond to points raised in this thread. Since many points have been rasied, this may take a little time. Please bear with me.
Firstly I should point out that the Classic interface, while still supported by Maplesoft, is not being improved to the same degree as the Standard interface. The reason for that is that if we made every improvement to both interfaces it would take us twice as long, and our customers would get only half the number of improvements they would otherwise. Specifically in Maple 11 Standard there was a major upgrade to 2D plotting, including many new features, especially better control of tickmarks and the ability to write math directly into plots. If you are still using Classic and haven't tried plotting in Standard Maple recently I strongly recommend it.
Secondly most of the complexity (and poor quality) of the above example is because the user is trying to draw his own tickmarks by placing crosses and text at the appropriate places. Despite what was said above, this is not the usual way of using Maple. It is almost always unnecessary, and almost always produces worse results than doing the same thing in Maple's own tickmark control in the Standard interface. Here is an example which does exactly what is wanted. I'm also using the typesetting feature to lay out the functions better.
a1 := plot(2*cos((1/2)*x-(1/6)*Pi), x = (1/3)*Pi .. 13*Pi*(1/3), color = black, thickness = 2);
a2 := plot(2*cos((1/2)*x), x = 0 .. 4*Pi, color = black, linestyle = dashdot);
In Classic the decision was taken to rotate the plot 90 degrees by default because it was thought that most people wanted their plots in landscape. In retrospect this may not have been the best decision, but changing it would affect the export of every Classic user in the world, and probably cause users more trouble that it saved. As pointed out above, you can use options to specify a portrait orientation, and you should be able to rotate postscript files on import to LaTeX.
It is strongly recommended that you do not use the SYMBOL font any more. Since Maple 11 plots can handle any symbols, alphabets and typeset math as though they were regular text, which makes the SYMBOL font unnecessary (this was part of the improvements to the Standard interface). You can enter sympols directly into the plot commands using Pi as I did above, or using the "Greek" palette.
Export of symbols to postscript is sometimes tricky as it can depend on the fonts you have set up. Standard Maple handles them pretty well. In some older versions somes specified a default setup in which your postscript browser might substitute a non-standard symbol for the one we expected. I would imagine this is what is causing the substitution of +/- for the unary minus symbol. I would urge you to try this in the Standard interface and see if it still happens.
If you really don't want to set options for the postscript output then the rotation can be undone with a simple edit of the postscript file. Search the file for a line that says "%%IncludeResource: font Helvetica". After it there should be a line "n.n n.n translate" and then "90 rotate" (n.n is some real-valued number). Either remove these lines or comment them out by placing two % symbols at the front. Your plot should now be in landscape formation.
I hope that was helpful. Can I re-emphasise that everything you want can be done in the Standard interface. The commands you are posting above can be copied exactly to Standard (saving the extra space); if you like you can save the Classic worksheet and open it in Standard. Also you can specify the tickmarks using a single command instead of six, which should save some time, to say nothing of not having to position the text labels exactly.
I think you can use
I think you can use "textplot" command for your purpose.
How to plot
In Maple 12. Plot your function:
>plot(sin(x),x);
Right click on the plot. Go to Axes, then select Properties. Uncheck the box that says: Let the renderer chosse tickmarks. Clcik the Custom Spacing Circle. Then check off the box that says: Multiply by Pi. If the default range is not long enough, then you can change it by assinging a range value to x.
>plot(sin(x),x=-15..15);
I believe this is available in Maple 11 as well. If you are using an earlier version, then see this link.
Regards,
Georgios Kokovidis
Dräger Medical
tickmarks=[spacing(Pi),default]
Here's another way to achieve this result, using only the plot command and its options.
The plot command received a number of new options that provide users with greatly improved tools for creating nice plots. In addition to tickmarks (and xtickmarks and ytickmarks), you should take a look at the axis and typesetting options. Each of these has its own help page:
I hope this gives you some new and useful tools.
Doug
How to plot (RE: Georgios Kokovidis, Werner, Doug and all)
Hi all. Thank you for all the help, in particular Georgios Kokovidis's suggestion (with the link).
There were a couple of problems I encountered. The plot went beautifully.
However, when I tried exporting the graph to an eps file so that I can include it in my LaTeX file, 2 problems arises after latexing the file and "pdfing" it. One, the file was rotated anticlockwise by 90 degrees. Second, where I had -2Pi and -3Pi/2 plotted in Maple 12, the negative signs became "plus and minus" signs in the PDF file generated from LaTeX (the plus and minus signs I am referring to if you use LaTeX is \pm.).
I am puzzled!
Here is the code for Maple 12:
> with(plots):
> p1:=plot(sin(x),x=-2*Pi...2*Pi,tickmarks=[0,0],color=black):
> p2 := textplot([[Pi,-0.05,`p`], [Pi/2,-0.05,`p/2`],[-Pi/2,-0.05,`-p/2`], [-Pi,-0.05,`-p`],[0.2,-0.05,`0`],[-3*Pi/2,-0.05,`-3p/2`],[-2*Pi,-0.05,`-2p`],[3*Pi/2,-0.05,`3p/2`],[2*Pi,-0.05,`2p`]], align=below, font=[SYMBOL,10]):
> p3 := textplot([[-0.1,1.0,`1`], [-0.1,-1.0,`-1`],[-0.1,0.5,`y`],[2*Pi+1.5,-0.05,`x`]], align=left):
> p4:= pointplot ([[-Pi,0], [-Pi/2,0], [Pi/2,0],
[Pi,0],[0,1.0],[0,-1.0],[-3*Pi/2,0],[-2*Pi,0],[3*Pi/2,0],[2*Pi,0]], symbol=CROSS):
> display({p1,p2,p3,p4});
Another problem was when I tried using textplot, for example,
> p1:=textplot([[4*Pi/3+1,1,`y=2cos(x/2-Pi/6)`],[Pi-0.5,-1,`y=2cos (x/2)`]]):
the output was that the Pi within the quotation mark y=2cos(x/2-Pi/6) remains as Pi and not as a symbolic pi.
How do I overcome this?
Thanks.
How to plot.
Your first line, under the command with(plots): has an error in the range.
p1:=plot(sin(x),x=-2*Pi...2*Pi,tickmarks=[0,0],color=black):
should be
p1:=plot(sin(x),x=-2*Pi..2*Pi,tickmarks=[0,0],color=black):
You have an extra dot between -2*Pi and 2*Pi. I do not know if this will fix anything, but it does not help.
Later edit. This does not matter. It will not fix the LaTeX issue.
For your textplot question, here is an example that you can modify for your own use.
restart:
with(plots):
p := plot(sin(x), x = -2*Pi .. 2*Pi, tickmarks = [0, 0], color = black):
t1 := textplot([4*Pi*(1/3)+1, 1, typeset(''y = 2*cos((1/2)*x-(1/6)*Pi)'')], align = above):
t2 := textplot([5, .5, typeset(''y = 2*cos(x/(2*Pi))'')], align = above):
display({p, t1, t2});
You can play with the location values to align the equation wherever you want it.
The above will not work with the Classic V12 interface. Only with the Standard interface.
Regards,
Georgios Kokovidis
Dräger Medical
Extra dots do not matter
The following are all interpretted as the same range:
0..1
0...1
0....1
If you want the range with right endpoint 0.1 you could use
0.. 0.1
0.. .1
0... .1
Believe it or not, this is documented. See ?range where you will find, among other information:
Note that more than two dots in succession are also parsed as the range (`..`) operator.
Interesting!
Doug
simplified plots
Can't you get the first plot with a single plot command?
You will have, in general, better success with math expressions in plot captions, etc., if you use the typesetting capabilities built-in to plot. For example,
plot( 2*cos(x/2-Pi/6), x=-2*Pi..2*Pi, tickmarks=[spacing(Pi/2,0),3], title=typeset("A plot of one period of \n", y=2*cos(x/2-Pi/6)) );As far as creating plots for use in LaTeX, my current process is to manually export the plot to a GIF or JPEG file, then convert each image to a PDF file, which can now be brought into my (pdf)LaTeX documents. (The exporting to a file can be automated using plotsetup.
I think you'll have much more success with this approach.
Doug
simplified plot
Doug, the above plot command does not actually label the plot with y=2*cos(x/2-Pi/6)). Maple "simplifies" and labels it as y=2*sin(x/2+Pi/3). I realize that these are the same, but the typeset command should just label the plots with whatever we tell it to label them with, and not automatically simplify into another trigonometric form, regardless of the equality of the two statements.
Regards,
Georgios Kokovidis
Dräger Medical
Typesetting
My first try was using unevaluation quotes:
> plot( 2*cos(x/2-Pi/6), x=-2*Pi..2*Pi,
tickmarks=[spacing(Pi/2,0),3],
title=typeset("A plot of one period of \n", y='2*cos(x/2-Pi/6)') );
That is still not perfect: it gives you
. So I tried this, which worked:
> plot( 2*cos(x/2-Pi/6), x=-2*Pi..2*Pi,
tickmarks=[spacing(Pi/2,0),3],
title=typeset("A plot of one period of \n", y=Typesetting[Typeset](2*cos(x/2-Pi/6)) ));
Good catch!
I did not pay enough attention to catch this. You are correct, and I understand why Maple did this. Maybe the typeset option should be modified to prevent automatic simplification of its arguments.
For this example, I avoided this problem by putting cos in single quotes, 'cos'. While this prevented the automatic simplificaiton it did not affect the typesetting of the fractions. For that, you need Robert's solution.
Doug
Typeset title in plots
The real reason you're seeing the difference in the titles is because of standard and extended typesetting. The plot system currently uses standard typesetting, even when the user changes the default to extended. However, the call to Typesetting[Typeset] generates the extended typesetting output. We hope to resolve some of these standard/extended typesetting issues in the future. In the meantime, you can use Typesetting[Typeset] to achieve the desired result, but it's one of those "use at your own risk" routines. It's meant to be an internal undocumented routine, but there is some information about it on the Typesetting help page, as it can be useful to users in some cases.
If you are not restricted to generating all parts of the plot programmatically and can adjust it interactively, then the easiest way to get the desired title is to edit the title in place using the context menu.
Paulina Chin
Maplesoft
plots via context menu
I agree that the context menus are the easiest way to customize a plot, but I wish there was a way to get Maple to return the command needed to (re)produce the plot from the command line. This seems like it should not be too difficult to achieve. What are the chances it could appear in the near future?
Doug
Plot commands and context menu
Doug writes: "I agree that the context menus are the easiest way to customize a plot, but I wish there was a way to get Maple to return the command needed to (re)produce the plot from the command line. This seems like it should not be too difficult to achieve. What are the chances it could appear in the near future?"
For the very near future, I don't think the chances of getting this feature are good. In general, plots can be created through a combination of library commands, context-menu actions and drag-and-drop actions. For anything other than the most simple cases, I'd think it would be difficult to recover a library command to generate an arbitrary plot.
However, in the long term, there may be other features that will make it easier to keep track of changing options in plots. As some of you have noticed, there have been steady improvements in plots over the past few releases. I expect that making plots better and easier to use will continue to be a priority in the future.
Paulina
not easy
For me, this menu method is the more difficult way to customize plots, as it makes much more harder to produce similar customization for multiple plots or for variations of the same plot along multiple sessions. No register is kept of such menu actions and I would not remember what I did time before.
So, I see this impossibility to recover the library commands as a very bad design.
Customizing plots
There are different questions being asked here. The one that Doug asked was, "Can I get a Maple command that reproduces a particular plot that might have undergone context-menu changes?" Another question is, "How do I keep track of context-menu actions I've made?" Other questions not explicitly asked, but which I assume are of interest, are "Can I get a library command that corresponds to a context-menu action?" (slightly different from the first question) and "How do I keep track of current option values?"
I was responding to the first question from Doug about retrieving a plot command. I don't see this feature appearing in the very near future, but I wouldn't go so far as to call it an "impossibility". However, it may be more useful to provide, in future releases, better ways of keeping track of current plot option values and setting defaults that can be applied to multiple plots. We do have the plots[setoptions] command right now, but it has some limitations.
Paulina
semantics
We are using the word "impossibility" with two different meanings.
As a user, I care of what I have now: a system where it is impossible to keep track and reproduce programatically a sequence of menu options.
As a developer you talk about a future system, where you think that you will be able to introduce some improvements.
As we are talking about different things, there is no contradiction.
HELP: The continuing saga of "How to plot"
Hi all.
It is still not giving what I want.
I am using the Classic Worksheet Maple 12 and here's my code:
> restart;
> with(plots):
> p1:=plot(2*cos(1/2*x-Pi/6),x=Pi/3..13*Pi/3,tickmarks=[0,0],color=black,thickness=2):
> p2:=plot(2*cos(1/2*x),x=0..4*Pi,tickmarks=[0,0],color=black,linestyle=dashdot):
> p3:=textplot([[Pi-0.1,-0.05,`p`],[Pi/3+0.08,-0.05,`p/3`],[0.18,-0.05,`0`],[13*Pi/3-0.15,-0.05,`13p/3`],[4*Pi-0.1,-0.05,`4p`],[4*Pi/3+0.15,-0.05,`4p/3`],[7*Pi/3-0.1,-0.05,`7p/3`],[10*Pi/3+0.35,-0.05,`10p/3`],[2*Pi,-0.05,`2p`],[3*Pi,-0.05,`3p`]],align=below, font=[SYMBOL,10]):
> p4:=textplot([[-0.1,2.0,`2`],[-0.1,-2.0,`-2`],[-0.1,1.0,`y`],[13*Pi/3+1.5,-0.05,`x`]],align=left):
> p5:=pointplot ([[Pi/3,0],[4*Pi/3,0],[7*Pi/3,0],[10*Pi/3,0],[13*Pi/3,0],[2*Pi,0],[3*Pi,0],[4*Pi,0],[0,2],[0,-2]],symbol=CROSS):
> p6:=textplot([[4*Pi/3+1,1,`y=2cos(x/2-Pi/6)`],[Pi-0.5,-1,`y=2cos (x/2)`]]):
> display({p1,p2,p3,p4,p5,p6});
The graph plotted beautifully. The plot is to show y=2cos(x/2-Pi/6) is merely a shift of y=2cos(x/2) with period 4Pi, displacement Pi/3, limits -2 and 2 and the graph starting at Pi/3 and ending at 13Pi/3. The only downfall was that Pi was not outputted as a symbolic form in the plot. It just gave y=2cos(x/2-Pi/6) instead of giving the symbol Pi where appropriate.
Maple should design the software such that the commands that works in Maple 12 should also work in the Classic Worksheet as well.
frozen
The development of the Classic GUI seems frozen (much to my regret, as I use it most of the time).
plots with "special" characters
Agreed. I have been vocal about your concerns in this forum for a long time. A while ago I addressed this issue with a workaround using textplot. It is rather painful in that you have to figure out exactly where to place the symbol, but if you "must" have the symbolic version, you can do it. See a previous thread here.
Regards,
Georgios Kokovidis
Dräger Medical
Typesetting in Standard interface
Almost all of the new plotting features added in versions of Maple after Maple 9 are available for the Standard Worksheet interface only. Certainly, some users have good reason to stay with the Classic Worksheet, as it requires less memory to run. However, if this is not an issue for you, then I recommend using the Standard Worksheet, particularly for plots. I believe that most would agree with me that plotting in the Standard interface is far superior in Maple 12 than plotting in the Classic interface.
Some users stick with the Classic interface because they don't like the new 2-d math input available with the Standard interface but are unaware that you can actually set the input mode to 1-d math in the Standard worksheet (by going to the Options dialog in the Tools menu) and enter commands just as you would in the Classic worksheet. The difference is that you'll still be able to use all the new plotting features, including typesetting, although I'd still maintain that getting typeset math in plots is easier if you do enable 2-d input.
Paulina
Typesetting in Standard interface
Paulina, thanks for your input. I use Standard Interface with 1-d math. Having two different interfaces adds confusion. How about 1 interface, with a toggle mode to go between 1-d and 2-d. That way you have the best of both worlds. As you can see from the questions that users are posting here, this item comes up on a regular basis. Either have all of the features available in Classic, or do away with it completely, and offer a seamless method to switch between modes for legacy users and new users who do not care about 1-d math mode.
Regards,
Georgios Kokovidis
Dräger Medical
F5
I just use the F5 key to toggle between 1D and 2D input modes, when I'm in a Worksheet in the Standard GUI.
The concluding saga to: "How to plot" with success!
Dear all,
Thanks for all the input/output, especially Georgios Kokovidis! 3 cheers to you! :)
The thread was extremely helpful. I am now able to insert "Pi" into my Maple 12 Classic Worksheet now.
Here is the code to share around (if you are interested):
> restart;
> with(plots):
> p1:=plot(2*cos(1/2*x-Pi/6),x=Pi/3..13*Pi/3,tickmarks=[0,0],color=black,thickness=2):
> p2:=plot(2*cos(1/2*x),x=0..4*Pi,tickmarks=[0,0],color=black,linestyle=dashdot):
> p3:=textplot([[Pi-0.1,-0.05,`p`],[Pi/3+0.08,-0.05,`p/3`],[0.18,-0.05,`0`],[13*Pi/3-0.15,-0.05,`13p/3`],[4*Pi-0.1,-0.05,`4p`],[4*Pi/3+0.15,-0.05,`4p/3`],[7*Pi/3-0.1,-0.05,`7p/3`],[10*Pi/3+0.35,-0.05,`10p/3`],[2*Pi,-0.05,`2p`],[3*Pi,-0.05,`3p`]],align=below, font=[SYMBOL,10]):
> p4:=textplot([[-0.1,2.0,`2`],[-0.1,-2.0,`-2`],[-0.1,1.0,`y`],[13*Pi/3+1.5,-0.05,`x`]],align=left):
> p5:=pointplot ([[Pi/3,0],[4*Pi/3,0],[7*Pi/3,0],[10*Pi/3,0],[13*Pi/3,0],[2*Pi,0],[3*Pi,0],[4*Pi,0],[0,2],[0,-2]],symbol=CROSS):
> p6:=textplot([[4*Pi/3+0.6,1,`y=2cos(x/2-`],[Pi-0.5,-1,`y=2cos(x/2)`]]):
> p7:=textplot([4*Pi/3+2.0,1,"p"],font=[SYMBOL,12]):
> p8:=textplot([4*Pi/3+2.4,1,` /6)`]):
> display({p1,p2,p3,p4,p5,p6,p7,p8});
I have shrink the picture a tad as well.
Unfortunately, this code will not work on the normal Maple worksheet (non classic). It keeps complaining about an error with p5 (which is the pointplot).
"Error, (in plots:-display) expecting plot structures but received: {plots:-pointplot*([[(1/3)*Pi, 0], [(4/3)*Pi, 0], [(7/3)*Pi, 0], [(10/3)*Pi, 0], [(13/3)*Pi, 0], [2*Pi, 0], [3*Pi, 0], [4*Pi, 0], [0, 2], [0, -2]], symbol = CROSS)}"
From this, I have learned:
(1) "Classic Worksheet Maple 12" is not compatible with "Maple 12". That shouldn't be the case! If it works in Classic Worksheet, it should also work in the normal worksheet.
(2) When the plot is done, I right clicked on the plot, go to "Export As" , choose "Encapsulated Postscript (EPS)" and save it as a eps file. Problems then arises when trying to embed this eps file into LaTeX with the usual begin{figure}, etc. Problem 1: The plot is rotated anti clockwise by 90 degrees. Problem 2: Whenever there is a minus sign in front of some Pi symbols, Maple converts it to "plus or minus" signs -- the \pm sign if you use LaTeX. See my second post.
Hopefully, developers of Maple will do some changes to tackle these problems for the new release. We don't want Maple to be like another "you know who" suite where problems just rolled over.
Extra space in command?
kris2099, I'm guessing your error is caused by the space after "pointplot" in the assignment to p5. This is because, in 2-D math, there is support for implicit multiplication, so an expression of the form "x (y)" is interpreted as x*y. You have to remove the space for this input to work in 2-d math.
Please note that this has nothing to do with Standard vs. Classic, but it is a difference between 1-d and 2-d input. If you set the input mode to 1-d in the Standard worksheet, your commands will work just like they do in Classic. As I mentioned in my previous message, problems with 2-d input should not prevent you from using the Standard worksheet as you can easily switch to the 1-d mode that's used in Classic.
Paulina
Interfaces and input modes
Georgios, I do agree with you that the two interfaces can be confusing. However, some users still need to use Classic if their machines don't have enough memory to support Standard. For users who don't have this problem, I recommend switching to Standard. Some people just prefer to stay with Classic because of the faster response time. Fair enough ... but you have to give up a lot of new features when you do that. it really depends on what your Maple needs are.
As pagan points out, it is possible to easily toggle between 1-d and 2-d input modes in the Standard worksheet, so the new input mode should not be a barrier to using the Standard worksheet.
I know there are mixed opinions about 2-d input, but my personal feeling is that both 1-d and 2-d input modes are useful. There are different circumstances in which one or the other is better suited to the task, and in the Standard worksheet, you can use both.
Paulina
enough memory?
The case of this thread seems an example that even a lot of memory may not be a solution with the Standard GUI.
EPS and LaTeX
Hi Paulina. Thanks for the advice.
I have made the appropriate changes (getting rid of the extra space) and now it works on the Standard worksheet as well as the Classic Worksheet.
However, my point number 2 still stands -- regarding the EPS file and LaTeX problem. The problem should not be happening -- with the changes to the "plus/minus" signs and the rotation.
To get around it, I had to copy the graph from Maple and paste it into Adobe Illustrator CS3 and then save it as a EPS file. This is a pain but it is a temporary fix.
Chris
Adobe Illustrator
The fonts that you get that way may look bad as well (I didn't test that.) Usually people just create plot without tickmarks or any other text in Maple, and then add tickmarks and othetr text in Adobe Illustrator. Last time I did that (a couple, or maybe, 3 years ago), the results were satisfactory, and definitely much better than trying to use Maple for Pi or some other text.
Alec
EPS and LaTeX (II)
Hi Alec. I had to use it -- no choice. I tried exporting the Maple plot to an EPS file and then integrating it into LaTeX. And I got the problem (see "The concluding saga to: "How to plot" with success! ") I thought my command in LaTeX was wrong, so I opened the EPS file by itself and it gave the same dreadful plot (which was wrong).
So copying the Maple plot and pasting it into Adobe Illustrator CS3 and then saving it as a EPS file was the only quick fix that I came up with......unless Paulina could come up with something better?????
Convertting the worksheet to LaTeX
Did you try converting the whole worksheet to LaTeX? As far as I recall, the resulting eps files looked better (at some point in Maple history) - at least were not rotated by 90 degrees.
Alec
EPS and LaTeX (III)
Hi Alec. I don't need the whole worksheet to be converted. Just the plots. Yes, I have done this before in previous versions of Maple and had no problems with it.
Why don't you try it yourself with the new Classic Worksheet Maple 12?
Here's the code for a SIMPLE sine graph:
> restart;
> with(plots):
> p1:=plot(sin(x),x=-2*Pi..2*Pi,tickmarks=[0,0],color=black):
> p2 := textplot([[Pi,-0.05,`p`], [Pi/2,-0.05,`p/2`],[-Pi/2,-0.05,`-p/2`], [-Pi,-0.05,`-p`],[0.2,-0.05,`0`],[-3*Pi/2,-0.05,`-3p/2`],[-2*Pi,-0.05,`-2p`],[3*Pi/2,-0.05,`3p/2`],[2*Pi,-0.05,`2p`]], align=below, font=[SYMBOL,10]):
> p3 := textplot([[-0.1,1.0,`1`], [-0.1,-1.0,`-1`],[-0.1,0.5,`y`],[2*Pi+1.5,-0.05,`x`]],align=left):
> p4:= pointplot([[-Pi,0], [-Pi/2,0], [Pi/2,0],[Pi,0],[0,1.0],[0,-1.0],[-3*Pi/2,0],[-2*Pi,0],[3*Pi/2,0],[2*Pi,0]], symbol=CROSS):
> display({p1,p2,p3,p4});
Once the graph is plotted, right click on it, then choose "Export As" and then "Encapsulated Postscript (EPS)". Then try opening this file with extension eps or try putting it into your normal LaTeX code (I used \begin{figure},etc). You will see what I mean in the negative x axis.
All are welcomed to try this code and see if it happens to you?! Paulina --- if you could please try this, it would be greatly appreciated.
BTW, what is this "point system"? Everytime I post a new post, I get 1 point. What does these points enable you to do?
Chris
Standard Maple
Did you try that in Standard Maple? As far as I remember, In Maple 12 it was better than in Classic. I have Maple 12 discs, but didn't have time to install them yet (because I don't use Maple personally). I might try to do that later though - and not just to help you :)
Alec
slight change
If I changed elements like `-p/2` to `- p/2`, with a space after the minus sign, then it appeared better in the exported .eps file. The symbol showed as minus rather than plusminus, and the extra whitespace didn't seem too glaring.
But then I tried something else. There is also a programmatic way to export the plot. before the display call, I added this command,
That command will make plots get written directly to the file. The plot won't also appear visually. Using the exporter, I found that the original syntax you used of `-p/2` would come out with the correct minus sign in the .eps file.
I used ghostview to preview the .eps file, rather than embedding it into latex.
Is the "90 degree rotation" issue just one of portrait versus landscape, for Postscript?
It's fun, no, that Maple has (at least) three distinct Postscript converters? (Ie, the menu driven one in Standard, the menu driven one in Classic, and that programmatic command available in each interface.)
The command plotsetup(default) will reset the plot device to its original default setting (ie, visual display of plots).
acer
fun?
Not sure whether fun or sad. I find that the Maple system keeps accumulating different versions for most features, though not maintaining many of them.
for me
For me, there are so many (free) tools around there for plotting, and so many of them are supersedding of any of Maple possibilities by (I don'y know how to name that) a generation or two ahead, why anybody would use Maple for that?
Alec
EPS and LaTeX (IV)
Hi Alec. I just tried it with the standard worksheet. The graph was not rotated -- it was upright as it should be! The "plus and minus" signs disappeared in the x axis including the minus signs in the negative x axis! D'OH!
Now, seriously, if Maple 12 was written properly, why would you get 2 different outputs from the Classic Worksheet and the Standard Worksheet?!
Anyone else besides Alec around??? :)
Urmm......Alec, could you please shed some light in the "points" system as previously mentioned?
acer
I don't exactly understand what you mean by points system. Perhaps, acer can answer that. I see him around. I am good, but acer is better.
Alec
points
I suspect that he is referring to the Mapleprimes points system.
For example, by clicking on the number beside your "red leaf". And so one can get to the rankings here.
To try to answer the question, about what they are used for, not much except to indicate how many posts have been made from the given member-handle. I believe that some ability to edit own's own posts (or perhaps to post blog entries?) is enabled once one attains a number (10?) of posts.
acer
Points
Move your mouse pointer over the number that is next to your name, and click. An explanation will follow.
Regards,
Georgios Kokovidis
Dräger Medical
EPS and LaTeX (V)
Hi Georgios. Thanks for the help.
Now, I'll have to wait for Paulina's reply or someone else's reply in regards to the EPS and LaTeX problem I have.
Certainly
The eps file exported from Classic GUI using the menu, opens in Ghostscript upside-down and with plus-minus signs at tickmarks that should be -3*Pi/2 and -2*Pi.
The default plotting device for Classic and Standard GUI are different. Frequently, Standard device plots look better (I understand that it is the only one under active development), though for some plots I prefer the Classic version.
You can use 'plotsetup(maplet)' to see plots in Classic GUI with the Standard (Java) device (though not for export, apparently)
out of order
This order of this thread is a little mixed up. But this comment above may help.
acer
Hi Acer. Thanks for the
Hi Acer. Thanks for the suggestion.
A space after the negative sign and before 3Pi/2 helps!
Also, the additional code which immediately transform the output to a eps file is great! *thumbs up*
I embed the eps file into LaTeX and then convert the DVI file to PDF and use Adobe Acrobat 9 to view the result.
What kind of software would you use if I were to plot the graphs found in The concluding saga to: "How to plot" with success! and EPS and LaTeX (III) with the required tickmarks and text minus the hassles? :)
welcome
You're very welcome. You caught the fact that when using the plotsetup command (to specify the "ps" driver) the extra space after the minus sign may not be necessary, yes?
My first try would be to use Maple's Standard interface. Robert Israel's reply seemed nice (as usual).
I didn't see where you might have written why you prefer to use Classic over Standard. I use Standard with Worksheets instead of Documents, and 1D Maple input instead of 2D Math input (as the global defaults for all new sessions, configurable under the Options menus) when I want to use a GUI.
acer
EPS and LaTeX (VI)
Hi Acer.
I used
as suggested by you.
Unfortunately, the removal of the space in `-3 Pi/2` and `-2 Pi` (using Maple 12 Classic Worksheet) still results in a plus/minus sign when viewed in Ghostview 4.9. Using Adobe Illustrator CS3, it becomes a small empty little box instead of a negative sign.
interesting
Interesting.
With the menu-driven Postscript exporter in Classic, `-p/2` produces plusminus Pi/2 when using the SYMBOL font, but works OK and produces -Pi/2 with the programmatic exporter. But `-3p/2` produces plusminus in both.
A curious bug. I'm glad that adding a space after the minus sign was some sort of workaround.
acer
Will try to get some answers
kris2099, I'm not that knowledgeable about how plot exports work but I'll see if one of my colleagues can shed some light on this matter. (I maintain many of the library plotting commands but a large part of the plotting system is maintained by my colleagues in the GUI Group). You might not get an answer right away though. Not all of us read MaplePrimes on the weekend. :-)
Paulina
EPS and LaTeX (VII)
Hi Pauline.
Thanks for the reply.
To Acer, Georgios, Alec, Jakubi, Doug, Werner and Robert : A big THANK YOU for all the great help.
Pauline, I have summarised the problem as per below, instead of asking your colleagues to go through the threads:
I have used "Classic Worksheet Maple 12" to compile the code below:
> restart;
> with(plots):
> p1:=plot(sin(x),x=-2*Pi..2*Pi,tickmarks=[0,0],color=black):
> p2 := textplot([[Pi,-0.05,`p`], [Pi/2,-0.05,`p/2`],[-Pi/2,-0.05,`-p/2`], [-Pi,-0.05,`-p`],[0.2,-0.05,`0`],[-3*Pi/2,-0.05,`-3p/2`],[-2*Pi,-0.05,`-2p`],[3*Pi/2,-0.05,`3p/2`],[2*Pi,-0.05,`2p`]], align=below, font=[SYMBOL,10]):
> p3 := textplot([[-0.1,1.0,`1`], [-0.1,-1.0,`-1`],[-0.1,0.5,`y`],[2*Pi+1.5,-0.05,`x`]], align=left):
> p4:= pointplot([[-Pi,0], [-Pi/2,0], [Pi/2,0],[Pi,0],[0,1.0],[0,-1.0],[-3*Pi/2,0],[-2*Pi,0],[3*Pi/2,0],[2*Pi,0]], symbol=CROSS):
> display({p1,p2,p3,p4});
Once the plot is displayed on the screen, I right-clicked on the plot, choose "Export As" -> "Encapsulated Postscript (EPS)" and then type in a name to save it.
Using Ghostview 4.9 to open this saved (eps) file, the resultant was that the graph is rotated anticlockwise by 90 degrees. The negative 3Pi/2 and negative 2Pi that are on the x axis becomes "plus or minus 3Pi/2" and "plus or minus 2Pi".
I have also tried to open this saved (eps) file using Adobe Illustrator CS3. The graph is still rotated anticlockwise by 90 degrees. The negative 3Pi/2 and negative 2Pi that are on the x axis becomes "box 3Pi/2" and "box 2Pi". The box means that an empty small square box is given instead of a negative sign.
One possible solution as suggested by Acer is to put a space in between the negative sign and 3p/2 in the textplot line p2 which would "cure" it. And to cure the rotation by 90 degrees problem, Acer suggested to insert an additional code:
> plotsetup(ps,plotoutput=`sine.eps`,plotoptions=`portrait,noborder`);
which will write the output to a file without showing the actual graph on the Maple worksheet.
Another completely new problem is for the code found below. Is there any other simpler way of doing this in the Classic Worksheet Maple 12? The code below is long and tedious.
> restart;
> with(plots):
> p1:=plot(2*cos(1/2*x-Pi/6),x=Pi/3..13*Pi/3,tickmarks=[0,0],color=black,thickness=2):
> p2:=plot(2*cos(1/2*x),x=0..4*Pi,tickmarks=[0,0],color=black,linestyle=dashdot):
> p3:=textplot([[Pi-0.1,-0.05,`p`],[Pi/3+0.08,-0.05,`p/3`],[0.18,-0.05,`0`],[13*Pi/3-0.15,-0.05,`13p/3`],[4*Pi-0.1,-0.05,`4p`],[4*Pi/3+0.15,-0.05,`4p/3`],[7*Pi/3-0.1,-0.05,`7p/3`],[10*Pi/3+0.35,-0.05,`10p/3`],[2*Pi,-0.05,`2p`],[3*Pi,-0.05,`3p`]],align=below, font=[SYMBOL,10]):
> p4:=textplot([[-0.1,2.0,`2`],[-0.1,-2.0,`-2`],[-0.1,1.0,`y`],[13*Pi/3+1.5,-0.05,`x`]],align=left):
> p5:=pointplot([[Pi/3,0],[4*Pi/3,0],[7*Pi/3,0],[10*Pi/3,0],[13*Pi/3,0],[2*Pi,0],[3*Pi,0],[4*Pi,0],[0,2],[0,-2]],symbol=CROSS):
> p6:=textplot([[4*Pi/3+0.6,1,`y=2cos(x/2-`],[Pi-0.5,-1,`y=2cos(x/2)`]]):
> p7:=textplot([4*Pi/3+1.4,1,"p"],font=[SYMBOL,12]):
> p8:=textplot([4*Pi/3+1.6,1,` /6)`]):
> display({p1,p2,p3,p4,p5,p6,p7,p8});
Have a great weekend! :)
Chris
Response to EPS and LaTeX
Hi everyone
Paulina asked me to respond to points raised in this thread. Since many points have been rasied, this may take a little time. Please bear with me.
Firstly I should point out that the Classic interface, while still supported by Maplesoft, is not being improved to the same degree as the Standard interface. The reason for that is that if we made every improvement to both interfaces it would take us twice as long, and our customers would get only half the number of improvements they would otherwise. Specifically in Maple 11 Standard there was a major upgrade to 2D plotting, including many new features, especially better control of tickmarks and the ability to write math directly into plots. If you are still using Classic and haven't tried plotting in Standard Maple recently I strongly recommend it.
Secondly most of the complexity (and poor quality) of the above example is because the user is trying to draw his own tickmarks by placing crosses and text at the appropriate places. Despite what was said above, this is not the usual way of using Maple. It is almost always unnecessary, and almost always produces worse results than doing the same thing in Maple's own tickmark control in the Standard interface. Here is an example which does exactly what is wanted. I'm also using the typesetting feature to lay out the functions better.
a1 := plot(2*cos((1/2)*x-(1/6)*Pi), x = (1/3)*Pi .. 13*Pi*(1/3), color = black, thickness = 2);
a2 := plot(2*cos((1/2)*x), x = 0 .. 4*Pi, color = black, linestyle = dashdot);
a6 := textplot([[4*Pi*(1/3)+.6, 1, typeset(y=2*cos((1/2)*x-(1/6)*Pi))], [Pi-.5, -1, typeset(y=2*cos((1/2)*x))]]);
display(a1, a2, a6, tickmarks = [spacing((1/3)*Pi), 3]);
If you really need the irregular spacing of tickmarks then that can be done with custom tickmark placement:
display(a1,a2,a6,tickmarks=[[Pi/3 = Pi/3,Pi=Pi], 3]);
You might consider using legends rather than text labels to identify the curves. e.g.:
b1 := plot(2*cos((1/2)*x-(1/6)*Pi), x = (1/3)*Pi .. 13*Pi*(1/3), color = black, thickness = 2,legend=typeset(y=2*cos((1/2)*x-(1/6)*Pi)));
a2 := plot(2*cos((1/2)*x), x = 0 .. 4*Pi, color = black, linestyle = dashdot,typeset(2*cos((1/2)*x)));
display(b1,b2,tickmarks = [spacing((1/3)*Pi), 3]);
On to some other points.
In Classic the decision was taken to rotate the plot 90 degrees by default because it was thought that most people wanted their plots in landscape. In retrospect this may not have been the best decision, but changing it would affect the export of every Classic user in the world, and probably cause users more trouble that it saved. As pointed out above, you can use options to specify a portrait orientation, and you should be able to rotate postscript files on import to LaTeX.
It is strongly recommended that you do not use the SYMBOL font any more. Since Maple 11 plots can handle any symbols, alphabets and typeset math as though they were regular text, which makes the SYMBOL font unnecessary (this was part of the improvements to the Standard interface). You can enter sympols directly into the plot commands using Pi as I did above, or using the "Greek" palette.
Export of symbols to postscript is sometimes tricky as it can depend on the fonts you have set up. Standard Maple handles them pretty well. In some older versions somes specified a default setup in which your postscript browser might substitute a non-standard symbol for the one we expected. I would imagine this is what is causing the substitution of +/- for the unary minus symbol. I would urge you to try this in the Standard interface and see if it still happens.
If you really don't want to set options for the postscript output then the rotation can be undone with a simple edit of the postscript file. Search the file for a line that says "%%IncludeResource: font Helvetica". After it there should be a line "n.n n.n translate" and then "90 rotate" (n.n is some real-valued number). Either remove these lines or comment them out by placing two % symbols at the front. Your plot should now be in landscape formation.
I hope that was helpful. Can I re-emphasise that everything you want can be done in the Standard interface. The commands you are posting above can be copied exactly to Standard (saving the extra space); if you like you can save the Classic worksheet and open it in Standard. Also you can specify the tickmarks using a single command instead of six, which should save some time, to say nothing of not having to position the text labels exactly.
David Clayworth Maplesoft GUI Developer