Skip to main content
Added case where no coords are given
Source Link
Jens
  • 98.4k
  • 7
  • 217
  • 541

Since the bug doesn't seem to occur when the Inset contains a Row instead of a Column or Grid, one could define the following function:

Attributes[fixInsets] = {HoldFirst}; fixInsets[plot_] := ReleaseHold[ Hold[plot] /. HoldPattern[Rule[Epilog, Inset[x_, y___]]] :> Rule[Epilog, Inset[Row[{x}], y]] ] 

Then use it on the faulty plots like this:

Graphics3D[Sphere[], Axes -> True, Epilog -> Inset[Column[{"a"}], {.05, .05}]] // fixInsets 

This produces the correct output. All I did was to replace the content of the Inset (when it occurs in the Epilog) by Row[{...}] wrapping that content. fixInsets doesn't modify the plot if there is no need to, and it can be appended to any 3D graphics without having to change the actual plotting commands.

Another possible work-around is to wrap the plot in Legended. For example,

Legended[ Plot3D[1, {x, -1, 1}, {y, -1, 1}, Epilog -> Inset[Column[{"a"}]]], ""] 

This empty legend is enough to make the tick marks appear again.

Since the bug doesn't seem to occur when the Inset contains a Row instead of a Column or Grid, one could define the following function:

Attributes[fixInsets] = {HoldFirst}; fixInsets[plot_] := ReleaseHold[ Hold[plot] /. HoldPattern[Rule[Epilog, Inset[x_, y___]]] :> Rule[Epilog, Inset[Row[{x}], y]] ] 

Then use it on the faulty plots like this:

Graphics3D[Sphere[], Axes -> True, Epilog -> Inset[Column[{"a"}], {.05, .05}]] // fixInsets 

This produces the correct output. All I did was to replace the content of the Inset (when it occurs in the Epilog) by Row[{...}] wrapping that content. fixInsets doesn't modify the plot if there is no need to, and it can be appended to any 3D graphics without having to change the actual plotting commands.

Since the bug doesn't seem to occur when the Inset contains a Row instead of a Column or Grid, one could define the following function:

Attributes[fixInsets] = {HoldFirst}; fixInsets[plot_] := ReleaseHold[ Hold[plot] /. HoldPattern[Rule[Epilog, Inset[x_, y___]]] :> Rule[Epilog, Inset[Row[{x}], y]] ] 

Then use it on the faulty plots like this:

Graphics3D[Sphere[], Axes -> True, Epilog -> Inset[Column[{"a"}], {.05, .05}]] // fixInsets 

This produces the correct output. All I did was to replace the content of the Inset (when it occurs in the Epilog) by Row[{...}] wrapping that content. fixInsets doesn't modify the plot if there is no need to, and it can be appended to any 3D graphics without having to change the actual plotting commands.

Another possible work-around is to wrap the plot in Legended. For example,

Legended[ Plot3D[1, {x, -1, 1}, {y, -1, 1}, Epilog -> Inset[Column[{"a"}]]], ""] 

This empty legend is enough to make the tick marks appear again.

Added case where no coords are given
Source Link
Jens
  • 98.4k
  • 7
  • 217
  • 541

Since the bug doesn't seem to occur when the Inset contains a Row instead of a Column or Grid, one could define the following function:

Attributes[fixInsets] = {HoldFirst}; fixInsets[plot_] := ReleaseHold[ Hold[plot] /. HoldPattern[Rule[Epilog, Inset[x_, y__]]]y___]]] :> Rule[Epilog, Inset[Row[{x}], y]] ] 

Then use it on the faulty plots like this:

Graphics3D[Sphere[], Axes -> True, Epilog -> Inset[Column[{"a"}], {.05, .05}]] // fixInsets 

This produces the correct output. All I did was to replace the content of the Inset (when it occurs in the Epilog) by Row[{...}] wrapping that content. fixInsets doesn't modify the plot if there is no need to, and it can be appended to any 3D graphics without having to change the actual plotting commands.

Since the bug doesn't seem to occur when the Inset contains a Row instead of a Column or Grid, one could define the following function:

Attributes[fixInsets] = {HoldFirst}; fixInsets[plot_] := ReleaseHold[ Hold[plot] /. HoldPattern[Rule[Epilog, Inset[x_, y__]]] :> Rule[Epilog, Inset[Row[{x}], y]] ] 

Then use it on the faulty plots like this:

Graphics3D[Sphere[], Axes -> True, Epilog -> Inset[Column[{"a"}], {.05, .05}]] // fixInsets 

This produces the correct output. All I did was to replace the content of the Inset (when it occurs in the Epilog) by Row[{...}] wrapping that content. fixInsets doesn't modify the plot if there is no need to, and it can be appended to any 3D graphics without having to change the actual plotting commands.

Since the bug doesn't seem to occur when the Inset contains a Row instead of a Column or Grid, one could define the following function:

Attributes[fixInsets] = {HoldFirst}; fixInsets[plot_] := ReleaseHold[ Hold[plot] /. HoldPattern[Rule[Epilog, Inset[x_, y___]]] :> Rule[Epilog, Inset[Row[{x}], y]] ] 

Then use it on the faulty plots like this:

Graphics3D[Sphere[], Axes -> True, Epilog -> Inset[Column[{"a"}], {.05, .05}]] // fixInsets 

This produces the correct output. All I did was to replace the content of the Inset (when it occurs in the Epilog) by Row[{...}] wrapping that content. fixInsets doesn't modify the plot if there is no need to, and it can be appended to any 3D graphics without having to change the actual plotting commands.

Source Link
Jens
  • 98.4k
  • 7
  • 217
  • 541

Since the bug doesn't seem to occur when the Inset contains a Row instead of a Column or Grid, one could define the following function:

Attributes[fixInsets] = {HoldFirst}; fixInsets[plot_] := ReleaseHold[ Hold[plot] /. HoldPattern[Rule[Epilog, Inset[x_, y__]]] :> Rule[Epilog, Inset[Row[{x}], y]] ] 

Then use it on the faulty plots like this:

Graphics3D[Sphere[], Axes -> True, Epilog -> Inset[Column[{"a"}], {.05, .05}]] // fixInsets 

This produces the correct output. All I did was to replace the content of the Inset (when it occurs in the Epilog) by Row[{...}] wrapping that content. fixInsets doesn't modify the plot if there is no need to, and it can be appended to any 3D graphics without having to change the actual plotting commands.