Is it possible to generate plots (especially Plot3D[]) once for several functions and then combine them into pairs (or other sets) and present them in shared coordinate systems, but to differ them in the way of presentation (eg in colour)?

Suppose we have several ($n$) functions that are computationally demanding. You need to make collations each of 2 (or more) diagrams in shared coordinate systems. There may be a lot of such combinations (if they are pairs, then $n^2/2$, if triplets - more). The idea is not to perform the same function calculations repeatedly, but only once and keep the result for later use. Then, you could make collations using the plots already developed. It is important to be able to adjust the parameters of the presentation, such as colour, so that the plots included in the shared coordinate system are properly distinguished.

(In my case, I put together solutions of a rather complicated equation (or system) to examine how one of the solutions turns into the other as the coefficients change, thus canceling the apparent singularities.) However, it is easy to imagine a lot of other applications that save a lot of work and computing time.

It could look like: Examples of pairs of functions (solutions of a some equation) connecting smoothly.

The problem is not limited to combining already created plots but to various modifications of them when used again!

How it cannot be done? (If I'm not mistaken):

  1. It is known that the generated plots can be combined using the Show[] function.

  2. The Show[] function can modify side elements of the plot such as axes, labels, etc.

  3. However, it cannot modify the graph itself. Not only its shape (understandable) but even its colour.

  4. Modifications to the plot as a graphic object (such postprocess) are not a satisfactory solution, because:

a. It's like chiseling (there should be some smarter solution),

b. it is labor intensive (especially for 3D plots!),

c. it may give esthetically unsatisfactory results.

Probably a sensible solution would be:

  1. To export data created by the function drawing a plots to a variable, so that you can use them later.

  2. The problem, however, lies in the fact that the functions drawing the plots do not sample the space of arguments evenly, and adapt the sampling density as needed, and the structure of such data would be more complex than the array of values $z$ for equidistant points on the axes $x$ and $y$.

  3. Saving data in the form of triples {x, y, z} would solve the case, because they do not have to be equally spaced in the space of arguments. Such data is acceptable for the function ListPlot3D[] (or other function of the ListPlot type (3D or mutatis mutandis 2D)).

  4. Maybe it would be possible to perform calculations such as the plots drawing function do, but without using it, i.e. calculate the values of the mathematical functions of interest for a certain initial grid of points in the space of arguments and then somehow trigger the process of adjusting the sampling density to the function value variation. (I have an idea how to approach it, but I do not know if this is the most appropriate way.)

So, does any of your colleagues have an idea how to solve this problem? Regardless whether by "getting to the inside” of the plot drawing function or saving the results of its work or even replacing it at the stage of preparing points for ploting.

  • $\begingroup$ Can't focus now but those topics seem to be at least related: 5312, 17250 $\endgroup$ – Kuba Jul 27 '18 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.