racket / plot

Other
40 stars 37 forks source link

Cannot show anything on Win10 #122

Closed Sophiamer2002 closed 1 year ago

Sophiamer2002 commented 1 year ago

I ran the following three commands in racket REPL.

(require plot)
(plot-new-window? #t)
(plot (function sin (- pi) pi #:label "y = sin(x)"))

However, the window just doesn't show anthing and is like the following figure Picture1 I have no idea what the possible issue is. I guess it might be something wrong with my computer configuration.

My racket environment: Minimal Racket 8.9 Windows 64-bit x64 Only langserver package is downloaded through raco pkg install racket-langserver for magic racket usage in VS Code.

Any help is greatly appreciated.

alex-hhh commented 1 year ago

Hi @Sophiamer2002 , you mentioned that you installed Minimal Racket 8.9 and only installed the langserver package. However, Minimal Racket does not contain the plot package, you either need to install the plot package explicitly, or install a full Racket distribution.

It is still not clear to me why the plot window appeared, as it should just reported that the plot package is not installed. Are you sure you didn't install the plot package somehow?

Sophiamer2002 commented 1 year ago

The result for raco pkg show -a:

Installation-wide:
 Package[*=auto]         Checksum           Source
 base*                   f318e23ec32859...  catalog base
 com-win32-x86_64*       073362d77940ae...  catalog...-x86_64
 db-win32-x86_64*        e8ee5c4957ff8d...  catalog...-x86_64
 racket-lib              9347cf1b6f8326...  catalog...ket-lib
 racket-win32-x86_64-3*  ead76dcfea3ac7...  catalog...86_64-3
User-specific for installation "8.9":
 Package[*=auto]               Checksum         Source
 [Some other packages]
 plot                          797fda82ca47...  catalog plot
 plot-compat*                  bc4f2449723f...  catalog...ompat
 plot-doc*                     697fafb35b26...  catalog...t-doc
 plot-gui-lib*                 8e3146289ea0...  catalog...i-lib
 plot-lib*                     b21397181340...  catalog...t-lib
 [Some other packages]

It should have been installed since when I run only (without setting plot-new-window which is by default false)

(require plot)
(plot (function sin (- pi) pi #:label "y = sin(x)"))

and it gives (object:2d-plot-snip% ... ...), which I suppose that plot library is already installed.

alex-hhh commented 1 year ago

I am running Racket 8.9 myself on Windows 11 and the plot library works without problems, so I am not sure what is happening in your case. I have a few suggestions:

Sophiamer2002 commented 1 year ago

I have tried the first suggestion and the window appears with nothing showed. When I force close the window, the racket REPL just exit automatically without any error printed out.

The second suggestion worked and no matter in DrRacket or in terminal, the plot is showed correctly.

I guess that there might be some dependencies missed in minimal version when installing plot by simply raco pkg install plot. Anyway, I found that using minimal racket is not that 'minimal' and I will use full version instead. Therefore, I will close this issue and thank @alex-hhh sincerely.

By the way, I'm relatively new to programming languages. I found that learning a programming language in deep is quite hard by only reading books though I can command the basic usages. I would be appreciated if you could provide some advice into learning the whole picture of racket, by understanding more details in the language design.

alex-hhh commented 1 year ago

I am glad that you managed to get it working.

With regards to this:

By the way, I'm relatively new to programming languages. I found that learning a programming language in deep is quite hard by only reading books though I can command the basic usages. I would be appreciated if you could provide some advice into learning the whole picture of racket, by understanding more details in the language design.

... I would recommend joining the racket community. It is most active on Discourse (https://racket.discourse.group/ ) and Discord ( here is an invite link https://discord.gg/6Zq8sH5 ) You can ask questions there and get help and advice with learning Racket

Sophiamer2002 commented 1 year ago

I really appreciate it. @alex-hhh