Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

I do not feel that the existing answers adequately address this question.

First, it is important to realize the difference between aspects of a Graphics or Graphics3D object that are controlled by options and those that are not. I described this a bit herehere. Although you are using Graphics3D directly I mention this because objects created with a plot function will have some of their options rendered as primitives while others remain in the output and can be changed through options.

A graphics object is of the form head[primitives, options ..]. Options that appear earlier supersede those that appear later. When you have an object with explicit options it will be necessary to either replace an option value you wish to change, or simply place it earlier in the list.

gr =
 Graphics3D[
  Sphere @@@ {{}, {{1, 2, 3}}},
  Boxed -> True,
  Lighting -> {{"Directional", Orange, {{1, 0, 0}, {0, 0, 0}}}}
 ]

Mathematica graphics

It is not sufficient to Append the option Boxed -> False because there exists an earlier Boxed -> True that will override it. It is possible to use Insert:

Insert[gr, Boxed -> False, 2]

Mathematica graphics

It is also not correct to extract the first part of the object and insert it into a new Graphic3D as this will strip all options, unless of course that is your intention:

Graphics3D[First @ gr, Boxed -> False]

Mathematica graphics

You can delete a specific option as yulinlinyu shows, but it is unnecessary, and it requires that you use a more complicated method than shown if it is to be robust, because:

  • Options can be nested in lists, e.g. head[primitives, {op1, {op2, op3}}], therefore you must look deeper than level one.

  • Some options may be used inside the primitives, so you should exclude the first argument of the graphics object.

  • Options may be sub-options of another such as directives for an Epilog graphic; you would need to somehow avoid deleting these.

All in all, it's simply not worth the effort to make the delete-and-replace robust, and again, it's unnecessary. The solution is to use Show which inserts any new options at the beginning of the list automatically:

Show[gr, Boxed -> False]

Mathematica graphics

% // InputForm
Graphics3D[{Sphere[{0, 0, 0}], Sphere[{1, 2, 3}]}, {Boxed -> False, Boxed -> True, 
 Lighting -> {{"Directional", RGBColor[1, 0.5, 0], {{1, 0, 0}, {0, 0, 0}}}}}]

Use Show unless you have good reason not to.

I do not feel that the existing answers adequately address this question.

First, it is important to realize the difference between aspects of a Graphics or Graphics3D object that are controlled by options and those that are not. I described this a bit here. Although you are using Graphics3D directly I mention this because objects created with a plot function will have some of their options rendered as primitives while others remain in the output and can be changed through options.

A graphics object is of the form head[primitives, options ..]. Options that appear earlier supersede those that appear later. When you have an object with explicit options it will be necessary to either replace an option value you wish to change, or simply place it earlier in the list.

gr =
 Graphics3D[
  Sphere @@@ {{}, {{1, 2, 3}}},
  Boxed -> True,
  Lighting -> {{"Directional", Orange, {{1, 0, 0}, {0, 0, 0}}}}
 ]

Mathematica graphics

It is not sufficient to Append the option Boxed -> False because there exists an earlier Boxed -> True that will override it. It is possible to use Insert:

Insert[gr, Boxed -> False, 2]

Mathematica graphics

It is also not correct to extract the first part of the object and insert it into a new Graphic3D as this will strip all options, unless of course that is your intention:

Graphics3D[First @ gr, Boxed -> False]

Mathematica graphics

You can delete a specific option as yulinlinyu shows, but it is unnecessary, and it requires that you use a more complicated method than shown if it is to be robust, because:

  • Options can be nested in lists, e.g. head[primitives, {op1, {op2, op3}}], therefore you must look deeper than level one.

  • Some options may be used inside the primitives, so you should exclude the first argument of the graphics object.

  • Options may be sub-options of another such as directives for an Epilog graphic; you would need to somehow avoid deleting these.

All in all, it's simply not worth the effort to make the delete-and-replace robust, and again, it's unnecessary. The solution is to use Show which inserts any new options at the beginning of the list automatically:

Show[gr, Boxed -> False]

Mathematica graphics

% // InputForm
Graphics3D[{Sphere[{0, 0, 0}], Sphere[{1, 2, 3}]}, {Boxed -> False, Boxed -> True, 
 Lighting -> {{"Directional", RGBColor[1, 0.5, 0], {{1, 0, 0}, {0, 0, 0}}}}}]

Use Show unless you have good reason not to.

I do not feel that the existing answers adequately address this question.

First, it is important to realize the difference between aspects of a Graphics or Graphics3D object that are controlled by options and those that are not. I described this a bit here. Although you are using Graphics3D directly I mention this because objects created with a plot function will have some of their options rendered as primitives while others remain in the output and can be changed through options.

A graphics object is of the form head[primitives, options ..]. Options that appear earlier supersede those that appear later. When you have an object with explicit options it will be necessary to either replace an option value you wish to change, or simply place it earlier in the list.

gr =
 Graphics3D[
  Sphere @@@ {{}, {{1, 2, 3}}},
  Boxed -> True,
  Lighting -> {{"Directional", Orange, {{1, 0, 0}, {0, 0, 0}}}}
 ]

Mathematica graphics

It is not sufficient to Append the option Boxed -> False because there exists an earlier Boxed -> True that will override it. It is possible to use Insert:

Insert[gr, Boxed -> False, 2]

Mathematica graphics

It is also not correct to extract the first part of the object and insert it into a new Graphic3D as this will strip all options, unless of course that is your intention:

Graphics3D[First @ gr, Boxed -> False]

Mathematica graphics

You can delete a specific option as yulinlinyu shows, but it is unnecessary, and it requires that you use a more complicated method than shown if it is to be robust, because:

  • Options can be nested in lists, e.g. head[primitives, {op1, {op2, op3}}], therefore you must look deeper than level one.

  • Some options may be used inside the primitives, so you should exclude the first argument of the graphics object.

  • Options may be sub-options of another such as directives for an Epilog graphic; you would need to somehow avoid deleting these.

All in all, it's simply not worth the effort to make the delete-and-replace robust, and again, it's unnecessary. The solution is to use Show which inserts any new options at the beginning of the list automatically:

Show[gr, Boxed -> False]

Mathematica graphics

% // InputForm
Graphics3D[{Sphere[{0, 0, 0}], Sphere[{1, 2, 3}]}, {Boxed -> False, Boxed -> True, 
 Lighting -> {{"Directional", RGBColor[1, 0.5, 0], {{1, 0, 0}, {0, 0, 0}}}}}]

Use Show unless you have good reason not to.

replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Source Link

I do not feel that the existing answers adequately address this question.

First, it is important to realize the difference between aspects of a Graphics or Graphics3D object that are controlled by options and those that are not. I described this a bit here. Although you are using Graphics3D directly I mention this because objects created with a plot function will have some of their options rendered as primitives while others remain in the output and can be changed through options.

A graphics object is of the form head[primitives, options ..]. Options that appear earlier supersede those that appear later. When you have an object with explicit options it will be necessary to either replace an option value you wish to change, or simply place it earlier in the list.

gr =
 Graphics3D[
  Sphere @@@ {{}, {{1, 2, 3}}},
  Boxed -> True,
  Lighting -> {{"Directional", Orange, {{1, 0, 0}, {0, 0, 0}}}}
 ]

Mathematica graphics

It is not sufficient to Append the option Boxed -> False because there exists an earlier Boxed -> True that will override it. It is possible to use Insert:

Insert[gr, Boxed -> False, 2]

Mathematica graphics

It is also not correct to extract the first part of the object and insert it into a new Graphic3D as this will strip all options, unless of course that is your intention:

Graphics3D[First @ gr, Boxed -> False]

Mathematica graphics

You can delete a specific option as yulinlinyu shows, but it is unnecessary, and it requires that you use a more complicated method than shown if it is to be robust, because:

  • Options can be nested in lists, e.g. head[primitives, {op1, {op2, op3}}], therefore you must look deeper than level one.

  • Some optionsSome options may be used inside the primitives, so you should exclude the first argument of the graphics object.

  • Options may be sub-options of another such as directives for an Epilog graphic; you would need to somehow avoid deleting these.

All in all, it's simply not worth the effort to make the delete-and-replace robust, and again, it's unnecessary. The solution is to use Show which inserts any new options at the beginning of the list automatically:

Show[gr, Boxed -> False]

Mathematica graphics

% // InputForm
Graphics3D[{Sphere[{0, 0, 0}], Sphere[{1, 2, 3}]}, {Boxed -> False, Boxed -> True, 
 Lighting -> {{"Directional", RGBColor[1, 0.5, 0], {{1, 0, 0}, {0, 0, 0}}}}}]

Use Show unless you have good reason not to.

I do not feel that the existing answers adequately address this question.

First, it is important to realize the difference between aspects of a Graphics or Graphics3D object that are controlled by options and those that are not. I described this a bit here. Although you are using Graphics3D directly I mention this because objects created with a plot function will have some of their options rendered as primitives while others remain in the output and can be changed through options.

A graphics object is of the form head[primitives, options ..]. Options that appear earlier supersede those that appear later. When you have an object with explicit options it will be necessary to either replace an option value you wish to change, or simply place it earlier in the list.

gr =
 Graphics3D[
  Sphere @@@ {{}, {{1, 2, 3}}},
  Boxed -> True,
  Lighting -> {{"Directional", Orange, {{1, 0, 0}, {0, 0, 0}}}}
 ]

Mathematica graphics

It is not sufficient to Append the option Boxed -> False because there exists an earlier Boxed -> True that will override it. It is possible to use Insert:

Insert[gr, Boxed -> False, 2]

Mathematica graphics

It is also not correct to extract the first part of the object and insert it into a new Graphic3D as this will strip all options, unless of course that is your intention:

Graphics3D[First @ gr, Boxed -> False]

Mathematica graphics

You can delete a specific option as yulinlinyu shows, but it is unnecessary, and it requires that you use a more complicated method than shown if it is to be robust, because:

  • Options can be nested in lists, e.g. head[primitives, {op1, {op2, op3}}], therefore you must look deeper than level one.

  • Some options may be used inside the primitives, so you should exclude the first argument of the graphics object.

  • Options may be sub-options of another such as directives for an Epilog graphic; you would need to somehow avoid deleting these.

All in all, it's simply not worth the effort to make the delete-and-replace robust, and again, it's unnecessary. The solution is to use Show which inserts any new options at the beginning of the list automatically:

Show[gr, Boxed -> False]

Mathematica graphics

% // InputForm
Graphics3D[{Sphere[{0, 0, 0}], Sphere[{1, 2, 3}]}, {Boxed -> False, Boxed -> True, 
 Lighting -> {{"Directional", RGBColor[1, 0.5, 0], {{1, 0, 0}, {0, 0, 0}}}}}]

Use Show unless you have good reason not to.

I do not feel that the existing answers adequately address this question.

First, it is important to realize the difference between aspects of a Graphics or Graphics3D object that are controlled by options and those that are not. I described this a bit here. Although you are using Graphics3D directly I mention this because objects created with a plot function will have some of their options rendered as primitives while others remain in the output and can be changed through options.

A graphics object is of the form head[primitives, options ..]. Options that appear earlier supersede those that appear later. When you have an object with explicit options it will be necessary to either replace an option value you wish to change, or simply place it earlier in the list.

gr =
 Graphics3D[
  Sphere @@@ {{}, {{1, 2, 3}}},
  Boxed -> True,
  Lighting -> {{"Directional", Orange, {{1, 0, 0}, {0, 0, 0}}}}
 ]

Mathematica graphics

It is not sufficient to Append the option Boxed -> False because there exists an earlier Boxed -> True that will override it. It is possible to use Insert:

Insert[gr, Boxed -> False, 2]

Mathematica graphics

It is also not correct to extract the first part of the object and insert it into a new Graphic3D as this will strip all options, unless of course that is your intention:

Graphics3D[First @ gr, Boxed -> False]

Mathematica graphics

You can delete a specific option as yulinlinyu shows, but it is unnecessary, and it requires that you use a more complicated method than shown if it is to be robust, because:

  • Options can be nested in lists, e.g. head[primitives, {op1, {op2, op3}}], therefore you must look deeper than level one.

  • Some options may be used inside the primitives, so you should exclude the first argument of the graphics object.

  • Options may be sub-options of another such as directives for an Epilog graphic; you would need to somehow avoid deleting these.

All in all, it's simply not worth the effort to make the delete-and-replace robust, and again, it's unnecessary. The solution is to use Show which inserts any new options at the beginning of the list automatically:

Show[gr, Boxed -> False]

Mathematica graphics

% // InputForm
Graphics3D[{Sphere[{0, 0, 0}], Sphere[{1, 2, 3}]}, {Boxed -> False, Boxed -> True, 
 Lighting -> {{"Directional", RGBColor[1, 0.5, 0], {{1, 0, 0}, {0, 0, 0}}}}}]

Use Show unless you have good reason not to.

added 16 characters in body
Source Link
Mr.Wizard
  • 273.1k
  • 34
  • 595
  • 1.4k

I do not feel that the existing answers adequately address this question.

First, it is important to realize the difference between aspects of a Graphics or Graphics3D object that are controlled by options and those that are not. I described this a bit here. Although you are using Graphics3D directly I mention this because objects created with a plot function will have some of their options rendered as primitives while others remain in the output and can be changed through options.

A graphics object is of the form head[primitives, options ..]. Options that appear earlier supersede those that appear later. When you have an object with explicit options it will be necessary to either replace an option value you wish to change, or simply place it earlier in the list.

gr =
 Graphics3D[
  Sphere @@@ {{}, {{1, 2, 3}}},
  Boxed -> True,
  Lighting -> {{"Directional", Orange, {{1, 0, 0}, {0, 0, 0}}}}
 ]

Mathematica graphics

It is not sufficient to Append the option Boxed -> False because there exists an earlier Boxed -> True that will override it. It is possible to use Insert:

Insert[gr, Boxed -> False, 2]

Mathematica graphics

It is also not correct to extract the first part of the object and insert it into a new Graphic3D as this will strip all options, unless of course that is your intention:

Graphics3D[First @ gr, Boxed -> False]

Mathematica graphics

You can delete a specific option as yulinlinyu shows, but it is unnecessary, and it requires that you use a more complicated method than shown if it is to be robust, because:

  • Options can be nested in lists, e.g. head[primitives, {op1, {op2, op3}}], therefore you must look deeper than level one.

  • Some options may be used inside the primitives, so you should exclude the first argument of the graphics object.

  • Options may be sub-options of another such as directives for an Epilog graphic; you would need to somehow avoid deleting these.

All in all, it's simply not worth the effort to make the delete-and-replace robust, and again, it's unnecessary. The solution is to use Show which inserts any new options at the beginning of the list automatically:

Show[gr, Boxed -> False]

Mathematica graphics

% // InputForm
Graphics3D[{Sphere[{0, 0, 0}], Sphere[{1, 2, 3}]}, {Boxed -> False, Boxed -> True, 
 Lighting -> {{"Directional", RGBColor[1, 0.5, 0], {{1, 0, 0}, {0, 0, 0}}}}}]

Use Show unless you have good reason not to.

I do not feel that the existing answers adequately address this question.

First, it is important to realize the difference between aspects of a Graphics or Graphics3D object that are controlled by options and those that are not. I described this a bit here. Although you are using Graphics3D directly I mention this because objects created with a plot function will have some of their options rendered as primitives while others remain in the output and can be changed.

A graphics object is of the form head[primitives, options ..]. Options that appear earlier supersede those that appear later. When you have an object with explicit options it will be necessary to either replace an option value you wish to change, or simply place it earlier in the list.

