CosmoMC: Octave plots from the output files

 Posts: 6
 Joined: July 01 2005
 Affiliation: Department of Theoretical Physics, University of Geneva
CosmoMC: Octave plots from the output files
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?
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?

 Posts: 144
 Joined: September 24 2004
 Affiliation: University College London (UCL)
 Contact:
CosmoMC: Octave plots from the output files
It would be great to have some nice nonmatlab 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.)
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.)
CosmoMC: Octave plots from the output files
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/codeIt would be great to have some nice nonmatlab tools for analysing sets of MCMC samples.

 Posts: 87
 Joined: February 24 2005
 Affiliation: Institute of Astronomy, Nicolaus Copernicus University
 Contact:
Re: CosmoMC: Octave plots from the output files
Starting from www.octave.org and clicking on "docs" gets quickly to: Three dimensional plotting in octaveSarah 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.)
octave wrote: 17.3 ThreeDimensional Plotting
The Matlabstyle threedimensional 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.

 Posts: 144
 Joined: September 24 2004
 Affiliation: University College London (UCL)
 Contact:
CosmoMC: Octave plots from the output files
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, 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.

 Posts: 87
 Joined: February 24 2005
 Affiliation: Institute of Astronomy, Nicolaus Copernicus University
 Contact:
Re: CosmoMC: Octave plots from the output files
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 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.

 Posts: 144
 Joined: September 24 2004
 Affiliation: University College London (UCL)
 Contact:
CosmoMC: Octave plots from the output files
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).
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).

 Posts: 45
 Joined: September 24 2004
 Affiliation: LudwigMaximiliansUniversity Munich
 Contact:

 Posts: 87
 Joined: February 24 2005
 Affiliation: Institute of Astronomy, Nicolaus Copernicus University
 Contact:
Re: CosmoMC: Octave plots from the output files
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.Sarah Bridle wrote:Sure. e.g. the bottom two plots of
http://www.sarahbridle.net/cosmologui/s ... logui.html
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
rbase
Code: Select all
aptitude install rbase
Hopefully sometime i'll have the time to start learning it...