MicPy image generation

aspects of evaluating simulation results and their graphic presentation using either DisplayMICRESS or other software tools. Features and possibilities of DisplayMICRESS
Post Reply
matt_hughes
Posts: 9
Joined: Fri Jan 31, 2025 4:21 pm
anti_bot: 333

MicPy image generation

Post by matt_hughes » Tue Mar 25, 2025 5:59 pm

Hi MICRESS Forum,

Is it possible to change the scales of this plot to more realistic sizes. How do i change the concentration bar to be smaller so that the image isn't too small?

please see image of plot attached as well as an image of the python code used.

Thanks,
Matthew
You do not have the required permissions to view the files attached to this post.

beiz
Posts: 1
Joined: Wed Mar 26, 2025 10:31 am
anti_bot: 333

Re: MicPy image generation

Post by beiz » Wed Mar 26, 2025 11:30 am

Hi Matthew,

if you have the newest version of MicPy. It is possible to output the colorbar by bin.plot() function. You can remove the original one, and define you own colorbar as you wish. I have here an example code.
from micpy import bin
import matplotlib.pyplot as plt

path = "B003_1Grain_GrowthFromLiquid_0.frac"

file = bin.File(path)
file.open()
series = file.read()
field = series.get_field(-1)

# output fig, ax, and colorbar objects
fig, ax, cbar=bin.plot(field=field)
cbar.remove() # remove the original colorbar

# define a new colorbar (https://matplotlib.org/stable/api/_as_g ... orbar.html)
im = ax.images[0]
cbar1 = fig.colorbar(im, ax=ax, shrink = 0.5, pad = 0.1)

# define a new colorbar horizontally
cbar2 = fig.colorbar(im, ax=ax, orientation = "horizontal", pad = 0.15)
Image


I hope that it hopes you.

Best Regards
Bei Zhou
You do not have the required permissions to view the files attached to this post.

Post Reply