Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extracting the x,y,z components of the field using array for 3D plotting #162

Open
code-whale opened this issue Jul 17, 2021 · 3 comments
Open
Labels
backlog Good idea, has been added to our todo list. (No time to do it, though.) feature request not Ubermag issue The topic of the issue is not caused by ubermag. Please seek help elsewhere.

Comments

@code-whale
Copy link

Dear Ubermag Team,I want to be able to use matplotlib for 3D plotting, so I tried to use field.(x,y,or z).plane('z').array to extract the individual components in the section, but it returned the following error: Argument Z must be 2- dimensional.
I have attached the error to the following chart:
image
where system.m is a regular field object。
I would like to be able to represent the skyrmion as a similar 3D structure as shown below, can you tell me how to do this, thanks for your help!
image

@marijanbeg
Copy link
Member

Hi @code-whale, thank you for your question. The issue you encountered is not related to Ubermag - it is related to how you call plt.plot_surface() function.

Please have a look at this example from Matlotlib (https://matplotlib.org/stable/gallery/mplot3d/surface3d.html). The arrays x and y should be coordinates and not magnetisation components. Although these can be defined relatively easily by the user, I have just noticed we do not have a convenience function in Mesh that can return the coordinates. For that reason, I will keep this issue open since this is something we can consider for the next Ubermag release.

@marijanbeg marijanbeg added backlog Good idea, has been added to our todo list. (No time to do it, though.) feature request not Ubermag issue The topic of the issue is not caused by ubermag. Please seek help elsewhere. labels Jul 17, 2021
@code-whale
Copy link
Author

@marijanbeg , thanks for your reply and suggestions! I have improved the original code and now I can draw skyrmion 3D, system.m.z.array returns a 4 dimensional array. I reduced the dimension of the array. Also I'd like to ask you if ubermag can get the position coordinates of a circle or custom shape to make the image look good! Thanks again for your help!
image

@marijanbeg
Copy link
Member

Hi @code-whale, it is difficult to say where Ubermag's functionalities end and where problems can be solved using already existing tools from Python's ecosystem. We believe this functionality is not something that should belong to Ubermag and we recommend the combination of numpy and matplotlib to address this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Good idea, has been added to our todo list. (No time to do it, though.) feature request not Ubermag issue The topic of the issue is not caused by ubermag. Please seek help elsewhere.
Projects
None yet
Development

No branches or pull requests

2 participants