# Questions about Plot / plot3d

**URL:** <https://racket.discourse.group/t/questions-about-plot-plot3d/1134>\
**Category:** Questions & Answers\
**Tags:** plot\
**Created:** [July 8, 2022, 3:53pm UTC](https://racket.discourse.group/t/questions-about-plot-plot3d/1134 "2022-07-08T15:53:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JustinZed](https://avatars.discourse-cdn.com/v4/letter/j/8e7dd6/32.png) [@JustinZed](https://racket.discourse.group/u/JustinZed)\
**Post date:** [July 8, 2022, 3:53pm UTC](https://racket.discourse.group/t/questions-about-plot-plot3d/1134/1 "2022-07-08T15:53:29Z")

</div>

I have several questions about the Plot library, especially plot3d.

1. When clicking and dragging a 3D plot, the altitude won't go below zero, so I can't view the plot from below. Setting the altitude to a negative number using plot3d-altitude works fine, however. Is there a reason for not allowing a negative altitude when dragging a plot?

2. Is it possible to have different colored polygons using a single call to polygons3d? It looks like I need to have multiple calls if I want different colors.

3. The line-width parameter doesn't work with polygons3d. To get a different line width, I have to use the #:line-width optional argument. For example, this works:

> (plot3d (polygons3d #:line-width 5 (list (list (list 0 0 0) (list 0 1/2 0) (list 1 0 0)))))

But this doesn't:

> (parameterize ([line-width 5]) (plot3d (polygons3d (list (list (list 0 0 0) (list 0 1/2 0) (list 1 0 0))))))

Is this intentional?

---

<div class="post-metadata">

**Author:** ![alexh](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/alexh/32/315_2.png) [@alexh](https://racket.discourse.group/u/alexh)\
**Post date:** [July 8, 2022, 10:02pm UTC](https://racket.discourse.group/t/questions-about-plot-plot3d/1134/2 "2022-07-08T22:02:07Z")

</div>

> [@JustinZed](#):
>
> When clicking and dragging a 3D plot, the altitude won't go below zero, so I can't view the plot from below. Setting the altitude to a negative number using plot3d-altitude works fine, however. Is there a reason for not allowing a negative altitude when dragging a plot?

The altitude is clamped to 0-90 degrees when rotating the plot with the mouse. This might be a mistake and the clamping should be -90 .. 90:

> <https://github.com/racket/plot/blob/c7a9e02f06f17b783acca5eb444ae9da25eeb4bd/plot-gui-lib/plot/private/gui/snip3d.rkt#L58>

> [@JustinZed](#):
>
> Is it possible to have different colored polygons using a single call to polygons3d? It looks like I need to have multiple calls if I want different colors.

No. You can use multiple renderers, one for each color. This is the same for all other plot renderers.

> [@JustinZed](#):
>
> The line-width parameter doesn't work with polygons3d. To get a different line width, I have to use the #:line-width optional argument. For example, this works:

The parameter which controls line width for `ploygons3d` is `surface-line-width`. There is also a `surface-line-color` and `surface-line-style` for 3d surfaces (instead of `line-color` and `line-style`). This is documented in the plot manual as the default value for `#:line-width`, `#:line-color` and `#:line-style`. This works as you would expect:

```scheme
(parameterize ([surface-line-width 5])
   (plot3d (polygons3d (list (list (list 0 0 0) (list 0 1/2 0) (list 1 0 0))))))

```

Hope this helps,  
Alex.

---

<div class="post-metadata">

**Author:** ![JustinZed](https://avatars.discourse-cdn.com/v4/letter/j/8e7dd6/32.png) [@JustinZed](https://racket.discourse.group/u/JustinZed)\
**Post date:** [July 9, 2022, 12:30am UTC](https://racket.discourse.group/t/questions-about-plot-plot3d/1134/3 "2022-07-09T00:30:49Z")

</div>

Thank you. That was very helpful. For what I am doing, allowing an altitude from -90 to 90 would be very useful.
