Help plotting a graph

Hi all,

I have a text file of two columns (energy 1, energy 2). I need to plot E1 against E2. I did this in excel (as I have never programmed) but was told that the I need to do in something like C++ in order to see the intensities that wasn't apparent in the excel plot.

Can someone give a a starting point at where to begin? Is this an easy code to write.

New to coding and this forum.

Thanks in advance,

Chloe
If you just want to make a basic text graph
http://www.cplusplus.com/doc/tutorial/

Once your more familiar, you could make a graphical graph using a graphics library, SFML is my favorite for 2D
http://sfml-dev.org/tutorials/1.6/

EDIT: and is it easy to write? It all depends on what you are doing... but a bar graph should be fairly trivial, as long as you don't mind waiting up to a couple weeks.

Good luck!
Last edited on
Thank you. I only have a week!! I will try downloading SFML and try using that. Chloe
in order to see the intensities that wasn't apparent in the excel plot.
¿what does that mean? ¿how was the excel plot 'bad'? ¿what could you make to improve it (how is that your grapher will be better)?

Don't reinvent the square wheel
Its not clear what the OP wants but if I had a week to produce a plot I wouldn't start coding from scratch but first look around for software that has more graphical functionality than Excel and is freely available.

It is likely that the plot could be produced using R. This is a complicated bit of software but you can find graph recipes on the web and then mutate them towards the plot you want. http://www.r-project.org/

Only if it was something particularly special that you can't find any software to create would I code up. even then I would
use a scripting language, I have used perl GD for this but there are also python graphics libraries.
Last edited on
Thank you. Below is a link to how the plot should look
http://wikisend.com/download/760026/example.pdf

I will try using R. Thanks, Chloe.
Presumably the colours represent the density of points in that region of the scatterplot?

The R hexbin package can bin the data into hexagons and colour them by density of points in the hexagon.

I'm not sure how to do it if you must have squares.
Thank you. Squares aren't necessary. Can I import a text file directly into R? Chloe.
if you have your data in a text file, two columns tab separated, with column headers then

Data <- read.table(filename,header=TRUE,sep="\t")

will read your text file into the object Data. (read.table has a lot of options for various other possibilities)

Note: there is also the smoothScatter command which will give you a continuous colouring

then try

smoothScatter(Data$energy1,Data$energy2)

(assuming energy1 and energy2 are your data column headers)
Last edited on
Topic archived. No new replies allowed.