像在 Mathematica 5 中一样设置 3D 绘图的样式

发布于 2024-11-03 18:43:47 字数 1615 浏览 1 评论 0原文

我喜欢 Mathematica 5 中安静且不受干扰的色域和 3D 绘图照明。

是否可以在 Mathematica 7 中设置与 Mathematica< 中完全相同的 3D 绘图样式/em> 5?

Plot3D[Sin[x y], {x, 0, Pi}, {y, 0, Pi}, ImageSize -> 360]
<< Version5`Graphics`
Plot3D[Sin[x y], {x, 0, Pi}, {y, 0, Pi}, ImageSize -> 360]

输出的屏幕截图


此代码允许轻松比较版本 5 和版本 7 图形的视觉外观:

v5style = {{"Ambient", RGBColor[{0.356, 0.294, 0.4}]}, {"Directional",
     RGBColor[{0.56, 0., 0.}], 
    ImageScaled[{2, 0, 2}]}, {"Directional", RGBColor[{0., 0.56, 0.}],
     ImageScaled[{2, 2, 2}]}, {"Directional", 
    RGBColor[{0., 0., 0.56}], ImageScaled[{0, 2, 2}]}};

PostScriptGraphics /: MakeBoxes[PostScriptGraphics[str_String], _] := 
 Cell[GraphicsData["PostScript", str], CellAutoOverwrite -> True, 
  CellBaseline -> Center]
v5vsv7[\[Theta]_] := {Developer`LegacyGraphics[];
   v5Graphics = 
    Graphics`Legacy`Plot3D[Sin[x y], {x, 0, Pi}, {y, 0, Pi}, 
     ImageSize -> 360, 
     ViewPoint -> RotationTransform[\[Theta], {0, 0, 1}][{3, 0, 3}]];
   v5PostScript = ExportString[v5Graphics, "APS"];
   Developer`SymbolicGraphics[];
   PostScriptGraphics[v5PostScript],
   Graphics3D[First@Graphics3D@v5Graphics, 
     FilterRules[Last@Graphics3D@v5Graphics, Options[Graphics3D]], 
     ViewPoint -> RotationTransform[\[Theta], {0, 0, 1}][{3, 0, 3}], 
     PlotRangePadding -> None, 
     ImageSize -> 360] /. (Lighting -> _) -> (Lighting -> v5style)};

Grid@Table[v5vsv7[\[Theta]], {\[Theta], 0, 2 Pi, Pi}]

I like quiet and undisturbed color gamut and lighting of 3D plots in Mathematica 5.

Is it possible to style 3D plots in Mathematica 7 exactly as it was in Mathematica 5?

Plot3D[Sin[x y], {x, 0, Pi}, {y, 0, Pi}, ImageSize -> 360]
<< Version5`Graphics`
Plot3D[Sin[x y], {x, 0, Pi}, {y, 0, Pi}, ImageSize -> 360]

Screenshot of the Output


This code allows to compare easily visual appearance of version 5 and version 7 graphics:

v5style = {{"Ambient", RGBColor[{0.356, 0.294, 0.4}]}, {"Directional",
     RGBColor[{0.56, 0., 0.}], 
    ImageScaled[{2, 0, 2}]}, {"Directional", RGBColor[{0., 0.56, 0.}],
     ImageScaled[{2, 2, 2}]}, {"Directional", 
    RGBColor[{0., 0., 0.56}], ImageScaled[{0, 2, 2}]}};

PostScriptGraphics /: MakeBoxes[PostScriptGraphics[str_String], _] := 
 Cell[GraphicsData["PostScript", str], CellAutoOverwrite -> True, 
  CellBaseline -> Center]
v5vsv7[\[Theta]_] := {Developer`LegacyGraphics[];
   v5Graphics = 
    Graphics`Legacy`Plot3D[Sin[x y], {x, 0, Pi}, {y, 0, Pi}, 
     ImageSize -> 360, 
     ViewPoint -> RotationTransform[\[Theta], {0, 0, 1}][{3, 0, 3}]];
   v5PostScript = ExportString[v5Graphics, "APS"];
   Developer`SymbolicGraphics[];
   PostScriptGraphics[v5PostScript],
   Graphics3D[First@Graphics3D@v5Graphics, 
     FilterRules[Last@Graphics3D@v5Graphics, Options[Graphics3D]], 
     ViewPoint -> RotationTransform[\[Theta], {0, 0, 1}][{3, 0, 3}], 
     PlotRangePadding -> None, 
     ImageSize -> 360] /. (Lighting -> _) -> (Lighting -> v5style)};

