[racket-users] Re: Plot with text annotation inside the graph
You could try using a point-label or a function-label with a point size of 0, like this: (plot (list (function-interval sin (lambda (x) 0)) (function-label (lambda (x) (* (sin x) 0.2)) -1.8 "sin(x)" #:point-size 0)) #:x-min -2 #:x-max 2) Alex. On Saturday, October 15, 2016 at 10:29:07 AM UTC+8, Marc Kaufmann wrote: > Hi all, > > I am creating some graphs where I want to label various regions as region A, > B, C, and so on. Currently I am doing this by coloring the regions > differently and having the labels in legend: > > (plot-file > (list > (axes) > (function-interval (lambda (x) 0) MD 0 E_x #:label "F") > (function-interval > (lambda (x) (MD E_x)) > (lambda (x) 0) > e_x E_x > #:color 4 #:line1-color 4 #:line2-color 4 > #:label "G")) > "graph-proof-which-task-completed-2.pdf" > #:x-label "Instantaneous effort" > #:y-label "Marginal Disutility") > > This becomes problematic with multiple regions since it is hard to > distinguish the colors (or line styles). Is there a way to place a label "A" > in the region "A"? > > Thanks, > > Marc -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Re: Plot ticks with arbitrary strings - breaks DrRacket
On Saturday, October 15, 2016 at 9:19:20 AM UTC+8, Robby Findler wrote: > Is there a contract we could add somewhere? Well, the contract should be that the number of elements in the output list should be the same as the number of elements in the input list. I'm not sure how that would be expressed. However, the separation of the layout and format functions in the ticks structure seems odd to me. There could have been a single function that would generate tick objects with a value and a label, with the label being #f for minor ticks. Alex. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] Plot with text annotation inside the graph
Hi all, I am creating some graphs where I want to label various regions as region A, B, C, and so on. Currently I am doing this by coloring the regions differently and having the labels in legend: (plot-file (list (axes) (function-interval (lambda (x) 0) MD 0 E_x #:label "F") (function-interval (lambda (x) (MD E_x)) (lambda (x) 0) e_x E_x #:color 4 #:line1-color 4 #:line2-color 4 #:label "G")) "graph-proof-which-task-completed-2.pdf" #:x-label "Instantaneous effort" #:y-label "Marginal Disutility") This becomes problematic with multiple regions since it is hard to distinguish the colors (or line styles). Is there a way to place a label "A" in the region "A"? Thanks, Marc -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Re: Plot ticks with arbitrary strings - breaks DrRacket
Is there a contract we could add somewhere? Robby On Fri, Oct 14, 2016 at 6:31 PM, Alex Harsanyiwrote: > Your tick format function returns less labels than the number of items in the > pre-ticks. It should return one label for each pre-tick object (I just > printed out the lengths from the function to find this out.) > > To fix this, I replaced the format function with > > (for/list (((t idx) (in-indexed pre-ticks))) >(list-ref string-list idx)) > > Alex. > > On Friday, October 14, 2016 at 5:28:08 PM UTC+8, Laurent Orseau wrote: >> Hi all, >> >> >> I'm trying to write a `string-ticks` function to have arbitrary strings on >> the (y) axis. >> It mostly works, but as soon as I try to zoom by selecting a rectangle *that >> touches upper left corner of the plot frame* DrRacket's interaction window >> goes crazy and I have to restart it. >> >> >> Here's the (faulty) >> code:https://gist.github.com/Metaxal/e4ac303d442cbf9fb7f3edc21d8a9019 >> >> >> >> Anyone has an idea about what goes wrong here? >> >> >> Thanks, >> Laurent > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] Re: Plot ticks with arbitrary strings - breaks DrRacket
Your tick format function returns less labels than the number of items in the pre-ticks. It should return one label for each pre-tick object (I just printed out the lengths from the function to find this out.) To fix this, I replaced the format function with (for/list (((t idx) (in-indexed pre-ticks))) (list-ref string-list idx)) Alex. On Friday, October 14, 2016 at 5:28:08 PM UTC+8, Laurent Orseau wrote: > Hi all, > > > I'm trying to write a `string-ticks` function to have arbitrary strings on > the (y) axis. > It mostly works, but as soon as I try to zoom by selecting a rectangle *that > touches upper left corner of the plot frame* DrRacket's interaction window > goes crazy and I have to restart it. > > > Here's the (faulty) > code:https://gist.github.com/Metaxal/e4ac303d442cbf9fb7f3edc21d8a9019 > > > > Anyone has an idea about what goes wrong here? > > > Thanks, > Laurent -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] One more question about murphy/protobuf
With a helpful pointer from Dupéron Georges I found the protocol-buffer compiler and managed to create the messages I needed. I have things working now, but one (hopefully final) issue: I can serialize any message I want, send it through a port, and deserialize it on the other end, but so far I have not been able to send multiple messages through one port. Code is below. I'm running it like this: $ racket serialize.rkt | racket deserialize.rkt If I serialize two different types of messages then the error message I get is: stdin::95: deserialize: wire type does not match declared type: 'int* If I serialize two of the same message type then I get: deserialize: missing required fields: (seteqv 1) I think what's happening is that deserialize is reading the entire input buffer and assuming that all of it fits into one message. I'm wondering if anyone knows a way around that? ;;In 'serialize.rkt' (define c1 (announce-file:announce-chunks* #:chunk-hash "c1 hash" #:chunk-size-mb 2)) (define c2 (announce-file:announce-chunks* #:chunk-hash "c2 hash" #:chunk-size-mb 2)) (define f (announce-file* #:chunk (list c1 c2))) (serialize c1) (serialize c2) (serialize f) ;; comment this line out to make the eventual error message change ;; In 'deserialize.rkt' (announce-file:announce-chunks-chunk-hash (deserialize (announce-file:announce-chunks*))) (announce-file:announce-chunks-chunk-hash (deserialize (announce-file:announce-chunks*))) (announce-file-chunk (deserialize (announce-file*))) ;; comment this line out to make the eventual error message change ;; The message definitions: (define-message-type announce-file ((optional primitive:int32 version 1 1) (optional primitive:bool authenticated 3 #f) (optional primitive:string file-hash 4) (optional primitive:string file-path 5) (optional primitive:int64 file-modified 6 0) (optional primitive:int64 file-size-mb 7) (repeated struct:announce-file:announce-chunks chunk 8))) (define-message-type announce-file:announce-chunks ((required primitive:string chunk-hash 1) (optional primitive:int64 chunk-size-mb 2))) -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] Re: Planet package murphy/protobuf for Protocol Buffers
Maybe it's in /Users/dstorrs/Library/Racket/bin, or something like this? otherwise, this command shoul hopefully show the file's path if it is on your system: find / -name protoc-gen-racket -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Unable to track down what is requiring inclusion of tzinfo module - Resolved
On Friday, October 14, 2016 at 12:39:19 AM UTC-4, Sam Tobin-Hochstadt wrote: > That's likely the problem. Usually you need to use define-runtime-path or a > variant of that to cooperate with raco exe. > > Sam > >From what I'm reading in the documentation, that sounds right. "Library modules or other files that are referenced dynamically—through eval, load, or dynamic-require—are not automatically embedded into the created executable. Such modules can be explicitly included using the ++lib flag to raco exe. Alternately, use define-runtime-path to embed references to the run-time files in the executable; the files are then copied and packaged together with the executable when creating a distribution (as described in raco distribute: Sharing Stand-Alone Executables)" https://docs.racket-lang.org/raco/exe.html So would changing the call from dynamic-require to define-runtime-path fix the issue? I'll try this later today and see if this works. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] Plot ticks with arbitrary strings - breaks DrRacket
Hi all, I'm trying to write a `string-ticks` function to have arbitrary strings on the (y) axis. It mostly works, but as soon as I try to zoom by selecting a rectangle *that touches upper left corner of the plot frame* DrRacket's interaction window goes crazy and I have to restart it. Here's the (faulty) code: https://gist.github.com/Metaxal/e4ac303d442cbf9fb7f3edc21d8a9019 Anyone has an idea about what goes wrong here? Thanks, Laurent -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] Re: demande d'aide
Bonjour, Je débute en racket aussi, donc mes commentaires ne vous seront pas forcément utiles :-) Quelques considerations generales: - pour obtenir plus d'aide, je vous conseille de poser votre question en anglais, - ensuite, la question posée est assez vague: decomposez-la en questions plus précises. Sinon, d'apres ce que je comprends, l'approche générale est de modéliser les 2 systèmes (construire une representation de chaque systeme), et ensuite d'écrire des fonctions qui (a) font evoluer chaque systeme, et (b) convertissent de l'un à l'autre. Donc, en gros, 2 definitions de type de données, et +/- 4 fonctions. Le guide Racket contient des infos sur les structures de données qui peuvent vous aider à representer vos systemes (data types, par exemple les structures, mais aussi les simples listes et ses variantes). Après, si vous avez du temps je recommande la lecture du livre SICP (gratuit, en ligne), qui explique tout ça. Good luck :-) On Friday, October 14, 2016 at 8:12:27 AM UTC+2, Masto Fine wrote: > je commence en drracket et je cherche qqun qui pourrait m'aaider pour l > construction de petits programmes ! > j'en suis par exemple a la construction de petits mondes , et je ne > comprends pas comment programmer la differences entre une evolution spatiales > (avec l'axes des abscisses , ordonnees ) comme dans l'exemple de mon manuel ; > et une evolution numerique " en valeur absolue" comme dans l'exercice que je > dois realiser : construite une horloge numerique. > l variable mathematiue ne me pose pas de problemes , c'est juste au moment > de programmer l'evolution numerique dans l discretisation du monde , ou la > programmation monde -monde ou celle monde-image que je peche . > Pouvez vous m'aider. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] demande d'aide
You need to break down your problem in smaller pieces. Here is a suggestion of some helper functions to get you started. digit->image : number -> image Given a digit (0,1,...,9) as input, return an image of that digit. number->digits : number -> listof-numbers Given a natural number return a list of the digits Example: (number->digits 123) evaluates to (list 1 2 3) digits->image : list-of-numbers -> image Given a list of numbers return an image where the digit images are glued together horisontally. time->image : number number -> image Given two number an hour and a second return an image which shows the two numbers with an : between them. /Jens Axel 2016-10-14 8:12 GMT+02:00 Masto Fine: > je commence en drracket et je cherche qqun qui pourrait m'aaider pour l > construction de petits programmes ! > j'en suis par exemple a la construction de petits mondes , et je ne > comprends pas comment programmer la differences entre une evolution > spatiales (avec l'axes des abscisses , ordonnees ) comme dans l'exemple de > mon manuel ; et une evolution numerique " en valeur absolue" comme dans > l'exercice que je dois realiser : construite une horloge numerique. > l variable mathematiue ne me pose pas de problemes , c'est juste au > moment de programmer l'evolution numerique dans l discretisation du monde , > ou la programmation monde -monde ou celle monde-image que je peche . > Pouvez vous m'aider. > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- -- Jens Axel Søgaard -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] demande d'aide
je commence en drracket et je cherche qqun qui pourrait m'aaider pour l construction de petits programmes ! j'en suis par exemple a la construction de petits mondes , et je ne comprends pas comment programmer la differences entre une evolution spatiales (avec l'axes des abscisses , ordonnees ) comme dans l'exemple de mon manuel ; et une evolution numerique " en valeur absolue" comme dans l'exercice que je dois realiser : construite une horloge numerique. l variable mathematiue ne me pose pas de problemes , c'est juste au moment de programmer l'evolution numerique dans l discretisation du monde , ou la programmation monde -monde ou celle monde-image que je peche . Pouvez vous m'aider. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.