Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/src/tutorials/tutorial_1.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ Alternatively, in order to view just one parameter or variable, call the functio
```julia
using VegaLite
run(m)
p = explore(m, component1, parameter1)
p = Mimi.plot(m, component1, parameter1)
save("MyFilePath.svg", p)
```
More specifically for our tutorial use of FUND, try:

```julia
using VegaLite
p = explore(m, :socioeconomic, :income)
p = Mimi.plot(m, :socioeconomic, :income)
save("MyFilePath.svg", p)
```

Expand Down
4 changes: 2 additions & 2 deletions docs/src/tutorials/tutorial_3.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ We can now use Mimi to construct a model that binds the `grosseconomy` and `emis
* If any variables of one component are parameters for another, [`connect_param!`](@ref) is used to couple the two components together. In this example, _YGROSS_ is a variable in the `grosseconomy` component and a parameter in the `emissions` component. The syntax is `connect_param!(model_name, :component_name_parameter, :parameter_name, :component_name_variable, :variable_name)`, where `:component_name_variable` refers to the component where your parameter was initially calculated as a variable.
* Finally, the model can be run using the command `run(model_name)`.
* To access model results, use `model_name[:component, :variable_name]`.
* To observe model results in a graphical form , [`explore`](@ref) as either `explore(model_name)` to open the UI window, or use `explore(model_name, :component_name, :variable_name)` or `explore(model_name, :component_name, :parameter_name)` to plot a specific parameter or variable.
* To observe model results in a graphical form , [`explore`](@ref) as either `explore(model_name)` to open the UI window, or use `Mimi.plot(model_name, :component_name, :variable_name)` or `Mimi.plot(model_name, :component_name, :parameter_name)` to plot a specific parameter or variable.

```julia

Expand Down Expand Up @@ -128,7 +128,7 @@ run(m)
m[:emissions, :E]

# Plot model results
explore(m, :emissions, :E)
Mimi.plot(m, :emissions, :E)

# Observe all model result graphs in UI
explore(m)
Expand Down
4 changes: 2 additions & 2 deletions docs/src/userguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ run(mymodel)

![Explorer Model Example](figs/explorer_model_example.png)

Alternatively, in order to view just one parameter or variable, call the function `explore` as below to return a plot object and automatically display the plot in a viewer, assuming `explore` is the last command executed. This call will return the type `VegaLite.VLSpec`, which you may interact with using the API described in the [VegaLite.jl](https://github.com/fredo-dedup/VegaLite.jl) documentation. For example, [VegaLite.jl](https://github.com/fredo-dedup/VegaLite.jl) plots can be saved as [PNG](https://en.wikipedia.org/wiki/Portable_Network_Graphics), [SVG](https://en.wikipedia.org/wiki/Scalable_Vector_Graphics), [PDF](https://en.wikipedia.org/wiki/PDF) and [EPS](https://en.wikipedia.org/wiki/Encapsulated_PostScript) files. You may save a plot using the `save` function. Note that while `explore(m)` returns interactive plots for line graphs, `explore(m, :foo, :bar)` will return only static plots.
Alternatively, in order to view just one parameter or variable, call the (unexported) function `Mimi.plot` as below to return a plot object and automatically display the plot in a viewer, assuming `Mimi.plot` is the last command executed. Note that `plot` is not exported in order to avoid namespace conflicts, but a user may import it if desired. This call will return the type `VegaLite.VLSpec`, which you may interact with using the API described in the [VegaLite.jl](https://github.com/fredo-dedup/VegaLite.jl) documentation. For example, [VegaLite.jl](https://github.com/fredo-dedup/VegaLite.jl) plots can be saved as [PNG](https://en.wikipedia.org/wiki/Portable_Network_Graphics), [SVG](https://en.wikipedia.org/wiki/Scalable_Vector_Graphics), [PDF](https://en.wikipedia.org/wiki/PDF) and [EPS](https://en.wikipedia.org/wiki/Encapsulated_PostScript) files. You may save a plot using the `save` function. Note that while `explore(m)` returns interactive plots for line graphs, `Mimi.plot(m, :foo, :bar)` will return only static plots.

```julia
using VegaLite
run(mymodel)
p = explore(mymodel, component1, parameter1)
p = Mimi.plot(mymodel, component1, parameter1)
save("figure.svg", p)
```

Expand Down
4 changes: 2 additions & 2 deletions src/explorer/explore.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ function explore(m::Model; title = "Electron")
end

"""
explore(m::Model, comp_name::Symbol, datum_name::Symbol; interactive::String=true)
plot(m::Model, comp_name::Symbol, datum_name::Symbol)

Plot a specific `datum_name` (a `variable` or `parameter`) of Model `m`.
"""
function explore(m::Model, comp_name::Symbol, datum_name::Symbol)
function plot(m::Model, comp_name::Symbol, datum_name::Symbol)

if m.mi === nothing
error("A model must be run before it can be plotted")
Expand Down
4 changes: 2 additions & 2 deletions test/test_explorer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ w = explore(m, title = "Testing Window")
@test typeof(w) == Electron.Window
close(w)

#5. explore(m::Model, comp_name::Symbol, datum_name::Symbol;
#5. Mim.plot(m::Model, comp_name::Symbol, datum_name::Symbol;
# dim_name::Union{Nothing, Symbol} = nothing)

p = explore(m, :MyComp, :a)
p = Mimi.plot(m, :MyComp, :a)
@test typeof(p) == VegaLite.VLSpec{:plot}

#6. errors and warnings
Expand Down