INDIGOplotD -- a plot tool for indigo

A Plugin to create Plots from INDIGO data and other sources
Devildog0331
Posts: 72
Joined: Wed Jan 22, 2014 11:44 pm
Location: Baton Rouge, LA

Re: INDIGOplotD -- a plot tool for indigo

Post by Devildog0331 »

Just an update... I blew all the old INDIGOplotD and SQL Logger settings out (pref files and all).. I even completely removed Indigo and reinstalled it.
I set up SQL Logger to use SQLite then installed version 2.6.1 of your plugin (even ran the install script for GNUPlot). Everything installed and configured without a hitch and I'm generating some plots Also... the plugin is running in Batch mode and plotting in MatPlot.

When you're ready to do some testing, I'll backup my files and we can figure it out. For now... my log is free of red text!!!

Enjoy the game!
--Richard
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 »

I found a convoluted problem, need to ask Matt

if I do

self.pluginPrefs["sqlLastID"] = "xxx"

in the config menu and then (after the statement in Configuration) in the runConcurrentThread (thats the endless loop that waits for anything to happen, I get 2 different results.


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/nzcb1lrknwhej ... 03-0-7.zip V 3-0-7

fixes:
1. MATPLOT picture size was sometimes too small.Its now the same size as GNUplot ( used integer to divide instead of float)
2. range went to automatic when the range had less than 4 characters i.e.: range = 3:9 was ignored, now the range is set correctly to low limit (X, or rightY or leftY) = 3 and high limit =9
3. a convoluted timing problem when data was written to indigo and when read back it was not properly refreshed when reading it - data stays sometimes several minutes old.
INDIGOplotD now circumvents that situation. This was leading to bad indexes and crashes.

added:
Single dots see attached plots. the same data is plotted many times, just shifted down with different DOT and LINE types and colors..

Not tested:
POSTGRE sql database.
Attachments
Screen Shot 2014-06-21 at 11.18.09 PM.png
Screen Shot 2014-06-21 at 11.18.09 PM.png (49.26 KiB) Viewed 6046 times
variable plot-S1-MAT.png
variable plot-S1-MAT.png (35.23 KiB) Viewed 6046 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/uv76diidjipus ... -3-1-0.zip Version 3.1.0

fixes:
-SQL import went into loop when a state of a device was used twice, i.e. as average and as max temperature.

NEW:

INDIGOplotD now has an INDIGO python interface.

version 3.1 has add the option to set or change (most) parameters from python code
here the function / methods available:


#first get the plugin object
plug = indigo.server.getPlugin("com.karlwachs.INDIGOplotD")

# here the calls:
plug.executeAction("addDeviceAndStateToSelectionList", props = dev123)
# this will make device / states available to be plotted, as soon as ta device/state is defined INDIGOplotD will start tracking its data
# it does the functions of the configuration menue

plug.executeAction("createOrModifyPlot", props =Plot123)
# this will create a plot, set size, background color scales etc.
# it is the the starting page of the plot device setup

plug.executeAction("createOrModifyLine", props =Line123)
# this will create the lines in the plot, select which avialble dat to plot, set color of line, width, dashed, solid dots etc.
# it is the function of the last part of the plot device configuration menue

plug.executeAction("createPlotPNG", props ={"deviceNameOfPlot": nameOfPlot})
# this will tell indigo to immediately create the PNG files for the requested PLOT, INDIGOplotD will recreate the PNG files every 5 minutes.

plug.executeAction("createAndShowPlotPNG", props ={"deviceNameOfPlot": nameOfPlot})
# this will tell indigo to immediately create the PNG files for the requested PLOT AND display them on the server monitor


#and to delete devices / plots /lines use:
plug.executeAction("deleteDeviceAndStateFromSelectionList", props = dev123)
plug.executeAction("deletePlot", props ={"deviceNameOfPlot" : nameOfPlot })
plug.executeAction("deleteLine", props ={"deviceNameOfPlot" : nameOfPlot , "lineNumber" :"1" })


Each function will set INDIGO variable: "INDIGOplotD-Script-Message" with a return code, you can check it in your python script
-"ok: and some text" is a positive result.
-"error: and some error info" indicates a failure, only the last message will be shown


Here the definitions of the props:

Code: Select all

dev123={
 "deviceOrVariable"					:deviceName  # the name of the device you would like to get the data from
 ,"state" :"setpointCool"       # device state eq temperatureInput1 ... 
 ,"measurement"						:"average"    # the measurement: average, max,min, count 
 }

Plot123={  
		   "deviceNameOfPlot"	: nameOfPlot		                # Plot Device Name
		  ,"PlotType"			:"dataFromTimeSeries"		# optional; default= ;dataFromTimeSeries, options: "dataFromFile"= name of data file in INDIGOplotD/data ,  dataFromVariable   name if INDIGO variable with data   
		  ,"Grid"				:"0"						# optional; default=0; options =1
		  ,"PlotFileOrVariName"	:""							# mandatory if PlotType = dataFromFile or dataFromVariable name of file in INDIGOplotD/data directory of name of indigo variable to be used as data source
		  ,"TitleText"			:"abcbac"					# optional; default=""; title on top of plot
		  ,"TextSize"			:"8"						# optional; default= 8; number of points in font
		  ,"TextMATFont"		:"sans-serif"				# optional; default= sans-serif; if MATPLOT is used, options= 	'sans-serif', 'serif', 'cursive', 'fantasy', 'monospace' , 
		  ,"TextFont"			:"Arial Unicode.ttf"		# optional; default= 0;  if GNUPLOT is used, default is 0=systemfont, options: use font name in /Library/Fonts/ eg:"Arial Unicode.ttf"
		  ,"TextColor"			:"#FF0000"					# optional; default= #000000  (black); HEX RGB color code, white=#FFFFFF, red=#FF0000
		  ,"Background"			:"255,255,255"				# optional; default= 255,255,255;  background color in red,green,blue format  numbers between 0 and 255  0,0,0 is black and 255,255,255 is white

		  ,"LeftScaleRange"		:"0:100"					# optional; default=0:100; ymin, ymax, leave blank for automode
		  ,"LeftScaleTics"		:"20,40,60,80,150"			# optional; default=0,20,40,60,80,100;  tick mark numbers on YLeft  scale
		  ,"LeftLabel"			:"this is y text"			# optional; default= "Temperature [ºF]";  
		  ,"LeftLog"			:"linear"					# optional; default=linear; linear or log
		  ,"LeftScaleDecPoints"	:"0"						# optional; default=0; number of dec point of tickmark numbers

		  ,"RightScaleRange"	:"00:200"					# optional; default= 0:200; ymin, ymax, leave blank for automode
		  ,"RightScaleTics"		:"0,20,40,60,80,100"		# optional; default=0,20,40,60,80,100; tick mark numbers on Y scale
		  ,"RightLog"			:"linear"					# optional; default=linear; linear or log, default linear scale
		  ,"RightLabel"			:"Humidty and ON-Time%      # optional; default="Humidty and ON-Time%          .";  text on right y axis
		  ,"RightScaleDecPoints":"0"						# optional; default= number of dec point of tickmark numbers

		  ,"XScaleDecPoints"	:"0"						# optional; default="" axis on if not PlotType == dataFromVariable or ==dataFromVariable
		  ,"XScaleRange"		:""							# optional; default="" auto range
		  ,"XScaleTics"			:""							# optional; default="" auto tics
		  ,"XLog"				:""							# optional; default= linear; linear or log
		  ,"XLabel"				:""							# optional; default= "" 
		  ,"XScaleDecPoints"	:"0"						# optional; default="" axis on if not Plottype == dataFromVariable or ==dataFromVariable
		  ,"XScaleFormat"		:""							# python / unix format string, up to programmer to use and set, eg %f , see eg: http://gnuplot.sourceforge.net/docs_4.2/node184.html

		  ,"resxy0"				:"850,350"					# optional; default= 850,350;  number of points for size 1 plot
		  ,"resxy1"				:""							# optional; default= 1024,768; number of points of size 2 plot, if "" , no plot of this size
		  ,"Textscale21"		:"1.2"						# optional; default= 1.2; if 2 size plot, scale font points up for second size plot
		  ,"MinuteBinNoOfDays"	:"3"						# optional; default= 2; number of days in minutes bins plot , if 0 this plot will not be created
		  ,"HourBinNoOfDays"	:"8"						# optional; default= 14; number of days in hour size bins, if 0 this plot will not be created
		  ,"DayBinNoOfDays"		:"90"						# optional; default= 390; number of days in Days size bins, if 0 this plot will not be created
		  ,"ampm"				:"24"						# optional; default= 24; 12 or 24;  use 0-24 or 0-12am 1-12pm	
		  ,"Raw"				:""							# optional; default= ""; raw gnuplot command inserted into gnuplot file just before the "plot using .. section, see .gnu files for position.
		}

Line123={
		 "deviceNameOfPlot"					: nameOfPlot			# same name as for plot
		,"lineNumber"						:"1"			# sequential line number; "1" will be plotted first, 2,3,4,5 ..  on top
		,"lineType"							:"solid"		# optional; default= "6";		options; 0=dashed line, 6= solid line, solid = filled block with solid color, Dot., DOT+, DOTx, DOT*, DOTo, DOTv, DOT^, DOTs = Solid Square
		,"lineWidth"			  			:"2"			# optional; default= "1";		value from 0-6
		,"lineColor"				  		:"#0000FF"		# optional; default= "#000000";	color of line in hex rgb code
		,"lineFunc"				  			:"None"			# optional; default= "None";	lineA lineFunc LineB  linefunc = +,-,*,/
		,"lineSmooth"						:"None"			# optional; default= ""None;	'bezier (strong smoothing), cspline2 (medium smoothing), csplines (weak smoothing)
		,"lineMultiplier"					:"20.0"			# optional; default= "1.0";		multiply data point with this factor
		,"lineOffset"						:"0.0"			# optional; default= "0.0";		add offset to data points , ie shift up or down
		,"leftRight"						:"x1y2"			# optional; default= "x1y1";	x1y1 or x1y2 , : this plot belongs to the left or right axis
		,"lineKey"							:"AC-ON"		# optional; default= "";		the key that goes on the legend for the lines

		,"deviceOrVariableToBePlottedLineA"	:"ThermostatDownstairs"	# data source: device name or variable name
		,"StateToBePlottedLineA"			:"hvacCoolerIsOn"		# state of device "deviceOrVariableToBePlottedLineA"
		,"MeasurementLineA"					:"average" 				# default=average; data source measurement to be used: average, max, min, count, eEnergy

#		,"deviceOrVariableToBePlottedLineB"	:"ThermostatDownstairs"	# and the same if 2 data points set to be combined with lineFunc
#		,"StateToBePlottedLineB"			:"hvacCoolerIsOn"
#		,"MeasurementLineB"					:"average" 

#		,"dataColumnForFileOrVariableA"		:"0"					# use if PlotType == dataFromFile or == dataFromVariable. it is the column for the line data, starts with 0 (x, y1,y2,y3..)
#		,"dataColumnForFileOrVariableA"		:"0"					# for second data set if lineFunc is used
		  }



example of a complete code to do a thermostat plot (name of thermostat device is ThermostatDownstairs):

just copy and past into a action group/device serveraction / script and replace
- ThermostatDownstairs with the name of your thermostat
- nameOfPlot ="DownstairsPlot"
with your names.


Code: Select all

deviceName="ThermostatDownstairs"  # <======= change this
nameOfPlot="ThermostatDownstairsPlot"  # <======= change this
plug = indigo.server.getPlugin("com.karlwachs.INDIGOplotD")
indigo.server.log("hallo1")
if not plug.isEnabled(): return
P1={ 
  "deviceNameOfPlot"	: nameOfPlot	# mandatory; Plot Device Name
 ,"PlotType"			:"dataFromTimeSeries" 	
 ,"Grid"				:"0"					
 ,"PlotFileOrVariName"	:""						
 ,"TitleText"			:"thermostate downstairs"
 ,"TextSize"			:"8"					
 ,"TextMATFont"			:"sans-serif" 			# if matplot is used
 ,"TextFont"			:"Arial Unicode.ttf"	# if GNUPLOT is used, 
 ,"TextColor"			:"#FF0000"				
 ,"LeftScaleRange"		:"0:100"				
 ,"LeftScaleTics"		:"20,40,60,80,100" 		
 ,"LeftLabel"			:"Temperature[ºF]"		
 ,"LeftLog"				:"linear" 				
 ,"LeftScaleDecPoints"	:"0"					
 ,"RightScaleRange"		:"00:200"				
 ,"RightScaleTics"		:"0,20,40,60,80,100" 	
 ,"RightLog"			:"linear"				
 ,"RightLabel"			:"Humidty and ON-Time%                     ."  
 ,"resxy0"				:"850,350"				
 ,"resxy1"				:""						
 ,"MinuteBinNoOfDays"	:"3"
 ,"HourBinNoOfDays"		:"8"
 ,"DayBinNoOfDays"		:"90"
 ,"Background"			:"255,255,255"	
 }

L1={
  "deviceNameOfPlot"				:nameOfPlot 
 ,"lineNumber"						:"1" 
 ,"lineType"						:"solid" 
 ,"lineWidth"			  			:"2" 
 ,"lineColor"				  		:"#0000FF" 
 ,"lineMultiplier"					:"20.0" # multiply data point with this factor
 ,"lineOffset"						:"0.0" 
 ,"leftRight"						:"x1y2" 
 ,"lineKey"							:"AC-ON" 
 ,"deviceOrVariableToBePlottedLineA": deviceName
 ,"StateToBePlottedLineA"			:"hvacCoolerIsOn" 
 ,"MeasurementLineA"				:"average" 
  }


L2 ={
 "deviceNameOfPlot"					:nameOfPlot
 ,"lineNumber"						:"2"
 ,"lineType"						:"solid"
 ,"lineWidth"			  			:"2"
 ,"lineColor"				  		:"#FF0000"
 ,"lineFunc"				  		:"None"
 ,"lineSmooth"						:"None"
 ,"lineMultiplier"					:"20.0"
 ,"lineOffset"						:"0.0"
 ,"leftRight"						:"x1y2"
 ,"lineKey"							:"HEAT-ON"
 ,"deviceOrVariableToBePlottedLineA":deviceName
 ,"MeasurementLineA"				:"average" 
 ,"StateToBePlottedLineA"			:"hvacHeaterIsOn"
  }


L3 ={
 "deviceNameOfPlot"					: nameOfPlot
 ,"lineNumber"						:"3"
 ,"lineType"						:"6"
 ,"lineWidth"			  			:"2"
 ,"lineColor"				  		:"#000000"
 ,"lineFunc"				  		:"None"
 ,"lineSmooth"						:"None"
 ,"lineMultiplier"					:"1.0"
 ,"lineOffset"						:"0.0"
 ,"leftRight"						:"x1y1"
 ,"lineKey"							:"Temp"
 ,"deviceOrVariableToBePlottedLineA":deviceName
 ,"MeasurementLineA"				:"average" 
 ,"StateToBePlottedLineA"			:"temperatureInput1"
  }

L4 ={
 "deviceNameOfPlot"					: nameOfPlot
 ,"lineNumber"						:"4"
 ,"lineType"						:"0"
 ,"lineWidth"			  			:"3"
 ,"lineColor"				  		:"#FF0000"
 ,"lineFunc"				  		:"None"
 ,"lineSmooth"						:"None"
 ,"lineMultiplier"					:"1.0"
 ,"lineOffset"						:"0.0"
 ,"leftRight"						:"x1y1"
 ,"lineKey"							:"setP.Heat"
 ,"deviceOrVariableToBePlottedLineA":deviceName
 ,"MeasurementLineA"				:"average" 
 ,"StateToBePlottedLineA"			:"setpointHeat"
  }

L5 ={
 "deviceNameOfPlot"					: nameOfPlot
 ,"lineNumber"						:"5"
 ,"lineType"						:"0"
 ,"lineWidth"			  			:"3"
 ,"lineColor"				  		:"#0000FF"
 ,"lineFunc"				  		:"None"
 ,"lineSmooth"						:"None"
 ,"lineMultiplier"					:"1.0"
 ,"lineOffset"						:"0.0"
 ,"leftRight"						:"x1y1"
 ,"lineKey"							:"setP.AC"
 ,"deviceOrVariableToBePlottedLineA":deviceName
 ,"MeasurementLineA"				:"average" 
 ,"StateToBePlottedLineA"			:"setpointCool"
  }



dev1={
 "deviceOrVariable"					:deviceName
 ,"state"							:"setpointCool" 
 ,"measurement"						:"average"  
 }
dev2={
  "deviceOrVariable"				:deviceName
 ,"state"							:"temperatureInput1"
 ,"measurement"						:"average"
 }
dev3={
  "deviceOrVariable"				:deviceName
 ,"state"							:"hvacHeaterIsOn"
 ,"measurement"						:"average"
  }
dev4={
  "deviceOrVariable"				:deviceName
 ,"state"							:"hvacCoolerIsOn"
 ,"measurement"						:"average"
  }
dev5={
  "deviceOrVariable"				:deviceName
 ,"state"							:"setpointHeat"
 ,"measurement"						:"average"
  }

plug.executeAction("addDeviceAndStateToSelectionList", props = dev1)
plug.executeAction("addDeviceAndStateToSelectionList", props = dev2)
plug.executeAction("addDeviceAndStateToSelectionList", props = dev3)
plug.executeAction("addDeviceAndStateToSelectionList", props = dev4)
plug.executeAction("addDeviceAndStateToSelectionList", props = dev5)


plug.executeAction("createOrModifyPlot", props =P1)


plug.executeAction("createOrModifyLine", props =L1)
plug.executeAction("createOrModifyLine", props =L2)
plug.executeAction("createOrModifyLine", props =L3)
plug.executeAction("createOrModifyLine", props =L4)
plug.executeAction("createOrModifyLine", props =L5)



#plug.executeAction("createPlotPNG", props ={"deviceNameOfPlot": nameOfPlot})
plug.executeAction("createAndShowPlotPNG", props ={"deviceNameOfPlot": nameOfPlot})




And here an example that creates a plot from data in a variable:

Code: Select all

plug = indigo.server.getPlugin("com.karlwachs.INDIGOplotD")
if not plug.isEnabled(): return
devname="variablePlot"  # <======= change this
variableName = "testVariable"  # <======= change this
dataToBePlotted="#x;y1;y2|2;3;4|4;5;4|6;3;5|7;5;6|"  # please note the "#" at the beginning of the variable

try:
	indigo.variable.create(variableName, dataToBePlotted)
except:
	indigo.variable.updateValue(variableName, dataToBePlotted)


P1={	"deviceNameOfPlot"		:devname	
		,"PlotType"				:"dataFromVariable"
		,"PlotFileOrVariName"	: variableName
		,"TitleText"			:"variable plot"
		,"TextSize"				:"8"
		,"TextFont"				:"Arial Unicode.ttf"
		,"TextColor"			:"#FF0000"	
		,"Background"			:"255,255,255"
		,"LeftLabel"			:"this is y1"
		,"LeftScaleRange"		:"0:10"
		,"RightScaleRange"		:"0:10"
		,"LeftScaleTics"		:"0,1,2,3,4,5,6,7"
		,"RightScaleTics"		:"0,1,2,3,4,5,6,7"
		,"RightLabel"			:" "
		,"XScaleRange"			:"0:10"
		,"XLog"					:"linear"
		,"XLabel"				:"this is the x label"
		,"XScaleDecPoints"		:"0"
		,"XScaleTics"			:"0,1,2,3,4,5,6,7,8,9"
		,"XScaleFormat"			:""				
		,"resxy0"				:"850,350"				
		,"resxy1"				:"000"				
		}

L1={
		  "deviceNameOfPlot"				:devname
		  ,"lineNumber"						:"1"	
		  ,"lineType"						:"6"	
		  ,"lineWidth"			  			:"2"	
		  ,"lineColor"				  		:"#0000FF"	
		  ,"lineFunc"				  		:"None"	
		  ,"lineSmooth"						:"None"		
		  ,"lineMultiplier"					:"1.0"	
		  ,"lineOffset"						:"0.0"	
		  ,"leftRight"						:"x1y1"	
		  ,"lineKey"						:"number1"
		  ,"dataColumnForFileOrVariableA"		:"1"
		  }
L2={
		  "deviceNameOfPlot"				:devname		
		  ,"lineNumber"						:"2"		
		  ,"lineType"						:"0"		
		  ,"lineWidth"			  			:"3"		
		  ,"lineColor"				  		:"#FF00FF"		
		  ,"lineFunc"				  		:"None"		
		  ,"lineSmooth"						:"None"		
		  ,"lineMultiplier"					:"1.0"		
		  ,"lineOffset"						:"0.0"		
		  ,"leftRight"						:"x1y1"		
		  ,"lineKey"						:"number2"
		  ,"dataColumnForFileOrVariableA"	:"2"
		  }
L3={
		  "deviceNameOfPlot"				:devname		
		  ,"lineNumber"						:"3"		
		  ,"lineType"						:"DOTo"		
		  ,"lineWidth"			  			:"2"		
		  ,"lineColor"				  		:"#00FFFF"		
		  ,"lineFunc"				  		:"+"		
		  ,"lineSmooth"						:"None"		
		  ,"lineMultiplier"					:"1.0"		
		  ,"lineOffset"						:"0.0"		
		  ,"leftRight"						:"x1y1"		
		  ,"lineKey"						:"number1+2"
		,"dataColumnForFileOrVariableA"		:"1"
		,"dataColumnForFileOrVariableB"		:"2"
		  }

plug.executeAction("createOrModifyPlot", props =P1)

plug.executeAction("createOrModifyLine", props =L1)
plug.executeAction("createOrModifyLine", props =L2)
plug.executeAction("createOrModifyLine", props =L3)
#plug.executeAction("createPlotPNG", props ={"deviceNameOfPlot":devname})
plug.executeAction("createAndShowPlotPNG", props ={"deviceNameOfPlot":devname})



the 2 example codes will produce the attached plots.

I have tested a number of scenarios, but there are likely still some combinations that will create error. Anyway hope its useful


Karl
Attachments
ThermostatDownstairsX-hour-S1.png
ThermostatDownstairsX-hour-S1.png (5.81 KiB) Viewed 6016 times
variablePlot-S1.png
variablePlot-S1.png (4.35 KiB) Viewed 6016 times
gtreece
Posts: 171
Joined: Mon Sep 26, 2011 6:01 pm

Re: INDIGOplotD -- a plot tool for indigo

Post by gtreece »

Thanks for this great plugin. Got off to an easy and good start. I did run into a couple snags:

1) Same as mat from the previous thread, if I try to use gnuplot, it tells me that it's not configured correctly for fonts, and plots do not generate. I do have gnuplot installed, and can type 'gnuplot' in terminal to launch it. I can even manually run gnuplot from the terminal, referencing one of the indigoplotd .gnu files, and it creates the plot. But no matter what I do, if I have gnuplot selected in the indigoplotd configuration, it will not update the plots. If memory serves, I installed gnuplot with macports when I had 10.8 on the indigo machine. It is in /opt/local/bin, and I have been using it for a while through script files to produce the plots I need for my control pages. It's been working fine, even selecting different fonts. I'm currently running 10.9.4 on the indigo server.

