# How to label axis in plot?

**URL:** https://racket.discourse.group/t/how-to-label-axis-in-plot/3565
**Category:** Questions & Answers
**Created:** [February 14, 2025, 10:19am UTC](https://racket.discourse.group/t/how-to-label-axis-in-plot/3565 "2025-02-14T10:19:08Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![damien\_mattei](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/damien_mattei/32/2706_2.png) [@damien\_mattei](https://racket.discourse.group/u/damien_mattei)
#### Post date: [February 14, 2025, 10:19am UTC](https://racket.discourse.group/t/how-to-label-axis-in-plot/3565/1 "2025-02-14T10:19:08Z")

</div>

hello,

how to label x and y axis in plot?

i want to add some units and physic name of plotted value but i only get `x axis` and `y axis` :

 ![image](https://global.discourse-cdn.com/free1/uploads/racket/original/2X/3/359b3778d375ac4791a59e7e3e3f50201f28bb98.png)

i want instead to have for example `t` and `rhoe` or `B`.

Also having a way to 'line' the points would be better.

I'm in the context to plotting to a file, but this should not be important:

```scheme
(plot-file (points Lplot-x
	    		       #:sym 'dot
	    		       #:color "blue"
			       #:label title-x)
	    	       
		       image-x-filename
		       image-type)

```

regards,

Damien

---

<div class="post-metadata">

### Author: ![damien\_mattei](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/damien_mattei/32/2706_2.png) [@damien\_mattei](https://racket.discourse.group/u/damien_mattei)
#### Post date: [February 14, 2025, 10:56am UTC](https://racket.discourse.group/t/how-to-label-axis-in-plot/3565/2 "2025-02-14T10:56:05Z")

</div>

i find a solution for the first part of question:

```scheme
(parameterize
	     ([plot-y-label (string-append physic " (" valor-unit ")")]
	      [plot-x-label "time t (minutes)"])
	     (plot-file (points Lplot-x
				#:sym 'dot
				#:color "blue"
				#:label title-x)
	    	       
			image-x-filename
			image-type))

```

reading this page:

[https://docs.racket-lang.org/plot/ticks\_and\_transforms.html](https://docs.racket-lang.org/plot/ticks_and_transforms.html)

it uses:

[https://docs.racket-lang.org/reference/parameters.html#(form.\_((lib.\_racket%2Fprivate%2Fmore-scheme..rkt).\_parameterize))](https://docs.racket-lang.org/reference/parameters.html#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._parameterize%29%29)

[https://docs.racket-lang.org/guide/parameterize.html](https://docs.racket-lang.org/guide/parameterize.html)

but not really an easy solution and i really do not understand why it works like this and is so complex.

 ![image](https://global.discourse-cdn.com/free1/uploads/racket/original/2X/3/39944b9cf42122d0482f11bec40bfe9b219e3293.png)

---

<div class="post-metadata">

### Author: ![damien\_mattei](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/damien_mattei/32/2706_2.png) [@damien\_mattei](https://racket.discourse.group/u/damien_mattei)
#### Post date: [February 14, 2025, 11:32am UTC](https://racket.discourse.group/t/how-to-label-axis-in-plot/3565/3 "2025-02-14T11:32:00Z")

</div>

![image](https://global.discourse-cdn.com/free1/uploads/racket/original/2X/4/4e03b16e01b7671d0ee2eaaa95f295cb878a0365.png)

lines with this code:

```scheme
#lang reader SRFI-105

        {x-label <- "time t (minutes)"}
	    {y-label <- (string-append physic " (" valor-unit ")")}
	    

	    (parameterize
	     ([plot-x-label x-label]
	      [plot-x-far-label x-label]
	      [plot-y-label y-label]
	      [plot-y-far-label y-label])
	     (plot-file (list
			 (points Lplot-x
				 #:line-width 2
				 ;;#:sym 'dot
				 #:color "blue"
				 #:label title-x)
			 (lines Lplot-x #:color 2 #:width 2))
			image-x-filename
			image-type))

```
