Styling 3D plots as it was in Mathematica 5
我喜欢安静和不受干扰的色域以及Mathematica 5中3D图的照明。
是否可以像在Mathematica 5中一样对Mathematica 7中的3D图进行样式设置?
1 2 3 | 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图形的视觉外观:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 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}] |
先生我想W已经很好地回答了您的问题。这是一个可以玩耍的玩具,包括其他调色板。它以W先生使用的值开头。
1 2 3 4 5 6 7 8 9 10 11 12 | 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"}] |
这个距离是否足够接近,或者距离您的要求还有很长的路要走?
1 2 3 4 5 6 | 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] |