INDIGOplotD -- a plot tool for indigo

A Plugin to create Plots from INDIGO data and other sources
gtreece
Posts: 171
Joined: Mon Sep 26, 2011 6:01 pm

Re: INDIGOplotD -- a plot tool for indigo

Post by gtreece »

Bingo!

I created a symbolic link to match the full path you're using in your code, and gnuplot started working in the plugin.

sudo ln -s /opt/local/bin/gnuplot /usr/local/bin/gnuplot

The error messages went away when I reloaded the plugin, and the plots seem to be updating every 5 minutes now.
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: INDIGOplotD -- a plot tool for indigo

Post by kw123 »

cool,

just a question, why is your gnuplot in the ..opt.. directory?

I have installed mine with home-brew. may be thats it. i can add that directory as a test
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: INDIGOplotD -- a plot tool for indigo

Post by kw123 »

another question, can you use the truetype fonts with the transparent terminal line i.e.

set terminal ..... font "/Library/Fonts/Arial Unicode.ttf" 8 .... size 850,350 dashlength 0.5 background rgb "#C8C8C8"

in other words, do I need to change the ---- font "/Library/Fonts/Arial Unicode.ttf" 8 -- statement for your gnuplot implementation?

thanks

Karl
gtreece
Posts: 171
Joined: Mon Sep 26, 2011 6:01 pm

Re: INDIGOplotD -- a plot tool for indigo

Post by gtreece »

I believe I originally installed gnuplot with 'macports', and I am pretty sure that macports uses /opt/local as the default install location. With the variety of ways to get gnuplot installed, it might be safer if your code detected where it was installed, rather than assume a location? Besides homebrew and macports, some might use fink, or receive the gnuplot binaries via another package like octave or maxima

I didn't have any problem with the font in the set term statement. I copied the statement out of your code post, and pasted into terminal to test it as-is.

Besides whether or not gnuplot is correctly installed with ttf font support, it is also possible I guess, that version could play a factor in the success of that statement. As I noted earlier, I recall something about fonts, and where gd was installed and where gd was looking for fonts, as all playing a factor in getting gnuplot working correctly with ttf fonts initially. I just don't recall the details at this point. Lots of portage package installs are harder on OS X than they are on Linux, due to location and library challenges.

Thanks for your prompt responses today. Definitely got enough info to get past the hurdle I hit.
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: INDIGOplotD -- a plot tool for indigo

Post by kw123 »

thanks

added in the next release:
1. transparent background option (gnu and matplot)
2. transparent "blocks/histograms" (transparency: 0-1 i.e. fully transparent, 50%, or not ) (gnu and matplot)
3. checking for the 2 locations of gnuplot... works for the time being.. will add general search later

also added:
- FULL (change mod add delete) access to ALLLL parameters from python code in actions or in plugins. can set plots, devices, lines parameters , create PNG files, show png files on screen
- creating a python file that will replicate all your plots and settings if run in e.g. an action group action
you could use it to duplicate plots e.g. for second thermostat and just change the parameters you like to adapt. etc. or as a backup if you delete plots by accident
this is actually easier than using the interface if you know a tiny little py coding ( just when anyhow much to indent & how to use quotes) .. just the basics,,... mostly just copy and paste and change the parameters

still testing for one more day.

Karl
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: INDIGOplotD -- a plot tool for indigo

Post by kw123 »

https://www.dropbox.com/s/y13eso0vbgrze ... -3-2-2.zip V 3-2-2

fixed:
-gnuplot path if installed in different directory
it looks for /usr/local/bin/gnuplot and /opt/local/bin/gnuplot If you have a different installation enter it in the config menu

added
- transparent background for gnuplot AND matplot e.g. if your iPad page has its own color schema you like to use.
- transparent histogram blocks for gnuplot AND matplot so that lines can shine through the histogram blocks
- added full exposure of all parameters to python calls, you can define plots, lines, show plots, delete lines,plots ...
- added recovery python file. If you (or the program) screws up, run that file in an action and ALL plots / parameters etc will be restored (a version at each midnight or last restart of plugin will be kept in .../INDIGOplotD/py)

The included PDF has 30+pages of "how to" and examples.

happy plotting

Karl
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: INDIGOplotD -- a plot tool for indigo

Post by kw123 »

a neat little trick that works with gnu plot

in the rightY label field enter "off" 20, "on" 50 with the quotes

