-
Notifications
You must be signed in to change notification settings - Fork 251
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
Error when stacking DataFrame during plot according to the documentation. #1579
Comments
does it work if you data doesn't have |
Removing the missing values gives the same error for attempt 1, fixes attempt 2, and yields a different error for attempt 3. julia> df = DataFrame("Temperature (°F)" => [100,200],
"Yield Strength (psi)" => [130000.0, 125000.0],
"Ultimate Strength (psi)" => [145000.0, 145000.0])
2×3 DataFrame
Row │ Temperature (°F) Yield Strength (psi) Ultimate Strength (psi)
│ Int64 Float64 Float64
─────┼─────────────────────────────────────────────────────────────────
1 │ 100 130000.0 145000.0
2 │ 200 125000.0 145000.0
julia> plot(df,
x="Temperature (°F)",
y=Col.value("Yield Strength (psi)", "Ultimate Strength (psi)"),
color=Col.index("Yield Strength (psi)", "Ultimate Strength (psi)")
)
ERROR: MethodError: no method matching value(::String, ::String)
Stacktrace:
[1] top-level scope
@ REPL[10]:1
julia> plot(df,
x="Temperature (°F)",
y=Col.value(Symbol("Yield Strength (psi)"), Symbol("Ultimate Strength (psi)")),
color=Col.index(Symbol("Yield Strength (psi)"), Symbol("Ultimate Strength (psi)"))
) # Works if no missing values
julia> plot(df,
x="Temperature (°F)",
y=Col.value(),
color=Col.index()
)
ERROR: KeyError: key Symbol("Temperature (°F)") not found
Stacktrace:
[1] getindex(h::Dict{Any, Int64}, key::Symbol)
@ Base .\dict.jl:481
[2] evalmapping(source::Gadfly.MeltedData{DataFrame}, arg::String)
@ Gadfly C:\Users\nboyer.AIP\.julia\packages\Gadfly\B5yQc\src\mapping.jl:196
[3] _evalmapping!(mapping::Dict{Symbol, Any}, data_source::Gadfly.MeltedData{DataFrame}, data::Gadfly.Data)
@ Gadfly C:\Users\nboyer.AIP\.julia\packages\Gadfly\B5yQc\src\mapping.jl:204
[4] evalmapping!(mapping::Dict{Symbol, Any}, data_source::DataFrame, data::Gadfly.Data)
@ Gadfly C:\Users\nboyer.AIP\.julia\packages\Gadfly\B5yQc\src\mapping.jl:233
[5] plot
@ C:\Users\nboyer.AIP\.julia\packages\Gadfly\B5yQc\src\Gadfly.jl:327 [inlined]
[6] #plot#77
@ C:\Users\nboyer.AIP\.julia\packages\Gadfly\B5yQc\src\Gadfly.jl:289 [inlined]
[7] top-level scope
@ REPL[12]:1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am trying to follow the documentation below.
However, I get an error using the versions of this method below.
These other two methods work, but aren't as elegant.
Is there not an easier way to plot two columns with an automatic legend?
The text was updated successfully, but these errors were encountered: