# Visualizing positive, negative and neutral in 2D?

Overview: The campus I work for has a website that students can use to vote how they feel in terms of comfort in a particular room. The options the students have when logged into the site are : Cold, Perfect and Hot. The votes are stored in a large database that contains the time the student voted, the building and room they are in and the type of comfort vote they selected. This gives my team an idea of either overcooling a particular room / building or not cooling enough.

Initial Idea: My idea was to plot the votes that are coming in onto a graph that can be updated as the students vote throughout the day. Cold votes be +1, hot votes be -1 and perfect would be 0, This was to give a general overview of overcooling, undercooling across campus. The problem I ran into is this would never indicate that people are feeling perfect if even one person voted cold/hot.

One option suggested in the comments was to create a bar graph which could keep a sum of the three votes separately, possibly a bar graph per day, then sum the daily count of votes for a monthly bar graph and per year.

Question: I was wondering if there was a way to visualize this in 2D, to quickly get an idea of the comfort of people, whether they are mostly Hot, Cold or Perfect or would I have to keep this in 3D with each dimension pertaining to the vote type?

Example Data:

• Can you post your data (or a small example dataset) for people to work with? What are the students voting on? How many students are voting? Can a student abstain from voting? We need more information here... – gung - Reinstate Monica Jun 3 '19 at 17:00
• Numbers of cold, perfect and hot votes can easily be shown in two dimensions for example with 3 bars. If you're imagining a three-dimensional display you must be wanting to show something else but I can't follow what that is. – Nick Cox Jun 3 '19 at 17:01
• @gung I added a small sample dataset, the students vote on a site with the three options, so they are not able to abstain from voting. The number of students voting is variable as it is dependent on when they choose to vote. – jaleman Jun 3 '19 at 17:09
• I still don't quite follow this. What are the sites? How many sites are there? What does the timestamp have to do with this? Does the student vote on each site, or assign their "hot" vote to the one they like best? – gung - Reinstate Monica Jun 3 '19 at 17:18
• @gung there is only one website where students on campus can vote. They provide information of the building they are in, and after are given three options to choose: Cold, Hot, Perfect. This gets added to a database that is storing the votes of students across campus. The timestamp is recorded when the student submits their vote. The relevance of the timestamp in my initial idea was to use time as the x coordinate and comfort as the y coordinate, to see the trend either go up (colder votes) or down (hotter votes) but I didn't account for perfect, which would not have any impact if left as 0. – jaleman Jun 3 '19 at 17:23

I would do a graphic taking as time unit a week or month. Then I would count for each time unit the amount of each vote you have. Then take the percentage of vote for each category for that time unit, this is important in order to be able to compare different times. Then plot this data with lines of different color like this R script:

  library(lubridate)
library(ggplot2)
data <- data.frame(Time=seq(from=as.Date('1990-01-01'),to=as.Date('1991-12-31'),by='day'))

asd <- runif(nrow(data),min=0,max = 3)
data$$Vote <-factor(x = 'perfect',levels = c('hot','cold','perfect')) data$$Vote[asd <= 2] <- 'cold'
data$$Vote[asd <= 1] <- 'hot' Times <- seq(from=as.Date('1990-01-01'),to=as.Date('1991-12-31'),by='month') new_data <- data.frame(Time=rep(Times,each=3)) new_data$$Votes <- rep(c('hot','cold','perfect'),24)
new_data\$value <- NA
cont <- 0
for(ii in 1:length(Times)){
i <- Times[ii]
yy <- year(i)
mm <- month(i)

index <- year(data$$Time) == yy & month((data$$Time)) == mm
for(vote in c('hot','cold','perfect')){
cont <- cont +1
index2 <- data$$Vote[index] == vote if(any(index2)){ new_datavalue[cont] <- length(which(index2)) } } new_data$$value[(cont-2):cont] <- new_data$$value[(cont-2):cont]/(sum(new_data$$value[(cont-2):cont],na.rm = T))
}


• Really nice! One question I had was in new_data what does the value column represent for each vote? I ran your script and new_data has for Time 1990-01-01 There is hot votes with 1.0645161 as the value, cold with 1.064551 and perfect with 0.9709677 – jaleman Jun 4 '19 at 20:46