Jump to content
Geochemist's Workbench Support Forum

P2Plot data output


Recommended Posts

Hi GWB folks,

I'm using Phase2 and P2plot to make solubility plots for several Fe(II) minerals, and am wondering if there is a way to output the data from an assemblage map or a predominance area plot to Excel or another plotting program. It appears to me that the "Edit->Copy As -> text (space delimited)" option is greyed out for P2plot.

In the past I've used output from Visual Minteq and our plotting program of choice (Igor Pro) to make plots like this. We recently published several of these in a paper. I've attached a figure to show what I'm talking about. These plots represent equilibrium Fe(II) solubility in the presence of Fe(OH)2 and thus are not a true predominance area or assemblage map.

Ideally I'd like to be able to run a Phase2 calculation and export traces from a P2plot of the assemblage map to Igor Pro. There are many reasons I have for this, but probably greatest among them is that that program allows much finer control over fine tuning of plot styles. (For example a major pet peeve of mine is that the y-axis of a P2plot has value labels of ".01, .1, etc." rather than "0.01, 0.1" etc.

Is this a planned feature? Is there any way to kluge a work around for the time being? I've tried running a similar calculation in React, but it doesn't do predominance area or assemblage maps.


Drew Latta

University of Iowa

Dept. Civil & Environmental Eng.



Link to comment
Share on other sites

Hi Drew,

With the 2D diagrams in P2plot (and map view plots in Xtplot), you can assign a variable to be rendered across the 2D grid as a color map or contour plot. The “Copy as text/spreadsheet” options will output a table of numerical values for the variables chosen. The most common usage is to perform some additional calculation with the data in Excel, but you can also pass the data to other programs for plotting. The predominance area diagram simply displays the predominant species at each point, and the mineral assemblage diagram the names of one or more minerals that exist at each point, so I’m not sure exporting the name or names at each point would be useful. You could, however, make a color map of your mineral of interest. In that case, you’d be able to produce a table with empty spaces where the mineral doesn’t exist, and some finite value where it does. Would that be useful? As for outputting the position of bounding lines, we don’t currently have any plans to do so.

On the other hand, for simple modifications like adding a 0 before .1, you could copy the plot as an enhanced metafile and paste into PowerPoint, where you can ungroup the image and edit the text boxes as you like. Or, you can copy as an .ai file and work with the plot in Adobe Illustrator the same way. I’m not sure if Igor Pro accepts those file types, but you can also save the image (File > Save Image…) in a few other formats, such as .svg or .ps. 

Is this helpful at all?


Brian Farrell
Aqueous Solutions

Link to comment
Share on other sites

Hi Brian,

I am guessing that the y-axis (staging path) step size is not fixed? Is there a way to fix it, even if it computationally a bit expensive? The reason I ask is that Igor uses a data structure called a "wave" which can be defined as a y-axis variable with a fixed x-axis step size. A 2-D array could have a scale (step size) for x- and y-axes. It looks like to me that the x-axis (scanning path) is to be fixed - for example a pH step size of 0.1.

I'm not fluent at programming in anything, but I guess I would need to write a function that steps through an array of Q/K for each x- and y-axis value and assigns the first instance of Q/K = 0 for each column (pH value) to a row value (Fe(II) concentration). This can be done in Igor or any other programming language. I was just hoping that GWB could output this for me, since it is already doing something nearly close to this to plot a assemblage map.



Link to comment
Share on other sites

Hi Drew,

With sliding temperature, pH, fugacity, etc., the step size is consistent. Concentration is a little more complex because you’re setting up a titration path to add aliquots of mass at each step to change the concentration. Still, in most cases it’s pretty consistent.

Note for either axis you can choose whether to take linear steps or log steps. If you realize your diagram would best be plotted with a log axis, like those you’ve shown, you should take log steps so that the grid is more or less equally sized with the log scale. Otherwise, the points would be equally spaced when you plot Fe(II) concentration on a linear scale, but not the log scale. Please see section 7.4 Linear and log stepping in the GWB Reaction Modeling Guide, as well as example 7.9 Mineral solubility. 

You can make a cross-section plot in P2plot to see the spacing. In your case, choose “Across scanning paths” for Orientation, then plot Fe++ in system vs. Rxn progress(y), using log axes for both. You can show the data markers (Format menu > Quick Toggle… > check data markers) to see whether they're equally spaced.  

Sure, you could look in P2plot’s exported table for the first 0 value for Q/K of the mineral, or the first non-zero value for mineral mass. Or, you could make an assemblage or predominance diagram in P2plot to see how it should look, then use React to reproduce segments of the plot along the boundaries. For example, set the fluid in equilibrium with Fe(OH)2(s) and slide the pH to see how the solubility changes (plot composition of Fe++ component in the fluid). You can export that plot to a table to see the x and y values. Presumably this is what you did with Visual Minteq?


Link to comment
Share on other sites

Hi Brian,

I was able to figure this out yesterday using Igor Pro programming.

Yes, you are right on how Visual Minteq works to make a similar plot. Thanks for the other suggestions. It will be an interesting challenge to figure it out for a multi-mineral plot. Then on to an E-pH diagram...

I'm not sure if many folks use Igor Pro in the geochemistry world or not beyond our little bubble, but if so, here is my code. It isn't terribly pretty and I am sure there are things wrong with it, but I get the same graph out of the data as GWB.



Function findAssemblageLine(arrayData, xData, yData, nameOfOutputYWave, nameOfOutputXWave)

	WAVE arrayData //array data is an i row by j column table from the output of Geochemists Workbench "color map" outpu
	WAVE yData
	Wave xData
	String nameOfOutputYWave                         //Y data, usually concentration or activity of the y variable
	String nameOfOutputXWave                        //X data, pH 
	int arrayRow                                    // i rows in array data
	int arrayCol                                   // j columns in array data
	int waveOutYDimSize = DimSize(arrayData, 0)    // waveOutYDimSize is the number of points in the Y direction
	int waveOutXDimSize = DimSize(arrayData, 0)    // waveOutXDimSize has to be the number of points in the Y direction of the 

	MAKE /O/N=(waveOutYDimSize) $nameOfOutputYWave  //Make output Y wave (overwrites an existing wave)
	MAKE /O/N=(waveOutXDimSize) $nameOfOutputXWave  //Make output X wave (overwrites an existing wave)
	WAVE waveOutY = $nameOfOutputYWave             //Tie local wave to global wave names
	WAVE waveOutX = $nameOfOutputXWave
	//step through rows for loop
	for(arrayRow = 0; arrayRow < DimSize(arrayData, 0);arrayRow++)                     //ROW For loop
		for(arrayCol = 0; arrayCol < DimSize(arrayData, 1); arrayCol++)                 //INNER Column For loop
			if(arrayData[arrayRow][arrayCol] != 0 && arrayData[arrayRow][arrayCol+1] == 0) //Evaluate if point at (Row,Column) is not equil to zero and the next column in the row is equal to zero.
				waveOutY[arrayRow] = yData[arrayRow]                                       //Take the value of yData at arrayRow and put it into a new wave
				waveOutX[arrayRow] = xData[arrayCol+1]                                     //Take the value of xData at the next column over (i.e., the point where the value is 0) in put it into a new wave



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...