CosmoMC: Octave plots from the output files

Use of Healpix, camb, CLASS, cosmomc, compilers, etc.
Post Reply
Rajeev Kumar Jain
Posts: 6
Joined: July 01 2005
Affiliation: Department of Theoretical Physics, University of Geneva

CosmoMC: Octave plots from the output files

Post by Rajeev Kumar Jain » July 14 2006

Hi,
Can anybody tell me whether I can use OCTAVE to plot the output files that I got by running COSMOMC as I don't have MATLAB.
If yes, what do I need to do?
How do I make 2d and 3d plots using OCTAVE?

Sarah Bridle
Posts: 144
Joined: September 24 2004
Affiliation: University College London (UCL)
Contact:

CosmoMC: Octave plots from the output files

Post by Sarah Bridle » July 14 2006

It would be great to have some nice non-matlab tools for analysing sets of MCMC samples.
I don't know octave well enough to help you properly, but I recall from my brief use of it, you should be able to get something scientifically useful from octave for this problem.
Can you read the samples files in?
I don't think you can make 3d plots in octave, but can definitely do 2d.
Can you make the 1d plots fine? (So I can understand what you want help with.)

Joe Zuntz
Posts: 9
Joined: October 22 2004
Affiliation: UCL

CosmoMC: Octave plots from the output files

Post by Joe Zuntz » July 17 2006

It would be great to have some nice non-matlab tools for analysing sets of MCMC samples.
I have a version of GetDist that produces simple plotting codes for PyLab, the python plotting code with a similar syntax to matlab. The code and instructions are at http://astro.imperial.ac.uk/~jaz/code

Boud Roukema
Posts: 86
Joined: February 24 2005
Affiliation: Torun Centre for Astronomy, University of Nicolaus Copernicus
Contact:

Re: CosmoMC: Octave plots from the output files

Post by Boud Roukema » July 25 2006

Sarah Bridle wrote: I don't think you can make 3d plots in octave, but can definitely do 2d.
Can you make the 1d plots fine? (So I can understand what you want help with.)
Starting from www.octave.org and clicking on "docs" gets quickly to: Three dimensional plotting in octave
octave wrote: 17.3 Three-Dimensional Plotting

The Matlab-style three-dimensional plotting commands are:

— Function File: mesh (x, y, z)

Plot a mesh given matrices x, and y from meshdom and a matrix z corresponding to the x and y coordinates of the mesh. If x and y are vectors, then a typical vertex is (x(j), y(i), z(i,j)). Thus, columns of z correspond to different x values and rows of z correspond to different y values.

See also: meshgrid, contour.

— Function File: [xx, yy, zz] = meshgrid (x, y, z)
— Function File: [xx, yy] = meshgrid (x, y)
— Function File: [xx, yy] = meshgrid (x)

Given vectors of x, y, and z coordinates, return three dimensional arrays corresponding to the x, y, and z coordinates of a mesh. Given only x and y, return matrices corresponding to the x and y coordinates of a mesh. The rows of xx are copies of x, and the columns of yy are copies of y. If y is omitted, then it is assumed to be the same as x.

See also: mesh, contour.

— Function File: meshdom (x, y)

Given vectors of x and y coordinates, return two matrices corresponding to the x and y coordinates of the mesh.

Note: this function is provided for compatibility with older versions of Matlab. You should use meshgrid instead.

So the answer is: yes, you can make 3d plots in octave, using old matlab style commands. However, it is recommended in octave to use meshgrid rather than mesh.

Sarah Bridle
Posts: 144
Joined: September 24 2004
Affiliation: University College London (UCL)
Contact:

CosmoMC: Octave plots from the output files

Post by Sarah Bridle » July 25 2006

I guess it depends what is meant by "3d".
Boud, I agree that the meshgrid plots you describe exist in 3 dimensions e.g. could plot x, y and likelihood like this.
In matlab you can also do plots with x,y,z *and* likelihood. Whether you call this 4d or 3d I don't know. I think you can't do this in octave, but don't know if this is a problem for many people.

Boud Roukema
Posts: 86
Joined: February 24 2005
Affiliation: Torun Centre for Astronomy, University of Nicolaus Copernicus
Contact:

Re: CosmoMC: Octave plots from the output files

Post by Boud Roukema » July 25 2006

Sarah Bridle wrote:I guess it depends what is meant by "3d".
Boud, I agree that the meshgrid plots you describe exist in 3 dimensions e.g. could plot x, y and likelihood like this.
In matlab you can also do plots with x,y,z *and* likelihood. Whether you call this 4d or 3d I don't know. I think you can't do this in octave, but don't know if this is a problem for many people.
Hi Sarah, could you give the name of the function in matlab and maybe an example plot? i'm not going to buy a copy of matlab, so I can't search for it myself. i'm curious what these plots would look like (projected on a 2D screen, of course ;).

Sarah Bridle
Posts: 144
Joined: September 24 2004
Affiliation: University College London (UCL)
Contact:

CosmoMC: Octave plots from the output files

Post by Sarah Bridle » July 25 2006

Sure. e.g. the bottom two plots of
http://www.sarahbridle.net/cosmologui/s ... logui.html
Also there are movies there. But indeed no 3d glasses..
Great if you can find some way of doing this in octave (a colored scatter plot like the 3rd plot from the bottom of the above page would also be almost as useful).

Jochen Weller
Posts: 45
Joined: September 24 2004
Affiliation: Ludwig-Maximilians-University Munich
Contact:

CosmoMC: Octave plots from the output files

Post by Jochen Weller » July 27 2006

Another nice program to use for this would be R

http://www.r-project.org/

Boud Roukema
Posts: 86
Joined: February 24 2005
Affiliation: Torun Centre for Astronomy, University of Nicolaus Copernicus
Contact:

Re: CosmoMC: Octave plots from the output files

Post by Boud Roukema » July 28 2006

Sarah Bridle wrote:Sure. e.g. the bottom two plots of
http://www.sarahbridle.net/cosmologui/s ... logui.html
OK, in that case I would call that a 3D plot with one 2D contour, though it does represent 4D information in the same sense that a traditional 2D plot with 1D contours represents 3D info.

I didn't find any obvious general octave routine for plotting one or more 2D contours in a 3D plot - probably time to write one and contribute it back to the community under the GPL so that nobody can take it and lock it up. :)

BTW, the package name for anybody wishing to install R in debian is:

Code: Select all

r-base
. Try

Code: Select all

aptitude install r-base
. :)

Hopefully sometime i'll have the time to start learning it...

Post Reply