Stacked power plot for Always-on, ID's appliances, and other?

Reasonable suggestion… R and ggplot are built to do this stuff kind of easily. The trickiest part is blending the special cases (Always On) into the mix.

Sure enough… Looks better:

And here’s the R code

SimplePlot2.R (4.0 KB)


I love this! It really cleared it up putting the low variability on bottom!

1 Like

@kevin1, This is great stuff. What all does one need to run your plots? Is there a post somewhere that has this?


The script I posted, runs in the R language and environment, all free and downloadable. It takes in one or more Sense yearly downloads with 1 hour resolution. R is an open-source statistical language that is taught in virtually all non-comp-sci focused data science courses today.

You can find the base R language here

A great IDE environment for R is R-Studio. The company that developed R-Studio offers a free version that is more than enough for most users.

My script will require a little customization for your specifics, plus will require downloading some additional packages (reader, ggplot2), but R-Studio will help you with that.

If you have done some coding before, give it a try. There are plenty of videos and tutorials on how to use R.


R is something new to me and I’m just getting started trying to learn a little. Where I have my phone all the time and not a computer, I got the app from the Apple store.
Not sure exactly what I’ll be able to do from the phone just yet but the highlight of the description was the ability to learn from the app.

1 Like

Thanks Kevin, I’ll give this a try.

Looks like the App is a fairly full-featured version of R with all the requisite packages. But man, trying to code via a tiny touch screen or view graphical output is going to be challenging. Still useful for learning.

Python (another scripting language) has a similar iPhone app. @kevin1 is correct that programming on a touch screen is difficult/tedious, but if I had a script already made, running it in the app was pretty straight forward. @samwooly1 keep us updated if you get it set up and working in this app… I may try it out if you have some success.

1 Like

Quickly tried to port my script to iPhone/iPad R Compiler app. The first issue that I bumped up against is that file IO is very different in iOS-land (suspect the same for Android). That means that some of the nice R packages that make it much easier to parse and input .CSV files don’t really work. There also seem to be a capacity limitation of 128kB when I try to bring files in via other routes. Will invest a little more time playing around.


I don’t use R but I have used similar programs (Igor in particular) extensively, and I teach an introductory class about programming every year to our graduate students (who mostly have never programmed). In my experience trying to learn such a system on a phone is not a viable option. I think those phone apps are for experts that already know R very well and want to be able to process some data while away from their computers. But for learning from scratch, I VERY strongly encourage you to try to learn in a computer. It is hard enough already


Thanks for checking it out and the heads up. I think your right about using the computer. I’ll probably try both just so I make sure I mess something up somewhere.

Finally got the code to run on my iPad with the R Compiler App. But it took a lot of changes.

  • Due to the 128K input file limit, I had to move to a daily rather than hourly download from Sense, plus I had to seriously reduce the file size even for Jan-April by removing 70% of my devices (only kept the top 12 or so)
  • Had to give up on reading the data file in directly and do as the coder of this app recommends - read the data file into the In (stdin), then read.csv (in the code) from “stdin”. Typical R offers much more graceful access to data.
  • And forget about debugging on the iPhone/iPad - one error and the compiler craps out giving a cryptic message, with no indication of which line of code caused it.

The combination of code and datafile below should work on iPad/iPhone if you can get everything into the right place on your device.

SimplePlot2.R (2.2 KB)
Test2.csv (111.2 KB)

Here’s the output from my iPad…


Playing with the hourly version of the stacked bar. But for hourly, an area chart seems to work better.



@RyanAtSense I’ve seen requests for this feature in a number of posts, but, it most clearly described here. This is an incredibly valuable visualization for tracking down energy use. I am a green building consultant, and, versions of this graph are the baseline tools we use to explain loads to clients and target energy conservation measures. It is especially useful for behavioral ECMs. The bubbles are cute, though, I’m afraid, not actually all that useful. It seems to me this is a tiny bit of coding that would have a large impact on the user experience.


I really want this too. I would love to be able to use this to help identify some appliances, and to see what’s actually happening in the moment. On the web interface this is possible to do without too much effort and I use the web interface a lot more than the mobile interface.

Is anyone at Sense actually looking at this feature?


Any update on this possible feature?

1 Like

I am also extremely interested in a feature such as this. It would be so much more useful than the single-color Power Meter chart with just labels for when devices turn on and off. Even if it didn’t replace the Power Meter chart itself, I am sure I would use it as often or more often.

1 Like

If you want a substitute, at least to try, you can use this web app I cooked up. It takes either a monthly or yearly exported file from Sense, at “Day” resolution (not “Hour”) and converts it into these two graphs.

The link is here… Once in, just Browse to your exported / downloaded data file. LMK if you have any questions.

1 Like

@cjdickey36, your idea for replacing the Power Meter chart with the colorful chart caught my imagination! I know that implementing everything @kevin1 has done with R, from scratch into the Sense app, is a programmer’s nightmare. That won’t get traction from Sense, but the idea is still awesome!

A scaled back version is possible. All of us have an Always On bubble, so adding a second color which would plot that item across the bottom of the power meter graph might be a small enough lift to actually happen. Everyone also has an Other bubble, so that could be a third color which Sense might actually go for.

If colors on the graph are popular with users, the feature could be expanded later. Rather than checking which are the top items as Kevin did so nicely (which would be very difficult to code outside of R), they could allow the user to assign any one device to each of a short list of colors.

And if that were popular, the next expansion could be allowing colors to represent a category to which the user would assign multiple devices. Behold, a road map towards implementation of your idea!

Thanks for sharing this again, @kevin1. I’ve started getting enough data that seeing this trend is pretty actionable. First step - actually turning the smart plug on my roommates PS4 off…

1 Like