If your data is gridded (but just in vector form), then likely you could just "zmat = reshape(z, numrows, numcols)" and then "contour(zmat)".
On Mon, May 16, 2016 at 11:49 AM, <ameliafitzsimmo...@gmail.com> wrote: > Yes, my data is gridded. And no, I don't plan to sample these density > values later. I just want to plot it and see what it looks like :) I'm not > sure how to reshape the data into a 2D array though, or how to make a > contour plot from a dataset rather than from a function. Is there anything > on this in the documentation? > > Thanks for your help, > > Amelia > > > On Friday, May 13, 2016 at 8:30:36 PM UTC-4, Scott T wrote: >> >> Two key questions - is your data gridded? And do you plan to sample from >> these density values later, or are you just wanting to plot it and see what >> it looks like? >> >> If your data is gridded (your ~10000 lines cover every combination of x >> and y values in the range that you are interested in), then you can use the >> contour command in Gadfly, which is the volcano plot you described. You'll >> first need to reshape the data so it's a 2D array: think of it as >> displaying a 2D image, where the number at each point is the density. >> However, for displaying this kind of data, I prefer heatmaps, and I don't >> know if Gadfly supports those - you may have to look into the histogram2d >> command. >> >> If it is not gridded (the x and y points don't have any particular >> structure to them), it's still possible, but you have to choose a way to >> decide how you want to turn it from unstructured data into a 2D image. The >> histogram2d approach that Tom showed above is one option, where you treat >> each density measurement as a weighted measurement in a histogram. But if >> your data represents single measurements of a function that has meaningful >> values away from those measured points, you probably want to interpolate >> between those points. For this you can use a package like Dierckx, which >> does interpolations on unstructured data. I also have some simple code that >> does barycentric triangular interpolation between unstructured points, in >> case you wanted to have a look at that. >> >> This may be overkill, however, if you just want to look at the data and >> don't plan to interpolate or draw from those density values later. If >> that's the case, the trisurface plot above might be just what you need for >> showing you the shape of your density data. >> >> Whatever you choose, I can recommend Tom's Plots package as a nice >> interface to the other plotting packages in Julia - it makes it easy to >> switch between different plotting options like Gadfly and PyPlot depending >> on what features they offer. >> >> Cheers, >> Scott >> >> On Friday, 13 May 2016 15:34:19 UTC+1, ameliafit...@gmail.com wrote: >>> >>> Dear Julia users, >>> >>> I have a rookie question about plotting in Gadfly. I have some density >>> data in a plain-text file in the form of x y d, where d is the density at >>> the point (x,y). I have about 10,000 lines of this data. I'm currently >>> plotting old-school using gnuplot and since I don't like the looks of what >>> I've been able to make, I'm hoping to be able to do something more elegant >>> like Gadfly. I'm a relatively new Julia user as well. I like the "volcano" >>> contour plot from the Gadfly documentation ( second plot from the top at >>> http://dcjones.github.io/Gadfly.jl/geom_contour.html). I'm just not >>> sure how to go about it. >>> >>> Has anyone done something like this before? I think it could be a really >>> beautiful way to represent my data if I can get it to work. Any hints or >>> suggestions would be greatly appreciated! >>> >>> Cheers, >>> >>> Amelia >>> >>