diff --git a/docs/src/tutorials/tutorial_1.md b/docs/src/tutorials/tutorial_1.md index e8262c5e8..49965e9b8 100644 --- a/docs/src/tutorials/tutorial_1.md +++ b/docs/src/tutorials/tutorial_1.md @@ -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) ``` diff --git a/docs/src/tutorials/tutorial_3.md b/docs/src/tutorials/tutorial_3.md index 1dded0adf..4b1fb7d91 100644 --- a/docs/src/tutorials/tutorial_3.md +++ b/docs/src/tutorials/tutorial_3.md @@ -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 @@ -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) diff --git a/docs/src/userguide.md b/docs/src/userguide.md index a2822484f..cf451883d 100644 --- a/docs/src/userguide.md +++ b/docs/src/userguide.md @@ -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) ``` diff --git a/src/explorer/explore.jl b/src/explorer/explore.jl index f8e25414c..da3affb50 100644 --- a/src/explorer/explore.jl +++ b/src/explorer/explore.jl @@ -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") diff --git a/test/test_explorer.jl b/test/test_explorer.jl index 15d978d2a..3a0d1cd45 100644 --- a/test/test_explorer.jl +++ b/test/test_explorer.jl @@ -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