Dr. Paulina Chin

1416 Reputation

12 Badges

18 years, 332 days
Senior Architect
Waterloo, Ontario, Canada

MaplePrimes Activity

These are answers submitted by pchin

After Maple 9, the plots package was updated so that its internal form is a Maple module. This is the way most Maple packages are implemented nowadays, but the plots package was still in the obsolete table-based form in Maple 9.

For most users, this change should have no effect. However, it meant that the short form of package export names would no longer work inside procedures. It was always the case, though, that one should always use the long form of export names inside a procedure anyhow. Alternatively, you can use the "use" facility inside a procedure, as in "use plots in ... end use", if you want to continuing using the short-form names.

The 'with' facility was never meant to work inside a procedure, as it was designed for interactive use. You can get more details about this on the 'with' help page. If you change your display(...) command to plots[display](...), your code should work correctly again.

Paulina Chin

Alec, I also prefer to use 1-d math when writing procedures and modules. However, I find 2-d math input (especially from the Expression palette) useful for entering mathematical expressions. Also, I always use 2-d math input for creating typeset titles and axis labels in plots.

As acer points out, "2-d math input" and "Standard Worksheet" are not equivalent. You need to use the Standard Worksheet to get 2-d math, but it's just as easy to use 1-d math there. Unless you have a really good reason to stick with Classic (e.g. because you have a computer with limited memory), I'd recommend using Standard, especially if you ever want to generate plots. Of course I'm biased, as I'm one of the plot developers, but there are so many new plot features available in Standard, like typesetting on plots, true plot arrays and polar axes.


I recommend you always use a space for implicit multiplication in 2-d math input. If you follow this practice, you're much less likely to run into situations like the one described in the original post. I don't think it's necessary to avoid 2-d math if you're a new user. Like many other apsects of Maple, it just takes some time to get accustomed to it. Personally, I use both 1-d and 2-d math interchangeably, depending on my needs. I find different tasks easier to accomplish in one mode or the other.

Paulina Chin

Hi Thomas,

I'm afraid I can't reproduce the error you're seeing. I copied the exact commands into Maple 12 on Windows XP and I'm getting the expected plots. Which version of Maple are you using, and on what platform?


You can plot points with symbol=solidbox instead of generating the squares. This solution does not require manipulation of the plot data structure.

mycolors := ["Orange", "Red", "Yellow", "White"];
data := RandomTools:-Generate(listlist(integer(range=1..4), 100)):
c := ListTools:-Flatten(map(y->mycolors[y], data)):
pts := [seq(seq([i,j], i=1..100), j=1..100)]:
plots[pointplot](pts, color=c, symbol=solidbox, symbolsize=10);

A second option is to use plots[listdensityplot] with the colorstyle=HUE option. This will let you colour each square with 4 different colours, but it gives you less control over the exact colours. You can manipulate the colours somewhat by adjusting your data values, but you are limited to those available with HUE. (See the 'color' entry on the plot/options help page for more information.) Note that you'll have to specify that your range is 1..5 instead of 1..4. Otherwise, the colours assigned to value 1 and value 4 are the same.

plots[listdensityplot](data, colorstyle=HUE, range=1..5);

Paulina Chin

I just want to mention that plots[animate3d] has been replaced by plots[animate], which works with both 2-d and 3-d plots. The animate3d command will still work, but there are several new options available with the animate command that you may find useful. The examples provided by Georgios are written thus, using plots[animate]:

> with(plots):
> animate(plot3d, [sin(x+t)*cos(y-t), x=0..2*Pi, y=0..2*Pi], t=0..Pi);
> animate(plot3d, [sin(x+t)*cos(y-t), x=0..2*Pi, y=0..2*Pi], t=0..Pi, frames=50);

If you don't want the title showing the animation parameter values, add the paraminfo=false option.

Paulina Chin

Whoa, hold on a moment. :-)  Please don't misinterpret my comments. Alex writes: "It is hubris for Maple to think that quality typesetting can be attained by mouse clicking one's way through pallates." I'm not necessarily making that claim. I'm just pointing out that the palette is just one of the many tools in Maple and it can be very useful in particular circumstances.

"And from this we are supposed to infer the power and insightfullness of the Maple typesetting package?" No. Indeed, from my point-of-view, I'd rather you not use Typesetting[Typeset] at all. People here claim there is a lack of tools for programmatically doing typesetting. I don't dispute that at all. I agree with you. I offer Typesetting[Typeset] as a less-than-ideal workaround for now until better tools are available and suggest that the GUI tools may be less clumsy and more useful than some might initially believe.