I was fixated on gnuplot, because I want a transparent background on my plots, and know how to do that in gnuplot. I added the 'set term png transparent truecolor' raw command in expert mode, which did appear in the .gnu files created by the plugin, and when I manually plotted one of those, it did produce a transparent background. Since the plugin is not working with gnuplot, however, I'm not getting plots.

So 2) I switched indigoplotd to use matplot instead of gnuplot. The plots started updating immediately, and appear to be working correctly. However, I don't know how to get a transparent background with matplot. I have read that when you are saving the image, you can use a 'transparent=true' switch, but I can't tell that I can enter that anywhere with the plugin.

Thanks for any insight you can provide on getting a transparent background with matplot.
"Opaque in Nevada"
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 »

transparent has been on my to do list.. will check into it..

as for gnuplot refusing to start, it tries to use fancy fonts, if it does not work it thinks gnu plot is not installed.

the supplied gnu plot install is enabling the fancy fonts look at the bottom of the help.pdf if you want to install gnu plot manually with fonts.

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

Re: INDIGOplotD -- a plot tool for indigo

Post by gtreece »

If by fancy fonts, you mean the ability to use ttf font faces, I can do that from the command line in gnuplot. My current scripts utilize ttf fonts because I didn't like the appearance of the default system fonts when I first installed it.

