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.

Hi,

I wanted to follow up on this issue. This is in my data breach sim

I have this code that generates a chart with the percentages variable.

in my model.py I then update percentages variable with a list of integers. However, whenever I do that. The graph always appears blank regardless of the values.

Do you have any steps to remediate this issue?

thanks

This seems to occur whenever I do division. even with a hard coded value and casting as an integer

Hi–

Unfortunately, there’s not enough detail in the message hear to diagnose the cause of the issue. It sounds like it’s an interaction between your model and the graphing library you’ve selected. Could it be a problem of division by zero resulting in invalid numbers?

We’d be happy to meet with you and do a little joint trouble shooting if that’s useful. Shoot us an email at support@forio.com and we’ll find a time.

Best, WILL