We're still developing Maple's typesetting and likely there will be better tools for programmatic access in future releases. My recommendation is that, if you want particular features, speak up and ask for them, and not necessarily in these threads that are usually devoted to answering specific technical questions and are read mostly by developers. Occasionally, other Maplesoft staff will set up polls or discussion questions elsewhere on MaplePrimes asking for input and those are good places to express your views. I should add, though, that we have many users who do not participate in MaplePrimes and we do get lots of typesetting requests from them too, often ones that are related to GUI and not programmatic access. So we have to balance and prioritize the requests. (BTW, I had been a long-time LaTeX user myself, so I know where you're coming from.)

I'm speaking as a developer here, not as a marketing or sales person. From my point-of-view, the typesetting project is a work in progress. It's incomplete but it also has huge potential. If we waited until it did everything that eveyone wanted, it wouldn't be released for another decade. However, I'm glad it's out there and in use now, despite the limitations, because what is there now is extremely useful to some people. We're still actively working on how to make it even more powerful, so please speak up for the features you want.


Alejandro is correct in saying that we don't currently have a programmatic way to convert LaTeX to our internal form. However, there is a way to programmatically typeset all Maple expressions, and that is the Typesetting[Typeset] command. It is mentioned on the Typesetting help page, but there is a warning to use it with care. It is generally safe to use the Typesetting[Typeset] command and pass the results to routines like plot() that know what to do with them, but it is not recommended that you alter the output (i.e. the internal form of the typeset expressions).

I agree that more and better tools for programmatically typesetting expressions would be helpful to users. These may appear in future releases, but we have to balance a number of user requests related to typesetting. If there is great demand for these tools, then certainly they will get a higher priority.

I also believe strongly in using all the tools available and doing what is easiest. Sometimes, you really need to do the typesetting through 1-d commands, as in the situation presented by the original poster in this thread. On the other hand, I frequently see users trying to jump through hoops to get a desired result through the command-line when it's not really necessary to do it that way. I'm not suggesting that palettes, context-menus and command-completion can replace 1-d usage but they do have their uses. I use both 1-d and 2-d together in the same worksheet all the time. I find writing procedures in 2-d painful, but I find creating typeset plot titles in 1-d equally painful.

Our marketing people claim that using 2-d math should be "natural". It probably is more natural than 1-d math to new users, but I suppose it can be unnatural to people used to command-line Maple. (My formative years were spent programming in Fortran and C, so my initial feelings about 2-d math were probably not so different from yours.) However, I think it's very worthwhile to take the time to become familiar with it, if only to figure out when it's most useful and when it's not useful at all.


As Alejandro pointed out, the problem is that `#mi( "V" )` (with extra spaces) gives a diferent result from `#mi("V")`. While this is unexpected, I hesitate to call it a bug, mainly because the use of the internal form is not a documented feature and we are not expecting a structure like `#mi( "V" )` to be generated by a user.

I wouldn't necessarily discourage you from using the internal form, as it does allow you to do some things which you wouldn't be able to do otherwise. However, it is definitely a "use at your own risk" feature because we are unable to document and maintain it at the moment. One reason for this is that the internal form may change from release to release.

Rather than build the atomic identifier on your own, I would suggest the following as a safer way to generate it. First, enter one of the entries from the "Accents" palette to get the symbol you want. Then, replace the placeholder with an arbitrary name that's not used elsewhere. Create an atomic identifier from the expression and lprint to get the internal form. (I'm pretty sure you must have already gone through these steps to get to the current point.) Now, use the command StringTools[Substitute] to replace the placeholder name with the name entered by the person using your routine and convert the result to a name. Then use this result in the plot command.

Paulina Chin

There are some other ways to draw a cube that you may find simpler. For example:
> plots[display](plottools[cuboid]([0,0,0],[1,1,1]), axes=boxed, scaling=constrained);
If you just want the lines, you could try adding style=wireframe and color=black. You can make these changes using the context menu as well.

You can also check out the help page for plots[polyhedraplot] (use with option polytope=hexahedron)).

Paulina Chin

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. :-)


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.


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.


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.


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.


3 4 5 6 7 8 9 Page 5 of 10