5

This question was asked before for version 12 but unfortunately the provided patch doesn't work anymore for version 12.1. Using Terminal` (ASCII plots) in Wolfram 12

I was trying to use the Terminal` package to do some ASCII plotting directly in the Terminal. Here is a small example what happens:

In[1]:= <<Terminal` 
[ -- Terminal graphics initialized -- ]

In[2]:= Plot[Sin[x], {x, 0, 20}, PlotRange -> All]   
[# StringJoin[MapThread[System`ConvertersDump`RasterDataPacket[#"#", #"#", #"#", #"+", ColorFunction -> #"+"] & ]]

Out[2]= -Graphics-

That is the same behavior as in version 12. When applying the patch from the above link (copyright by Lukas Lang), I get the following error messages:

<< Terminal`

ExportString["", "TTY"];

DownValues@System`Convert`BitmapDump`ExportTTY = 
  DownValues@
    System`Convert`BitmapDump`ExportTTY /. {TextStyle -> LabelStyle, 
    HoldPattern[
      pre : (data_ = _[___, gr_, "ColorReductionPalette" -> crp_, _, 
          opts_])] :> (pre;
      data = 
       Replace[ImageData@
         ColorQuantize[Image[data, "Byte"], crp, 
          FilterRules[{opts}, Options@ColorQuantize]], 
        Thread[First /@ crp -> Range@Length@crp], {2}])};

Error messages:

Executing the Plot function again gives the same result as without the patch.

The Terminal` package is undocumented, so I cannot ask the support team. Does anyone have an idea how to fix this?

Philipp
  • 726
  • 4
  • 9

0 Answers0