4
$\begingroup$

I have one more problem, still with exporting full quality 3d figure into Word. I want perfect quality in a Word document of a 3d figure prepared with legend (traditional form of text). Extremes of the function in figure is nice to be yellow and rest of the function feature red.

Example,

  Plot3D[Sin[4 x]*Cos[4 y], {x, -2, 2}, {y, -2, 2}]

I need this figure to import in Word with full prepared legend and combination of color (red-yellow).

$\endgroup$
10
  • $\begingroup$ I can't figure out what exactly the question is. What is the link supposed to tell us? $\endgroup$
    – Jens
    Commented Jan 15, 2013 at 19:19
  • $\begingroup$ This appears to cover exactly the same ground as your previous question at mathematica.stackexchange.com/questions/17706/… $\endgroup$
    – whuber
    Commented Jan 15, 2013 at 19:54
  • $\begingroup$ @Jens I think he wants the graphics like this question. Or he wants to employ you as private consultant... :) $\endgroup$
    – cormullion
    Commented Jan 15, 2013 at 19:56
  • $\begingroup$ @Jens question is how to prepare figure for word in best quality. link is just about coloring (red-yellow combination of the 3d function), I need in extreme region yellow and other part of the graphic red. $\endgroup$
    – Pipe
    Commented Jan 15, 2013 at 20:01
  • $\begingroup$ Sorry, I don't have word so I don't feel qualified to answer this, because I cannot define "best quality". $\endgroup$
    – Jens
    Commented Jan 15, 2013 at 20:33

1 Answer 1

4
$\begingroup$

Here is what I can say: to make a 3d plot with the color scheme you want and then give it a label, you can in fact rely on another answer I posted to the question "ShowLegend values". The steps are as follows:

  1. From the linked answer, copy the second code block (below the heading Color bar legend) defining the functions trimPoint, all the way down to display, and execute them in your notebook. These definitions are used to arrange information about a plot as a legend.

  2. Now we'll make your example plot with some nice colors.

Here I've chosen the SunsetColors scheme from the Palettes > Color Schemes menu. You could make your own scheme using Blend.

plot = Plot3D[Sin[4 x]*Cos[4 y], {x, -2, 2}, {y, -2, 2}, 
  ColorFunction -> "SolarColors"]

plot3D

  1. Next, make the labeled plot.

The information we need for the label is the range of z values to which the colors correspond, and the color function. The other numbers are relative dimensions of the plot versus label:

With[{
  range = {-1, 1},
  plotWidth = .8,
  labelHeight = .5,
  labelWidth = .15
  },
 display[{
   plot // at[{0, 0}, plotWidth], 
   colorLegend[ColorData["SolarColors"], range, Contours -> 8] // 
    at[{0.85, .1}, Scaled[{labelWidth, labelHeight}]]}, 
  AspectRatio -> .75]
 ]

label

The commands display and at are explained in the answer linked above. The rest is to export this plot as a suitable image (I guess). That would be

Export["image.png",%]

An alternative to using my display function for the legend is to hand-craft your own legend using the general approaches in the answers to "Spreading colors in ListDensityPlot". The reason I wrote my solution was so the legending process can be automated more. In my earlier answer, I had also defined a function reportColorRange that can automatically keep track of the range of colors and function values, but it only works for 2D plots because the ColorFunction option in 3D takes additional arguments that I didn't make any provisions for.

$\endgroup$
5
  • $\begingroup$ Thank you very much. This is what I wanted to obtain. Very kind regards $\endgroup$
    – Pipe
    Commented Jan 15, 2013 at 22:46
  • $\begingroup$ code started with "with" doesn't work? $\endgroup$
    – Pipe
    Commented Feb 6, 2013 at 23:16
  • $\begingroup$ It works for me. $\endgroup$
    – Jens
    Commented Feb 7, 2013 at 0:39
  • $\begingroup$ I copied your code and didn't work. Can you posted all code which is working on your computer exactly as it is $\endgroup$
    – Pipe
    Commented Feb 7, 2013 at 16:29
  • $\begingroup$ It's all there. What is the error? Did you make sure to initialize all the required functions from the linked answer? I can't just copy all that again. $\endgroup$
    – Jens
    Commented Feb 7, 2013 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.