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

Can't add title to 2D function plot #1628

Open
RossBoylan opened this issue Nov 1, 2023 · 1 comment
Open

Can't add title to 2D function plot #1628

RossBoylan opened this issue Nov 1, 2023 · 1 comment

Comments

@RossBoylan
Copy link

Problem

plot((x, y)->x+y/2.0, 0.1, 5, -1, 3, Guide.Title("My Title"))

yields this error:

ERROR: Layers can't be used with elements of type Gadfly.Guide.Title
Stacktrace:
  [1] error(s::String)
    @ Base .\error.jl:35
  [2] add_plot_element!(lyrs::Vector{Layer}, arg::Gadfly.Guide.Title)
    @ Gadfly C:\Users\rdboylan\.julia\packages\Gadfly\OQ068\src\Gadfly.jl:191
  [3] layer(::Nothing, ::typeof(Gadfly.Geom.contour), ::Vararg{…}; mapping::@Kwargs{…})
    @ Gadfly C:\Users\rdboylan\.julia\packages\Gadfly\OQ068\src\Gadfly.jl:179
  [4] layer
    @ Gadfly C:\Users\rdboylan\.julia\packages\Gadfly\OQ068\src\Gadfly.jl:169 [inlined]
  [5] #layer#85
    @ Gadfly C:\Users\rdboylan\.julia\packages\Gadfly\OQ068\src\Gadfly.jl:188 [inlined]
  [6] layer(f::Function, xmin::Float64, xmax::Int64, ymin::Int64, ymax::Int64, elements::Gadfly.Guide.Title; mapping::@Kwargs{})
    @ Gadfly C:\Users\rdboylan\.julia\packages\Gadfly\OQ068\src\poetry.jl:122
  [7] layer
    @ Gadfly C:\Users\rdboylan\.julia\packages\Gadfly\OQ068\src\poetry.jl:107 [inlined]
  [8] plot(f::Function, xmin::Float64, xmax::Int64, ymin::Int64, ymax::Int64, elements::Gadfly.Guide.Title; mapping::@Kwargs{})
    @ Gadfly C:\Users\rdboylan\.julia\packages\Gadfly\OQ068\src\poetry.jl:75
  [9] plot(f::Function, xmin::Float64, xmax::Int64, ymin::Int64, ymax::Int64, elements::Gadfly.Guide.Title)
    @ Gadfly C:\Users\rdboylan\.julia\packages\Gadfly\OQ068\src\poetry.jl:56
 [10] top-level scope
    @ c:\Users\rdboylan\Documents\BP\linear\predictor.jl:60
Some type information was truncated. Use `show(err)` to see complete types.

Expected Behavior

My expectation was that I would get the plot with the requested title.

Speculation

Since there's only one plot, it's a little surprising to get a message of layers; I presume the plot machinery for this case is generating them or it behind the scenes.

Perhaps the somewhat unusual arguments, including the absence of a dataset, have something to do with the problem.

Context

Gadfly 1.4.0 on julia 1.10.0-beta2, running under VSCode 1.84.0.

@RossBoylan
Copy link
Author

This, on the other hand, works:

plot(z=(x, y)->x+y/2.0, xmin=[0.1], xmax=[5], ymin=[-1], ymax=[3], Geom.contour, Guide.Title("My Title"))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant