dev.off() lt = lapply(s, function(x) x$time_480v - first(x$time_480v)) lc = lapply(s, function(x) ((x$voltage_0 * x$current_0_480v) + (x$voltage_1 * x$current_1_480v) + (x$voltage_2 * x$current_2_480v)) / 1000) my.palette <- hcl.colors(length(lt), alpha=.2, palette="RdYlBu") # Create two panels side by side layout(t(1:2), widths=c(5,1)) # Set margins and turn all axis labels horizontally (with `las=1`) par(mar=c(4,4,2,1), oma=c(0.5,0.5,0.5,2), las=1) plot(0, 0, type = "l", ylim = c(0, Reduce(max, unlist(lc))), xlim=c(0,35), xlab = "Sekunden nach Start des Zykluses", ylab="Scheinleistung in kVA") grid() for (i in 2:length(lt)) { #matplot(df$current_10, df[,0]) lines(lt[[i]], lc[[i]], col=my.palette[i]) } title("Einspeiseleistung pro Zyklus") # Draw the color legend image(1, seq_along(lt), t(seq_along(lt)), col=my.palette, axes=FALSE, xlab="", ylab="Zyklus") axis(4) lt = lapply(s, function(x) x[x$current_6 > 4,]$time_24v - first(x[x$current_6 > 4,]$time_24v)) lc = lapply(s, function(y) { x = y[y$current_6 > 4,] return (x$current_0_24v + x$current_1_24v + x$current_2_24v + x$current_3 +x$current_4+x$current_5+x$current_6+x$current_7+x$current_8+x$current_9+x$current_10+x$current_11+x$current_12+x$current_13+x$current_14+x$current_15) }) my.palette <- hcl.colors(length(lt), alpha=.2, palette="RdYlBu") # Create two panels side by side layout(t(1:2), widths=c(5,1)) # Set margins and turn all axis labels horizontally (with `las=1`) par(mar=c(4,4,2,1), oma=c(0.5,0.5,0.5,2), las=1) plot(0, 0, type = "l", ylim = c(0, Reduce(max, unlist(lc))), xlim=c(0,35), xlab = "Sekunden nach Start des Zykluses", ylab="24V Stromaufnahme in A") grid() for (i in 2:length(lt)) { #matplot(df$current_10, df[,0]) lines(lt[[i]], lc[[i]], col=my.palette[i]) } title("Strom am 24V Netzteil pro Zyklus") # Draw the color legend image(1, seq_along(lt), t(seq_along(lt)), col=my.palette, axes=FALSE, xlab="", ylab="Zyklus") axis(4)