that will show off and on at the positions of 20 and 50 on the right y axis.
then add an offset =20 to on/off states (like AC on) and a multiplier = 30 ,

that will show your AC data on/off at the hight of labels "on" and "off".

only works with gnu plot right now..

have to think how to best do that one for matplot
there the syntax is a little bit different, needs 2 sets of data like this:
ax.set_yticks([0.2, 0.4, 0.8])
ax.set_yticklabels(['first', 'second', 'third’])
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: INDIGOplotD -- a plot tool for indigo

Post by kw123 »

https://www.dropbox.com/s/5mlaabgxc3l1z ... -3-2-3.zip V 3-2-3

text labels now work for GNUPLOT and MATPLOT:

with

RIGHT SCALE... tick Marks = " 0 off"0,"20" 20,"40 ON"40,"60"60,"80"80,"100"100
and Multiplier = 40 for AC-ON and Heat-ON

you get the attached plot in gnuplot and matplot


Karl

syntax is: "text to be shown"number,"text to be shown2"number2, ...
Attachments
ThermostatDownstairsPlot-day-S1.png
ThermostatDownstairsPlot-day-S1.png (67.72 KiB) Viewed 6382 times
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: INDIGOplotD -- a plot tool for indigo

Post by kw123 »

https://www.dropbox.com/s/jxypq9pdeipm2 ... -3-2-5.zip v 3-2-5

fixes:
- plots for variables and file data were not always consistently handled (entered through menu or python interface)
- consistent transparency settings for gnuplot and matplot
- text settings for x-axis tick mark setting for file and variable plots
- quotes for quoted quoted input text handled now correctly in the generated python interface example output -- not every one will be using this... :?
- improved python backup - recreate setup file

worked a lot on the documentation (PDF file) - a lot of examples, how to's etc.

this will be the "official" release to be posted on the INDIGO download site.


Karl
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: INDIGOplotD -- a plot tool for indigo

Post by kw123 »

coming soon: polar plots for e.g. wind speed vs direction
Attachments
WindSpeedNOAA lovefield -day-S1.png
WindSpeedNOAA lovefield -day-S1.png (82.36 KiB) Viewed 6325 times
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: INDIGOplotD -- a plot tool for indigo

Post by kw123 »

just have to solve the question of average direction: assume 5+355+0 degrees should give 0 degrees, but simple math is 360/3= 120...

The formulas are somewhat clear . there is a lot of discussion on the web around this..

but if you take wind speed into account things get really difficult: e.g.
1. measurement is 0 degree 0 wind speed
2. measurement is 90degrees at 100Mph

is the average direction 90 or 45 degrees?

...

Karl
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: INDIGOplotD -- a plot tool for indigo

Post by kw123 »

https://www.dropbox.com/s/qcgjlrj1ts4rs ... -3-3-1.zip V 3-3-1

fixes:
- some more input error controls

added
- Polar plots
- completed python interface


copy and paste this code int an action in an action group and replace 'NoaPlusLoveField' in 3 places with the name of your NOAA station in your NOAA plugin.
You might want to change the text for title and plot name too.
Then click on run the the plot shall be produced.

Code: Select all

plug = indigo.server.getPlugin("com.karlwachs.INDIGOplotD")
if not plug.isEnabled(): return   #### INDIGOplotD must be enabled, otherwise nothing here works
plot4={
  "deviceNameOfPlot"     : 'WindSpeedNOAA lovefield'
 ,"PlotType"             : 'dataFromTimeSeries'  ### dataFromTimeSeries  dataFromFile  dataFromVariable
 ,"XYvPolar"             : 'polar'  ### xy plot ot polar plot
 ,"Grid"                 : '1'                 ### options:  0=no 1=dashedBack 2=solidBack 3=thickSolidBack -1=thinFront -2... -3... 
 ,"PlotFileOrVariName"   : ''       ### Name of variable of filename if PlotType = dataFromFile or dataFromVariable  
 ,"TitleText"            : 'NOAA Windspeed vs Direction'     ### text that goes on the top of the plot
 ,"TextSize"             : '10'                       ### font size  
 ,"TextMATFont"          : 'sans-serif'               ### if MATPLOT font name:  sans-serif  serif  cursive  fantasy  monospace 
 ,"TextFont"             : ''                         ### if GNUPLOT name of font from  /Library/Fonts/  eg Arial Unicode.ttf 
 ,"TextColor"            : '#4B0082'                  ### #FFFFFF ... #000000 or 255,255,255 format for RGB color intensities
 ,"LeftLabel"            : 'N-0,30,60,E-90,120,150,S-180,210,240,W-270,300,330'  ## text onring around the polar aixs eg 
##                                              >>N,E,S,W<<  (just 4 labels for top/right/bottom/left)  
###                                          or >> , , , , , , , , , , , << to remove all labels on the ring (11 , and 12 spaces)
 ,"XScaleRange"          : '1:100'
 ,"XScaleTics"           : ' "2"2,"5"5,"10"10,"20"20,"50"50,"100"100'  # these are the tick marks on the radial axis you can put any text in the “”
        ###                                         use >> , , , , , , , , , , , << to remove all labels on the ring (11 , and 12 spaces)
 ,"XLog"                 : 'log'
 ,"XLabel"               : ' [mph]'
 ,"XScaleDecPoints"      : '0'
 ,"XScaleFormat"         : '%.0f'                ### python / c .. format string for x axis
 ,"resxy0"               : '600,600'             ### x,y  number of dots in x and y  for plotsize 1
 ,"resxy1"               : '1024,1024'           ### x,y  number of dots in x and y  for plotsize 2
 ,"MinuteBinNoOfDays"    : '8'                   ### number of days for MINUTE size bins 0-14
 ,"HourBinNoOfDays"      : '38'                  ### number of days for HOUR size bins 0-39
 ,"DayBinNoOfDays"       : '190'      ### number of days for DAY size bins 0-390
 ,"Background"           : '#E0E0E0'          ### #FFFFFF ... #000000 or 255,255,255 format for RGB color intentities
 ,"TransparentBlocks"    : '1.0'          ###  for histogram, set 0= fully transparent ... 1 = not transparent 
 ,"TransparentBackground": '1.0'           ### 1.0 = not transparent, 0.0 = transparent, No color is used for background; Default=1.0
 }
plug.executeAction("createOrModifyPlot", props =plot4)

line1P4={
   "deviceNameOfPlot"                  : 'WindSpeedNOAA lovefield'
  ,"lineNumber"                        : '1'      ### 1 2 3 4 5 ...
  ,"lineType"                          : 'DOT.'        ###  LineSolid LineDashed DOT(* + v ^ s o .)  Histogram
  ,"lineKey"                           : 'Average'    ## text for line keys in plot 
  ,"lineWidth"                         : '5'       ###  0 1 2 3 4 5 
  ,"lineColor"                         : '#000000'        ### #FFFFFF ... #000000 or 255,255,255 format for RGB color intentities
  ,"lineMultiplier"                    : '1.0'         ### number to be multiplied to data
  ,"lineOffset"                        : '0.0'        ###  off of data or shift datapoint up or down
  ,"lineLeftRight"                     : 'Left'        ### use left or right Y scale
  ,"lineSmooth"                        : 'None'       ###  None strong medium week smmoth 
  ,"deviceOrVariableToBePlottedLineA"  : 'NoaPlusLoveField'  # device name of data source
  ,"StateToBePlottedLineA"             : 'windMPH'  # see "list available states" section to pick the right state
  ,"MeasurementLineA"                  : 'average'  # options: average sum min max count eEnergy
  ,"lineFunc"                          : 'None'            # the operation to be applied between lineA and lineB   + - * / None
  ,"deviceOrVariableToBePlottedLineB"  : 'NoaPlusLoveField'
  ,"StateToBePlottedLineB"             : 'windDegrees'
  ,"MeasurementLineB"                  : 'average'
 }
plug.executeAction("createOrModifyLine", props =line1P4)

line2P4={
   "deviceNameOfPlot"                  : 'WindSpeedNOAA lovefield'
  ,"lineNumber"                        : '2'      ### 1 2 3 4 5 ...
  ,"lineType"                          : 'DOT*'        ###  LineSolid LineDashed DOT(* + v ^ s o .)  Histogram
  ,"lineKey"                           : 'Gust'    ## text for line keys in plot 
  ,"lineWidth"                         : '1'       ###  0 1 2 3 4 5 
  ,"lineColor"                         : '#FFFF00'        ### #FFFFFF ... #000000 or 255,255,255 format for RGB color intentities
  ,"lineMultiplier"                    : '1.0'         ### number to be multiplied to data
  ,"lineOffset"                        : '0.0'        ###  off of data or shift datapoint up or down
  ,"lineLeftRight"                     : 'Left'        ### use left or right Y scale
  ,"lineSmooth"                        : 'None'       ###  None strong medium week smmoth 
  ,"deviceOrVariableToBePlottedLineA"  : 'NoaPlusLoveField'  # device name of data source
  ,"StateToBePlottedLineA"             : 'windGustMPH'  # see "list available states" section to pick the right state
  ,"MeasurementLineA"                  : 'max'  # options: average sum min max count eEnergy
  ,"lineFunc"                          : 'None'            # the operation to be applied between lineA and lineB   + - * / None
  ,"deviceOrVariableToBePlottedLineB"  : 'NoaPlusLoveField'
  ,"StateToBePlottedLineB"             : 'windDegrees'
  ,"MeasurementLineB"                  : 'average'
 }
plug.executeAction("createOrModifyLine", props =line2P4)

line3P4={
   "deviceNameOfPlot"                  : 'WindSpeedNOAA lovefield'
  ,"lineNumber"                        : '3'      ### 1 2 3 4 5 ...
  ,"lineType"                          : 'DOTo'        ###  LineSolid LineDashed DOT(* + v ^ s o .)  Histogram
  ,"lineKey"                           : 'Max'    ## text for line keys in plot 
  ,"lineWidth"                         : '1'       ###  0 1 2 3 4 5 
  ,"lineColor"                         : '#FF0000'        ### #FFFFFF ... #000000 or 255,255,255 format for RGB color intentities
  ,"lineMultiplier"                    : '1.0'         ### number to be multiplied to data
  ,"lineOffset"                        : '0.0'        ###  off of data or shift datapoint up or down
  ,"lineLeftRight"                     : 'Left'        ### use left or right Y scale
  ,"lineSmooth"                        : 'None'       ###  None strong medium week smmoth 
  ,"deviceOrVariableToBePlottedLineA"  : 'NoaPlusLoveField'  # device name of data source
  ,"StateToBePlottedLineA"             : 'windMPH'  # see "list available states" section to pick the right state
  ,"MeasurementLineA"                  : 'max'  # options: average sum min max count eEnergy
  ,"lineFunc"                          : 'None'            # the operation to be applied between lineA and lineB   + - * / None
  ,"deviceOrVariableToBePlottedLineB"  : 'NoaPlusLoveField'
  ,"StateToBePlottedLineB"             : 'windDegrees'
  ,"MeasurementLineB"                  : 'average'
 }
plug.executeAction("createOrModifyLine", props =line3P4)
this will produce the following plot:
Attachments
WindSpeedNOAA lovefieldBB-day-S1.png
WindSpeedNOAA lovefieldBB-day-S1.png (94.85 KiB) Viewed 6326 times
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: INDIGOplotD -- a plot tool for indigo

Post by kw123 »

https://www.dropbox.com/s/1e51ebrtsm42y ... -3-3-3.zip v3-3-3

added systematic way to select polar coordinates in radians or degrees, and "0" starting at North clockwise(compass) or at east counter clockwise(math convention)
It is done at time of selection the data source, see attached screen shot.

In general if you have wind or coordinates you likely have the compass convention.
- oregon wind sensor, NOAA info, ..
Iif you have math instruments you likely have math convention (have not found an example yet)


Karl
Attachments
Screen Shot 2014-07-23 at 11.31.58 AM.png
Screen Shot 2014-07-23 at 11.31.58 AM.png (61.8 KiB) Viewed 6294 times
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: INDIGOplotD -- a plot tool for indigo

Post by kw123 »

https://www.dropbox.com/s/7bcrm6pl0sjvi ... -3-3-4.zip V 3-3-4 production release.

fixes:
- after polar plot was introduced some fields in the menus did not show up properly (time format:am/pm and y-scale chooser:left/right)

improved:
- fixed typos in the menus
- added some more tool tips..
- completed examples and corrected typos etc in the documentation PDF file.


Karl
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: INDIGOplotD -- a plot tool for indigo

Post by kw123 »

https://www.dropbox.com/s/qmeogra801i8b ... 5.zip?dl=0 v 3-3-5

fixed:
for plots with:
- POLAR coordinates
- with data from DEDICATED data files (not devices or variables)
- in GNUPLOT (*):
png (plot) files were not created. The files names where composed incorrectly in the program.


Karl

(*) problem with gnuplot only. Was correct with matplot.
Post Reply

Return to “INDIGOplotD”