A question about Plots


The program has run ,but the scatter diagram does not show ,why?
Is it too much data in my code?

using CSV,Clustering,Gadfly,Statistics,DataFrames,Plots,StatsBase
data=CSV.read("D:\\数据\\数据.csv")

MD=data[90001:120000,:]
load=convert(Array,MD[:,5])
solar=convert(Array,MD[:,8])
wind=convert(Array,MD[:,9])
Dload=reshape(load,1,:)
Dsolar=reshape(solar,1,:)
Dwind=reshape(wind,1,:)
Dlsw=[Dload;Dsolar;Dwind]
Dlsw=disallowmissing(Dlsw)


LSW=DataFrame()
LSW[:cloL]=Dlsw[1,:]
LSW[:cloS]=Dlsw[2,:]
LSW[:cloW]=Dlsw[3,:]
Nlsw=LSW[:cloL].-LSW[:cloS].-LSW[:cloW]
DNlsw=reshape(Nlsw,24,:)
DNlsw=DNlsw'
initseeds(:rand,convert(Matrix,DNlsw'),12)
result=kmeans(DNlsw,12)
Gadfly.plot(LSW, x=:cloS, y=:cloW, color=result.assignments, Geom.point)

Three suggestions:

  1. See this stackoverflow question/answer. Test the plot in that example.
  2. Read the DataFrames tutorial, to fix up the DataFrames warnings (the warnings do give you a hint)
  3. You don’t the Plots package in the first line, just Gadfly should be fine (the 2 are separate plotting packages)
1 Like