gr =
 Graphics3D[
  Sphere @@@ {{}, {{1, 2, 3}}},
  Boxed -> True,
  Lighting -> {{"Directional", Orange, {{1, 0, 0}, {0, 0, 0}}}}
 ]

Mathematica graphics

It is not sufficient to Append the option Boxed -> False because there exists an earlier Boxed -> True that will override it. It is possible to use Insert:

Insert[gr, Boxed -> False, 2]

Mathematica graphics

It is also not correct to extract the first part of the object and insert it into a new Graphic3D as this will strip all options, unless of course that is your intention:

Graphics3D[First @ gr, Boxed -> False]

Mathematica graphics

You can delete a specific option as yulinlinyu shows, but it is unnecessary, and it requires that you use a more complicated method than shown if it is to be robust, because:

  • Options can be nested in lists, e.g. head[primitives, {op1, {op2, op3}}], therefore you must look deeper than level one.

  • Some options may be used inside the primitives, so you should exclude the first argument of the graphics object.

  • Options may be sub-options of another such as directives for an Epilog graphic; you would need to somehow avoid deleting these.

All in all, it's simply not worth the effort to make the delete-and-replace robust, and again, it's unnecessary. The solution is to use Show which inserts any new options at the beginning of the list automatically:

Show[gr, Boxed -> False]

Mathematica graphics

% // InputForm
Graphics3D[{Sphere[{0, 0, 0}], Sphere[{1, 2, 3}]}, {Boxed -> False, Boxed -> True, 
 Lighting -> {{"Directional", RGBColor[1, 0.5, 0], {{1, 0, 0}, {0, 0, 0}}}}}]

Use Show unless you have good reason not to.

I do not feel that the existing answers adequately address this question.

First, it is important to realize the difference between aspects of a Graphics or Graphics3D object that are controlled by options and those that are not. I described this a bit here. Although you are using Graphics3D directly I mention this because objects created with a plot function will have some of their options rendered as primitives while others remain in the output and can be changed through options.

A graphics object is of the form head[primitives, options ..]. Options that appear earlier supersede those that appear later. When you have an object with explicit options it will be necessary to either replace an option value you wish to change, or simply place it earlier in the list.

gr =
 Graphics3D[
  Sphere @@@ {{}, {{1, 2, 3}}},
  Boxed -> True,
  Lighting -> {{"Directional", Orange, {{1, 0, 0}, {0, 0, 0}}}}
 ]

Mathematica graphics

It is not sufficient to Append the option Boxed -> False because there exists an earlier Boxed -> True that will override it. It is possible to use Insert:

Insert[gr, Boxed -> False, 2]

Mathematica graphics

It is also not correct to extract the first part of the object and insert it into a new Graphic3D as this will strip all options, unless of course that is your intention:

Graphics3D[First @ gr, Boxed -> False]

Mathematica graphics

You can delete a specific option as yulinlinyu shows, but it is unnecessary, and it requires that you use a more complicated method than shown if it is to be robust, because:

  • Options can be nested in lists, e.g. head[primitives, {op1, {op2, op3}}], therefore you must look deeper than level one.

  • Some options may be used inside the primitives, so you should exclude the first argument of the graphics object.

  • Options may be sub-options of another such as directives for an Epilog graphic; you would need to somehow avoid deleting these.

All in all, it's simply not worth the effort to make the delete-and-replace robust, and again, it's unnecessary. The solution is to use Show which inserts any new options at the beginning of the list automatically:

Show[gr, Boxed -> False]

Mathematica graphics

% // InputForm
Graphics3D[{Sphere[{0, 0, 0}], Sphere[{1, 2, 3}]}, {Boxed -> False, Boxed -> True, 
 Lighting -> {{"Directional", RGBColor[1, 0.5, 0], {{1, 0, 0}, {0, 0, 0}}}}}]

Use Show unless you have good reason not to.

Source Link
Mr.Wizard
  • 273.1k
  • 34
  • 595
  • 1.4k
Loading