How does the plugin check for fancy font support? Maybe that will help? I remember some bits and pieces from the install, centered around where GD looked for fonts when you installed gnuplot through macports. Too long ago to remember details, but I think I either had to specify full paths to font files, or change an environment path variable or something.

Since gnuplot is already installed and working through my scripts, I'd prefer not to re-install it, and also add brew to the mix. I can always keep doing charts the way I have been if I can't figure it out in the plugin.
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 »

do you want to have the background transparent or the "filled blocks/ histograms?"

I tried the transparent lines (truecolor etc) , and the plots do not look different...
how do you know that the background is transparent.. do you have to insert in to another document??
gtreece
Posts: 171
Joined: Mon Sep 26, 2011 6:01 pm

Re: INDIGOplotD -- a plot tool for indigo

Post by gtreece »

If I open a png in Preview, I get a kind of gray background color, rather than white. The Finder quick preview still shows it white, so have to open it to be sure. I will try to attach a screen grab of what I see when I open a plot image in Preview. I lay the png images on top of other elements in my control pages, so I need the background to be transparent. When I run my scripts, I do that with this:

'set term png transparent truecolor'

transparent only works with truecolor, so you have to specify it for the transparency to work.

I did test this with your plugin, by putting the above in the raw gnuplot command field. I verified that the generated .gnu file contained it, and then fed it to gnuplot manually in terminal. It generated the plot correctly, including a transparent background.

So it's just that for whatever reason, your plugin can not detect that my gnuplot install is fully functional.
Attachments
testplot.png
testplot.png (157.3 KiB) Viewed 5980 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 »

i have the transparent working in gnu plot. But when inserted e.g. into a word doc it becomes white!

will include the option into the PLOT menu. will take me a day. will also do it for matplot

as for gnu plot not being recognized: will look into the code this evening..



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

Re: INDIGOplotD -- a plot tool for indigo

Post by gtreece »

Great news! Thanks!

Also, I have not tested it, but I believe that transparency capability was added to linecolor at some point, with the following syntax:

lc rgb "#AARRGGBB"

Where AA is the alpha or transparency channel. So 'lc rgb "#77000000" would produce a transparent black line.

With fills, I believe transparency is handled with a style, like:

'set style fill transparent solid 0.5'

You would still need to have a terminal type set that supports transparency. I have only ever seen the fill transparency on filled curves. I don't know if it works on all fills or not.
gtreece
Posts: 171
Joined: Mon Sep 26, 2011 6:01 pm

Re: INDIGOplotD -- a plot tool for indigo

Post by gtreece »

I just did a quick test, and manually edited one of your .gnu files produced by the plugin. I added a transparent condition to one of the fillsteps:

using 1:((($13)*(5.0)+(0.0)) ) with fillsteps fill transparent solid 0.5 linewidth 1 linecolor rgb "#0000A0" title "AC On" axis x1y2\

And it worked great, to make the fill transparent. I also tested by adding a set style:

set style fill transparent solid 0.5

and that worked as well, leaving the fillsteps to it's original syntax. The fill style took over.

Lines do not appear to be as simple. It appears to depend on terminal type, as to whether or not the rgb"#AARRGGBB" format works. It doe snot appear to work for the png terminal type.
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 »

got the transparency ...

as for gnuplot not working... could you post the exact error message with fonts .. ?


here the code that test fonts . but it does not stop. its just a warning that true type fonts are not available

Code: Select all

	########################################
	def testFonts(self):
		try:
			f= open( self.indigoPlotDataDir+"temp/test.gnu" , "w")
			f.write('set terminal png enhanced medium  font "/Library/Fonts/Arial Unicode.ttf" 12   size 800,350 dashlength 0.5 \n')
			f.close()
		except:
			self.logMessage(u"fatal error, can not create files in indigoplot directory, stopping ",0 )
			self.quitNOW =True
			return
		if self.gnuORmat =="mat": return  # no more if we do matplot
		
		ret=subprocess.Popen("'/usr/local/bin/gnuplot' "+  self.indigoPlotDataDir+"temp/test.gnu",shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate()[1]
		if len(ret) > 10:
			self.logMessage(' gnuplot is not installed with proper font support, please select option "(re)INSTALL gnuplot.. or TrueTypeFonts will not be available"',1 )

		try:
			os.remove(self.indigoPlotDataDir+"temp/test.gnu")  # and clean up
		except:
			end
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 »

i am out for 2+ hours . will continue later.
gtreece
Posts: 171
Joined: Mon Sep 26, 2011 6:01 pm

Re: INDIGOplotD -- a plot tool for indigo

Post by gtreece »

If I change from matplot to gnuplot, I get a message that gnuplot is not installed and check the readme. If I then reload the plugin, I get that error message again, as well as the not installed with proper fonts message:

INDIGOplotD Error ------------------------------------
INDIGOplotD Error gnuplot not installed please check readme file for how to install gnuplot
INDIGOplotD Error ------------------------------------
INDIGOplotD gnuplot is not installed with proper font support, please select option "(re)INSTALL gnuplot.. or TrueTypeFonts will not be available"
INDIGOplotD initializing ...2

That is the only error message I've seen, but the plots stop generating as soon as I do that.

I can open terminal, launch gnuplot, and paste in the set term command you use, and it works fine. What I notice, however, is that you are specifying a full path for gnuplot, /usr/local/bin/gnuplot, that is not where my gnuplot is. Mine is at /opt/local/bin, which is where macports puts stuff I think:

hac:local user$ which gnuplot
/opt/local/bin/gnuplot

I should be able to make a link for it in that location, so that /usr/local/bin/gnuplot would be valid. I'll give that a shot.
Post Reply

Return to “INDIGOplotD”