2
y軸應該能夠從0-535,000運行,並且線應該在它們的位置上成比例。我沒有足夠的詞彙來描述這個問題,所以這裏有兩張照片。閃亮的R ggplot:散點圖軸已經很奇怪
server.R片斷
carbon_emissions <- read.csv("/Users/mathewsayer/Documents/Work/Level 7/Shiny Flat Tax/Carbon/Carbon_Emissions/data/carbon_emissions0513.csv")
output$carbonPlot <- renderPlot({
pCarbon <- ggplot(data=carbon_emissions[carbon_emissions$category%in%input$emission_choose,],
aes(x=year, y=co2, group=category, colour=category))+
geom_line()+
geom_point()
pCarbon + labs(title="UK Domestic, Industry and Transport CO2 Emissions")
})
ui.R片斷
checkboxGroupInput(
"emission_choose",
label = "Plot CO2 emissions from various sectors",
choices = c(
"Industrial and Commericial Electricity" = "i_c_electric",
"Industrial and Commericial Gas" = "i_c_gas",
"Large Industrial Installations" =
"large_industry",
"Other Industrial and Commericial Fuels" = "i_c_other_fuel",
"Agriculture" =
"agriculture",))
plotOutput("carbonPlot")
數據樣本
year,co2,category
2005,"110,579.1",i_c_electric
2006,"116,665.8",i_c_electric
2007,"113,343.8",i_c_electric
2008,"112,510.3",i_c_electric
...
2010,7.6,pc_emission
2011,6.9,pc_emission
2012,7.1,pc_emission
2013,7.0,pc_emission
預先感謝好人。