Dataframe Julia中数据帧子集的绘制

Dataframe Julia中数据帧子集的绘制,dataframe,csv,plot,julia,Dataframe,Csv,Plot,Julia,我有一个分光计的数据,分光计每隔5分钟左右进行一次测量,我把数据放在一个CSV文件中 第一列表示测量时间,接下来的两千列表示给定波长下的光强度 我想得到一个光谱在一天中如何演变的3D表示,但到目前为止,我甚至很难画出一个给定时间的单一光谱 我尝试了以下方法: using Plots using CSV using DataFrames gr() Plots.GRBackend() data = CSV.File("data/measures.csv") |> Dat

我有一个分光计的数据,分光计每隔5分钟左右进行一次测量,我把数据放在一个CSV文件中

第一列表示测量时间,接下来的两千列表示给定波长下的光强度

我想得到一个光谱在一天中如何演变的3D表示,但到目前为止,我甚至很难画出一个给定时间的单一光谱

我尝试了以下方法:

using Plots
using CSV
using DataFrames

gr()
Plots.GRBackend()

data = CSV.File("data/measures.csv") |> DataFrame

x = 1:2048
y = data[1, 2:end] # retrieve the spectrum of the first row

plot(x, y)
指令
data[1,2:end]
检索正确的值,但在将其传递到
plot
函数之前,似乎需要转换为其他类型

我得到以下错误:

ERROR: Cannot convert DataFrameRow{DataFrame, DataFrames.SubIndex{DataFrames.Index, UnitRange{Int64}, UnitRange{Int64}}} to series data for plotting
Stacktrace:
  [1] error(s::String)        
    @ Base .\error.jl:33      
  [2] _prepare_series_data(x::DataFrameRow{DataFrame, DataFrames.SubIndex{DataFrames.Index, UnitRange{Int64}, UnitRange{Int64}}})
    @ RecipesPipeline ~\.julia\packages\RecipesPipeline\CirY4\src\series.jl:8
  [3] _series_data_vector(x::DataFrameRow{DataFrame, DataFrames.SubIndex{DataFrames.Index, UnitRange{Int64}, UnitRange{Int64}}}, plotattributes::Dict{Symbol, Any})
    @ RecipesPipeline ~\.julia\packages\RecipesPipeline\CirY4\src\series.jl:27
  [4] macro expansion
    @ ~\.julia\packages\RecipesPipeline\CirY4\src\series.jl:144 [inlined]
  [5] apply_recipe(plotattributes::AbstractDict{Symbol, Any}, #unused#::Type{RecipesPipeline.SliceIt}, x::Any, y::Any, z::Any)
    @ RecipesPipeline ~\.julia\packages\RecipesBase\92zOw\src\RecipesBase.jl:282
  [6] _process_userrecipes!(plt::Any, plotattributes::Any, args::Any)
    @ RecipesPipeline ~\.julia\packages\RecipesPipeline\CirY4\src\user_recipe.jl:36
  [7] recipe_pipeline!(plt::Any, plotattributes::Any, args::Any)
    @ RecipesPipeline ~\.julia\packages\RecipesPipeline\CirY4\src\RecipesPipeline.jl:70
  [8] _plot!(plt::Plots.Plot, plotattributes::Any, args::Any)
    @ Plots ~\.julia\packages\Plots\SVksJ\src\plot.jl:172
  [9] plot(::Any, ::Vararg{Any, N} where N; kw::Any)
    @ Plots ~\.julia\packages\Plots\SVksJ\src\plot.jl:58
 [10] plot(::Any, ::Any)
    @ Plots ~\.julia\packages\Plots\SVksJ\src\plot.jl:52
 [11] top-level scope
    @ ~\path\to\my\script.jl:18

谢谢你的帮助

我不确定您到底需要什么,但很可能您需要将
DataFrameRow
转换为
Vector
,如下所示:

plot(x, Vector(y))