changed axis labels on week graph
This commit is contained in:
		
							parent
							
								
									1fbe61128e
								
							
						
					
					
						commit
						7d537bb4f1
					
				
					 1 changed files with 15 additions and 14 deletions
				
			
		|  | @ -76,20 +76,6 @@ update_data <- function(){ | ||||||
|     current_status[[entity]] <- ifelse(values %>% filter(entity_id %in% entity) %>% tail(1) %>% pull(value) > power_threshhold, "on", "off") |     current_status[[entity]] <- ifelse(values %>% filter(entity_id %in% entity) %>% tail(1) %>% pull(value) > power_threshhold, "on", "off") | ||||||
|   } |   } | ||||||
|    |    | ||||||
|   plot_1week <- ggplot(data = values) + |  | ||||||
|     geom_tile(aes(x = time + seconds(round(as.numeric(difftime(end_time, time, unit = "secs")))/2), |  | ||||||
|                   y = entity_id, |  | ||||||
|                   width = seconds(round(as.numeric(difftime(end_time, time, unit = "secs")))), |  | ||||||
|                   height = 0.5, |  | ||||||
|                   fill = status)) + |  | ||||||
|     scale_y_discrete(breaks = entities$entity_id, labels = entities$name) + |  | ||||||
|     scale_x_datetime(date_breaks = "24 hours", date_labels = '%A', date_minor_breaks = "6 hours") + |  | ||||||
|     theme(axis.text.x = element_text(angle = 30, vjust = 0.5)) + |  | ||||||
|     labs(title = "The past week", |  | ||||||
|          x = NULL, |  | ||||||
|          y = NULL, |  | ||||||
|          fill = NULL) |  | ||||||
|    |  | ||||||
|   plot_1day <- ggplot(data = values %>% filter(time >= max(values$end_time) - hours(24))) + |   plot_1day <- ggplot(data = values %>% filter(time >= max(values$end_time) - hours(24))) + | ||||||
|     geom_tile(aes(x = time + seconds(round(as.numeric(difftime(end_time, time, unit = "secs")))/2), |     geom_tile(aes(x = time + seconds(round(as.numeric(difftime(end_time, time, unit = "secs")))/2), | ||||||
|                   y = entity_id, |                   y = entity_id, | ||||||
|  | @ -104,6 +90,21 @@ update_data <- function(){ | ||||||
|          y = NULL, |          y = NULL, | ||||||
|          fill = NULL) |          fill = NULL) | ||||||
|    |    | ||||||
|  |   plot_1week <- ggplot(data = values) + | ||||||
|  |     geom_tile(aes(x = time + seconds(round(as.numeric(difftime(end_time, time, unit = "secs")))/2), | ||||||
|  |                   y = entity_id, | ||||||
|  |                   width = seconds(round(as.numeric(difftime(end_time, time, unit = "secs")))), | ||||||
|  |                   height = 0.5, | ||||||
|  |                   fill = status)) + | ||||||
|  |     scale_y_discrete(breaks = entities$entity_id, labels = entities$name) + | ||||||
|  |     scale_x_datetime(date_breaks = "1 day", date_labels = '%A', date_minor_breaks = "4 hours") + | ||||||
|  |     theme(axis.text.x = element_text(angle = 30, vjust = 0.5)) + | ||||||
|  |     labs(title = "The past week", | ||||||
|  |          x = NULL, | ||||||
|  |          y = NULL, | ||||||
|  |          fill = NULL) | ||||||
|  | 
 | ||||||
|  |    | ||||||
|   render("laundry_status.Rmd", |   render("laundry_status.Rmd", | ||||||
|          output_dir = "html", |          output_dir = "html", | ||||||
|          output_file = "index.html") |          output_file = "index.html") | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue