# Custom Node - Input lists Error

**URL:** <https://forum.dynamobim.com/t/custom-node-input-lists-error/84439>\
**Category:** Revit\
**Tags:** python, dynamo\
**Created:** [December 25, 2022, 11:39am UTC](https://forum.dynamobim.com/t/custom-node-input-lists-error/84439 "2022-12-25T11:39:22Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [December 25, 2022, 7:22pm UTC](https://forum.dynamobim.com/t/custom-node-input-lists-error/84439/3 "2022-12-25T19:22:23Z")

</div>

Hello,  
you have to look at the script by M. C. Poupin  
I tried but with I have trouble with python, if it can help you [Can I use matplotlib in Dynamo? - #5 by c.poupin](https://forum.dynamobim.com/t/can-i-use-matplotlib-in-dynamo/40608/5)

I attach what I tried to do

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/7/c7876f801ba777be192b7d47f407669dd8d06d77.png)

```auto
# Charger les bibliothèques DesignScript et Standard Python
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import os

clr.AddReference('System.Drawing')
import System.Drawing
from System.Drawing import *
from System.Drawing.Imaging import *
from System.IO import MemoryStream

localapp = os.getenv(r'LOCALAPPDATA')

sys.path.append(os.path.join(localapp, r'python-3.9.12-embed-amd64\Lib\site-packages'))
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
import io
import math

# Les entrées effectuées dans ce noeud sont stockées sous forme de liste dans les variables IN.
a=IN[0]
b=IN[1]

# Placer votre code au-dessous de cette ligne
def plt2arr(fig):
    fig.canvas.draw()
    rgba_buf = fig.canvas.buffer_rgba()
    (w,h) = fig.canvas.get_width_height()
    rgba_arr = np.frombuffer(rgba_buf, dtype=np.uint8).reshape((h,w,4))
    return rgba_arr

def convertToBitmap2(npImgArray):
    bitmap_ = None
    # remove alpha
    if npImgArray.ndim == 3 and npImgArray.shape[-1] == 4:
        npImgArray = npImgArray[:, :, :-1]
    # convert to PIL Image
    if npImgArray.ndim == 3:
        image = Image.fromarray(npImgArray, "RGB")
    else:
        image = Image.fromarray(npImgArray, "L")
    # convert to Python ByteArray
    byteIO = io.BytesIO()
    image.save(byteIO, format='BMP')
    byteArr = byteIO.getvalue()
    # convert to Net ByteArray
    netBytes = System.Array[System.Byte](byteArr)
    with MemoryStream(netBytes) as ms:
        bitmap_ = Bitmap(ms)
    return bitmap_
    
xpoints = np.array(b[0])
ypoints = np.array(b[1])
plt.plot(xpoints,ypoints)
plt.xlabel(a[0])
plt.ylabel(a[1])
fig=plt.figure()
ax = fig.add_subplot(111)
ax.plot(xpoints,ypoints)
ax.set_xlabel(a[0])
ax.set_ylabel(a[1])

image_from_plot = plt2arr(fig)
bitmap1 = convertToBitmap2(image_from_plot)

# Affectez la sortie à la variable OUT.
OUT = bitmap1

```

Cordially  
christian.stan

---

_[View the full topic](https://forum.dynamobim.com/t/custom-node-input-lists-error/84439)._
