I often wish to see the internal representation of Mathematica's graphical objects not in the FullForm
but in much more readable InputForm
having the ability to select parts of the code by double-clicking on it and easily copy this code to a new input Cell
. But the default InputForm
does not allow this since InputForm
is displayed by default as a String
, not as Mathematica's code. Is there a way to have InputForm
displayed as Mathematica's code?
I also often wish to see a shortened version of such InputForm
where all long lists of coordinates are displayed as the first coordinate followed by number of skipped coordinate values wrapped with Skeleton
, all empty Lists
removed and all numbers are also shortened for displaying no more than 6 digits. It would be even better to use 6 digits only for coordinates but for color directives such as Hue
display only 2 significant digits. For example,
Plot[{Sin[x], .5 Sin[2 x]}, {x, 0, 2 \[Pi]},
Filling -> {1 -> {2}}] // ShortInputForm
should give:
Graphics[GraphicsComplex[{{1.28228`*^-7, 1.28228*^-7}, <<1133>>},
{{{EdgeForm[], Directive[{Opacity[0.2], Hue[0.67, 0.6, 0.6]}],
GraphicsGroup[{Polygon[{{1133, <<578>>}}]}]},
{EdgeForm[], Directive[{Opacity[0.2], Hue[0.67, 0.6, 0.6]}],
GraphicsGroup[{Polygon[{{432, <<556>>}}]}]}}, {{Hue[0.67, 0.6,
0.6], Line[{1, <<431>>}]}, {Hue[0.91, 0.6, 0.6],
Line[{432, <<701>>}]}}}], {AspectRatio -> GoldenRatio^(-1),
Axes -> True, AxesOrigin -> {0, 0},
Method -> {"AxesInFront" -> True},
PlotRange -> {{0, 2*Pi}, {-1., 1}},
PlotRangeClipping -> True,
PlotRangePadding -> {Scaled[0.02], Scaled[0.02]}}]
(note that -0.9999998592131705
is converted to -1.
, 1.2822827157509358*^-7
is converted to 1.28228*^-7
and Hue[0.9060679774997897, 0.6, 0.6]
is converted to Hue[0.91, 0.6, 0.6]
).
In this way, I wish to have the output of InputForm
as Mathematica's code and also have a ShortInputForm
function which will give the shortened version of this code. Can anybody help me?
As to the first part of the question, I have found one way to achieve what I want:
Plot[{Sin[x], .5 Sin[2 x]}, {x, 0, 2 \[Pi]}, Filling -> {1 -> {2}}] //
InputForm // StandardForm