Grid@Table[v5vsv7[\[Theta]], {\[Theta], 0, 2 Pi, Pi}]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

表情可笑 2024-11-10 18:43:47

我想W先生已经很好地回答了你的问题。这是一个可以尝试一些可能性的玩具,包括其他调色板。它从 W 先生使用的值开始。

Manipulate[
  Plot3D[Sin[x y], {x, 0, Pi}, {y, 0, Pi}, PlotLabel -> cf, 
  ImageSize -> 360, ColorFunction -> cf, Mesh -> mesh,
  Lighting -> {{"Ambient", cs},
    {"Directional", RGBColor[{s, 0., 0.}], 
     ImageScaled[{2, 0, 2}]}, {"Directional", RGBColor[{0., s, 0.}], 
     ImageScaled[{2, 2, 2}]}, {"Directional", RGBColor[{0., 0., s}], 
     ImageScaled[{0, 2, 2}]}}],
{{cf, None, "color function"}, Prepend[ColorData["Gradients"], None]},
{{cs, RGBColor[{0.356, 0.294, 0.4}]}, ColorSlider},
{{s, .5, "brightness"}, 0, 1, Appearance -> "Labeled"},
{{mesh, 15}, 0, 30, 1, Appearance -> "Labeled"}]

manipulatte

Mr. W already answered your question well, I think. Here's a toy to play around with some possibilities, including other palettes. It starts with the values Mr. W used.

Manipulate[
  Plot3D[Sin[x y], {x, 0, Pi}, {y, 0, Pi}, PlotLabel -> cf, 
  ImageSize -> 360, ColorFunction -> cf, Mesh -> mesh,
  Lighting -> {{"Ambient", cs},
    {"Directional", RGBColor[{s, 0., 0.}], 
     ImageScaled[{2, 0, 2}]}, {"Directional", RGBColor[{0., s, 0.}], 
     ImageScaled[{2, 2, 2}]}, {"Directional", RGBColor[{0., 0., s}], 
     ImageScaled[{0, 2, 2}]}}],
{{cf, None, "color function"}, Prepend[ColorData["Gradients"], None]},
{{cs, RGBColor[{0.356, 0.294, 0.4}]}, ColorSlider},
{{s, .5, "brightness"}, 0, 1, Appearance -> "Labeled"},
{{mesh, 15}, 0, 30, 1, Appearance -> "Labeled"}]

manipulatte

一抹苦笑 2024-11-10 18:43:47

这是否足够接近您的要求,还是距离您的要求还很远?

new = {{"Ambient", RGBColor[{0.356, 0.294, 0.4}]}, {"Directional", 
  RGBColor[{0.56, 0., 0.}], ImageScaled[{2, 0, 2}]}, {"Directional", 
  RGBColor[{0., 0.56, 0.}], ImageScaled[{2, 2, 2}]}, {"Directional", 
  RGBColor[{0., 0., 0.56}], ImageScaled[{0, 2, 2}]}};

Plot3D[Sin[x y], {x, 0, Pi}, {y, 0, Pi}, Lighting -> new, Mesh -> 20]

在此处输入图像描述

Is this approaching close enough, or still a long way off of your requirements?

new = {{"Ambient", RGBColor[{0.356, 0.294, 0.4}]}, {"Directional", 
  RGBColor[{0.56, 0., 0.}], ImageScaled[{2, 0, 2}]}, {"Directional", 
  RGBColor[{0., 0.56, 0.}], ImageScaled[{2, 2, 2}]}, {"Directional", 
  RGBColor[{0., 0., 0.56}], ImageScaled[{0, 2, 2}]}};

Plot3D[Sin[x y], {x, 0, Pi}, {y, 0, Pi}, Lighting -> new, Mesh -> 20]

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文