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

Support setting the units on the axes when plotting #348

Merged
merged 2 commits into from
Jul 19, 2023

Conversation

fhagemann
Copy link
Collaborator

using SolidStateDetectors, Unitful, Plots
sim = Simulation(SSD_examples[:InvertedCoax])
calculate_electric_potential!(sim)

Somehow, the current implementation (stable v0.9.0) does not allow to change the units of the axes easily, meaning that the following snippets of code kill the kernel:

plot(sim.electric_potential, xunit = u"mm", yunit = u"mm")
plot(u"mm", u"mm", u"V")
plot!(sim.electric_potential)

This should be fixed now by explicitly setting the default units to the internal units and by giving xlims and ylims units.

plot(sim.electric_potential, xunit = u"mm", yunit = u"mm")

works like a charm:
grafik

plot(u"mm", u"mm", u"V")
plot!(sim.electric_potential)

looks weird somehow (but people should then just not use it for now):
grafik

I updated the electric field plot in the tutorial, so that it's to be seen somewhere.

Other plots:

plot(sim.point_types, xunit = u"cm", yunit = u"cm", full_det = true)

grafik

plot(sim.q_eff_imp, xunit = u"cm", yunit = u"cm", zunit = u"MV * m", full_det = true)

grafik

@fhagemann fhagemann added the convenience Improve user-friendliness label Jul 5, 2023
@fhagemann
Copy link
Collaborator Author

This should be tested with all possible things there are to plot and with both coordinate systems, to be sure that nothing was messed up here.

@fhagemann fhagemann merged commit 9db337f into JuliaPhysics:main Jul 19, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
convenience Improve user-friendliness
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant