# Clipping legend text for PNG but not always for SVG

**URL:** <https://community.plotly.com/t/clipping-legend-text-for-png-but-not-always-for-svg/14188>\
**Category:** plotly.js\
**Created:** [October 3, 2018, 5:54pm UTC](https://community.plotly.com/t/clipping-legend-text-for-png-but-not-always-for-svg/14188 "2018-10-03T17:54:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chiaki](https://avatars.discourse-cdn.com/v4/letter/c/e8c25b/32.png) [@Chiaki](https://community.plotly.com/u/Chiaki)\
**Post date:** [October 3, 2018, 5:54pm UTC](https://community.plotly.com/t/clipping-legend-text-for-png-but-not-always-for-svg/14188/1 "2018-10-03T17:54:58Z")

</div>

So I have a plot that works fine, but the very same code, data and layout produce this when format = png:  
 ![grafik](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/f/f41bcc0fde87a186c66a950c66a4804caff4334c.png)

and this, when format = svg:  
 ![grafik](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/3/3a293846c81a3978e42819f14cddd4cb1bf7a4f6.png)

How come the legend is getting clipped for PNG but not for SVG?

EDIT: Another example:  
 ![grafik](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/0/007ae28e08d3e1927e91be1de09c6a01bdcdbce5.png)  
 ![grafik](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/3/346d8ff1f6b794786c364e8b7e3bb2f99a0923b7.png)

As you can see the second part gets clipped in SVG as well.

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [October 3, 2018, 8:57pm UTC](https://community.plotly.com/t/clipping-legend-text-for-png-but-not-always-for-svg/14188/2 "2018-10-03T20:57:19Z")

</div>

Ha. That looks like a bug.

Would you mind sharing the full `"data"` and `"layout"` of your graph?

---

<div class="post-metadata">

**Author:** ![Chiaki](https://avatars.discourse-cdn.com/v4/letter/c/e8c25b/32.png) [@Chiaki](https://community.plotly.com/u/Chiaki)\
**Post date:** [October 4, 2018, 7:17am UTC](https://community.plotly.com/t/clipping-legend-text-for-png-but-not-always-for-svg/14188/3 "2018-10-04T07:17:59Z")

</div>

Hi etienne, I’d gladly do but the data is a bit sensitive. I could email it to you personally, if possible. Can you PM me with a mail address I could use?

---

<div class="post-metadata">

**Author:** ![Chiaki](https://avatars.discourse-cdn.com/v4/letter/c/e8c25b/32.png) [@Chiaki](https://community.plotly.com/u/Chiaki)\
**Post date:** [October 4, 2018, 8:26am UTC](https://community.plotly.com/t/clipping-legend-text-for-png-but-not-always-for-svg/14188/4 "2018-10-04T08:26:53Z")

</div>

I’ve send you a PM @etienne 😃

---

<div class="post-metadata">

**Author:** ![Chiaki](https://avatars.discourse-cdn.com/v4/letter/c/e8c25b/32.png) [@Chiaki](https://community.plotly.com/u/Chiaki)\
**Post date:** [October 6, 2018, 2:27pm UTC](https://community.plotly.com/t/clipping-legend-text-for-png-but-not-always-for-svg/14188/5 "2018-10-06T14:27:00Z")

</div>

Hey @etienne, happy anniversary!

---

<div class="post-metadata">

**Author:** ![Aus\_Tramper](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@Aus\_Tramper](https://community.plotly.com/u/Aus_Tramper)\
**Post date:** [October 16, 2018, 2:44am UTC](https://community.plotly.com/t/clipping-legend-text-for-png-but-not-always-for-svg/14188/6 "2018-10-16T02:44:57Z")

</div>

Hi etienne,

I believe I am getting a similar issue when exporting a graph in Chart Studio. If i export a graph as an SVG image the legend text will cut off. I have used one of the legend examples below to demonstrate the problem:

 ![image](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/e/ec7045f92831c55e76bd78489be9466ceaced184.png)

I resized the text to 30, however the same happens if the text is too long. Interestingly this does not happen if I export as a PNG image.

Have I missed something simple? (I am still new to plotly)
