-
Notifications
You must be signed in to change notification settings - Fork 13
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
PlotExt.jl cannot plot cross section #68
Comments
The way you use
does that solve the issue? |
I tried to add Plots.ji at the begining:
It gives the same error:
|
The plots extension is automatically loaded if you load both LaMEM and Plots. No need to include this separately- the tutorials give done examples of that |
Anyway, the following code works without using PlotExt.jl.
|
I think I see now what the issue is. We are using so-called extensions in Julia which loads additional functions once the Below a MWE of this (using Julia 1.10): julia> using LaMEM, GeophysicalModelGenerator, Plots
julia> model = Model(Grid(nel=(16,16,16), x=[-1,1], y=[-1,1], z=[-1,1]));
julia> matrix = Phase(ID=0,Name="matrix",eta=1e20,rho=3000);
julia> sphere = Phase(ID=1,Name="sphere",eta=1e23,rho=3200);
julia> add_phase!(model, sphere, matrix)
julia> add_sphere!(model,cen=(0.0,0.0,0.0), radius=0.5);
julia> run_lamem(model,1); Once the simulation is finished, you can plot a cross-section with: julia> plot_cross_section(model, y=0, timestep=2, field=:phase) Important here is that |
@wenrongcao directly plotting of julia>]
pkg> add LaMEM#main |
@boriskaus PlotExt.jl is automatically included once LaMEM and Plots are used. No need to import the module again. However, It seems the other functions in the PlotExt.jl have similar issues:
The error message is :
The CartData is :
After running
Instead, I am able to read the topography by using:
My thoughts: although the provided PlotExt.jl gives a simple way to make plots, it lacks some flexibility to adjust plotting parameters such as the axis range, colormap, and labels. I think additionally providing an explicit example code to use Plots.jl to make plots can be useful. Since I have done that, I am happy to write a short document on that. |
thanks. Few comments:
The plotting routines allow passage on additional arguments, so changing axes etc. should in principle still be possible. I haven't tested this, though |
I tried to use the PlotExt.jl module to plot a cross section, it seems the code cannot recognize field Grid in the CartData read from a timestep.
The output of the CartData is :
Then I do:
Error message:
I looked at the PlotExt.jl but cannot figure out a way around to allow the code to read the proper format of x, y, z....
The text was updated successfully, but these errors were encountered: