Jump to content
We've recently updated our Privacy Statement, available here. ×

Ironpython script to export marked data points from a scatter plot

Chung-Kan Huang

Recommended Posts


I would like to export many scatterplots to files (only marked points). I can do it by first marking the points I want onone of thescatter plots, then go toFile->Export->Data to File and then Export data from the selected Visualization with data for makred items. But I have repeat this for many plots and many times.

I wonder if anyone can provide a Ironpyton script example for exporting marked data points from a scatter plot



Link to comment
Share on other sites

Hi There,

This script should be your starting point:


Then it should just be possible to export to a CSV by writing out to a text file by extracting the relevant parts of this script:


Andrew Berridge, TIBCO Data Science

Link to comment
Share on other sites

Hi Andrew,I am trying to adapt the extracting crosstable script to my scatter plots.forvis_sctterplot.As[VisualContent]().ExportText(writer) # vis_scatterplot is from script paramtersI got C:UserschunghAppDataLocalTemptmp90C0.tmp

Traceback (most recent call last):

  File "<string>", line 23, in <module>

AttributeError: 'ScatterPlot' object has no attribute 'ExportText'

System.MissingMemberException: 'ScatterPlot' object has no attribute 'ExportText'

   at IronPython.Runtime.Binding.PythonGetMemberBinder.FastErrorGet`1.GetError(CallSite site, TSelfType target, CodeContext context)

   at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)

   at Microsoft.Scripting.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)

   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)

   at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)

   at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)

   at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)

   at Spotfire.Dxp.Application.IronPython27.IronPythonScriptEngine.ExecuteForDebugging(String scriptCode, Dictionary`2 scope, Stream outputStream)

Link to comment
Share on other sites

You cannot call the export text method on a scatter plot. It only works on cross tables. You need to iterate over the marked rows in the data table, as provided by the first script, then adapt the second script to write out to a CSV, iterating over the rows.





Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...