# Truncated image rendering with svgtree in swish

**URL:** <https://swi-prolog.discourse.group/t/truncated-image-rendering-with-svgtree-in-swish/813>\
**Category:** Help!\
**Created:** [June 13, 2019, 11:46pm UTC](https://swi-prolog.discourse.group/t/truncated-image-rendering-with-svgtree-in-swish/813 "2019-06-13T23:46:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![JCR](https://avatars.discourse-cdn.com/v4/letter/j/258eb7/32.png) [@JCR](https://swi-prolog.discourse.group/u/JCR)\
**Post date:** [June 13, 2019, 11:46pm UTC](https://swi-prolog.discourse.group/t/truncated-image-rendering-with-svgtree-in-swish/813/1 "2019-06-13T23:46:05Z")

</div>

Hi!

I am trying to render terms with svgtree in swish. My code is:

```prolog
:-use_rendering(svgtree).
x(x(margareth, mary, josh, pete, gina, richard)).

```

But the image looks like the one below (Image 1) with some letters truncated vertically (in Safari for mac). Zooming in the browser is set to default. Sometimes strings also overlap horizontally; see Image 2.

Also, when i save the file (or open it in another browser window all names are missing; i just get an X with a bunch of lines).

Any solution to this?

Cheers/JC

Image 1:  
 ![54](https://global.discourse-cdn.com/free1/uploads/swiprolog/original/1X/4f05f4588416922eaefe9e05e961cd18e9035c9e.png)

Image 2:

 ![01](https://global.discourse-cdn.com/free1/uploads/swiprolog/original/1X/ce99284b3ba65e685dfc1a61e3292f2eccb3e557.png)

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [June 14, 2019, 6:39am UTC](https://swi-prolog.discourse.group/t/truncated-image-rendering-with-svgtree-in-swish/813/2 "2019-06-14T06:39:13Z")

</div>

> [@JCR](#):
>
> :-use\_rendering(svgtree). x(x(margareth, mary, josh, pete, gina, richard)).

Works fairly well in FF. In general I’d use the graphviz renderer. That seems more portable and powerful.

---

<div class="post-metadata">

**Author:** ![JCR](https://avatars.discourse-cdn.com/v4/letter/j/258eb7/32.png) [@JCR](https://swi-prolog.discourse.group/u/JCR)\
**Post date:** [June 14, 2019, 7:18am UTC](https://swi-prolog.discourse.group/t/truncated-image-rendering-with-svgtree-in-swish/813/3 "2019-06-14T07:18:20Z")

</div>

OK, thanks. For me the granph is truncated in both firefox and safari. I saw the gvtree program on the Graphviz help page in swish but is there a module or program that can be included or imported in swish to automatically render terms with graphviz? I.e. a predicate renderTermAsGraphviz(Term)?

JCR

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [June 14, 2019, 7:57am UTC](https://swi-prolog.discourse.group/t/truncated-image-rendering-with-svgtree-in-swish/813/4 "2019-06-14T07:57:15Z")

</div>

Not sure what you want. How would that differ from the gvtree example?

---

<div class="post-metadata">

**Author:** ![JCR](https://avatars.discourse-cdn.com/v4/letter/j/258eb7/32.png) [@JCR](https://swi-prolog.discourse.group/u/JCR)\
**Post date:** [June 14, 2019, 8:12am UTC](https://swi-prolog.discourse.group/t/truncated-image-rendering-with-svgtree-in-swish/813/5 "2019-06-14T08:12:30Z")

</div>

Sorry for being unclear. With gvtree i can just write :- use\_rendering(svgtree). and any term is automatically rendered as a graphical tree, i.e. without additional code in the same notebook.

I was wondering if there is something with the same functionality for rendering as graphviz. I.e. without having the program that converts terms to the graphviz representation in the notebook, but instead importing the conversion program using :-include.

Thanks/JCR

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [June 14, 2019, 8:45am UTC](https://swi-prolog.discourse.group/t/truncated-image-rendering-with-svgtree-in-swish/813/6 "2019-06-14T08:45:39Z")

</div>

As is, no. You can make loading a lot easier by saving the gvtree code into a SWISH program, including the `:- use_renderer` line and use `:- include(myprog).`

Using it for rendering any term requires writing a different server side renderer.

---

<div class="post-metadata">

**Author:** ![JCR](https://avatars.discourse-cdn.com/v4/letter/j/258eb7/32.png) [@JCR](https://swi-prolog.discourse.group/u/JCR)\
**Post date:** [June 14, 2019, 8:48am UTC](https://swi-prolog.discourse.group/t/truncated-image-rendering-with-svgtree-in-swish/813/7 "2019-06-14T08:48:06Z")

</div>

Thanks! This solves my problem.
