Skip to content

Commit d9cb5d7

Browse files
JoshuaLampertranochasloede
authored
add documentation for new 1D plotting functionalities (#2280)
Co-authored-by: Hendrik Ranocha <[email protected]> Co-authored-by: Michael Schlottke-Lakemper <[email protected]>
1 parent 1e1f643 commit d9cb5d7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

docs/src/visualization.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,16 @@ Trixi.jl automatically creates a [`PlotData1D`](@ref) object and visualizes it a
276276
line plot:
277277
![1d-plot](https://user-images.githubusercontent.com/3637659/119086020-1e3f4d80-ba05-11eb-873e-1b586a81e7fe.png)
278278

279-
To customize your 1D plot, you can create a `PlotData1D` object manually as follows:
279+
To customize your 1D plot, you can create a [`PlotData1D`](@ref) object manually as follows:
280280
```julia
281281
julia> pd = PlotData1D(sol)
282282
julia> pd = PlotData1D(u, semi)
283+
julia> pd = PlotData1D((x, equations) -> initial_condition(x, last(tspan), equations), semi)
283284
```
284-
The behavior is analogous to the [`PlotData2D`](@ref) behavior.
285+
If you pass some data `u` and a semidiscretization `semi`, `u` can either be an array, e.g., obtained
286+
by `sol.u[end]` or a function taking a one-element `SVector` `x` representing the spatial variable and the `equations`.
287+
The latter option can be useful, e.g., for plotting an analytical solution.
288+
The behavior of a [`PlotData1D`](@ref) is analogous to the [`PlotData2D`](@ref) behavior.
285289

286290
In a very similar fashion to [`PlotData2D`](@ref), you can customize your plot:
287291
* `plot(pd)` creates the same plot as in `plot(sol)`.
@@ -295,6 +299,7 @@ You can also customize the [`PlotData1D`](@ref) object itself by passing attribu
295299
to the [`PlotData1D`](@ref) constructor:
296300
* `solution_variables` specifies the variables to be plotted.
297301
* `nvisnodes` sets the amount of nodes per element which the solution then is interpolated on.
302+
* `reinterpolate` specifies whether or not the data should be reinterpolated to a homogeneous grid or not.
298303

299304

300305
### Plotting a 2D or 3D solutions as a 1D plot

0 commit comments

Comments
 (0)