use png to show agent #2783
Replies: 3 comments
-
Hi! I took a look at your problem to see if I could help at all, it looks like you are calling fields which aren't supported by the visualization function. It seems like passing a custom shape and image isn't supported, but I could be wrong and maybe you're further along than I am. |
Beta Was this translation helpful? Give feedback.
-
Sorry that no one got back to you earlier. I remember this working at some point. @Sahil-Chhoker, could you say what the latest status is on image support for agents in SolaraViz? |
Beta Was this translation helpful? Give feedback.
-
Images as markers are supported in the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I’m trying to display custom PNG images for agents instead of the default shapes using the agent_portrayal function. My portrayal code looks like this:
python
Copy
def agent_portrayal(agent):
return {
"Shape": "image",
"Image": "/local/resources/my_agent.png",
"scale": 0.9,
"Layer": 1
}
The images are located in a resources folder inside my project directory. I run the server from the project root using mesa runserver. However, the images do not display in the visualization, and only the default circle shape appears.
When I run the server from other directories, I see 404 errors in the console related to the images.
I am using the latest Mesa version. According to the documentation and examples (like the wolf_sheep example), this approach should work, but in practice, the images are not shown.
Is there any special configuration needed in the visualization or JavaScript files? Is there a way to use custom images without modifying the JS code?
I would appreciate any guidance
Beta Was this translation helpful? Give feedback.
All reactions