Importing matplotlib

Hi,

I am creating custom graphs, I was trying to use matplotlib. However, I am having trouble importing. I uploaded the folder for matplotlib into forio but it still isn’t recognizing the path.

Any insights or assistance with this would be great.

Hi –

To answer your question directly, you should be able to include a python library as a folder in the model folder and import it in your python model.

Having said that, this is an unusual approach. If you are trying to display a data set in a web simulation, it’s usually easier to use a client side graphing library like Contour (forio.com/contour) or D3.

WILL

thanks, that is a good recommendation. I want to use a variable from my model within my bar plot using contour. I tried data-f-bind but it formats it different when I save the page which Is why I think it is breaking. Any tips or examples on using variables from a model within a contour

specfically using the binding of variables in the model.py within the script tags

Hi–

The answer depends on how you are building your interface.

  • If you are building with the interface builder, use the built in graphs if feasible
  • If you are using Flow.js (or if you want to add custom graphs to interface builder), follow instructions in this link [1]
  • If you are using Epicenter.js (lower-level Javascript APS) call the contour API directly [2]

[1] https://forio.com/epicenter/docs/public/data_binding_flow_js/graphing-overview/
[2] https://forio.com/contour/documentation.html

Best, WILL

my goal is to make a custom visualization using a variable from my model.py that won’t change after initialization.