Reputation: 111
I'm running Octave 3.6.4 on a Windows 7 system.
I'm having a hard time saving plots as .png files. Plots that are somewhat complex (several subplots, lots of legends, 1.6 million datapoints) can only be saved using an very large image size, and even that works only sometimes.
A specific example (with titles and axis labels left out):
figure (11)
clf ;
subplot (1,2,1) ;
plot (ratingRepeated, (predictions - Ymean)(:), ".k", "markersize", 1) ;
axis([0.5 5.5 -4 8]) ;
grid("on") ;
subplot (1,2,2) ;
plot (ratingRepeated, predictions(:), ".k", "markersize", 1) ;
axis([0.5 5.5 -4 8]) ;
grid("on") ;
Generates a nice plot with millions of datapoints. But using:
print -dpng figure11
creates an image containing only a small portion of the plot. Sometimes it helps using a very large image like this:
print -dpng "-S3400,2400" figure11
But mostly Octave just stalls, then crashes after CTRL+C.
I have without success tried:
Some minor but possible related issues are: Danish characters won't show up; extremely slow performance with plots taking several minutes to display and/or save.
Any advice would be greatly appreciated.
Upvotes: 2
Views: 968
Reputation: 13081
I would argue that you are trying to fix the problem in the wrong way. You have too many data points and a normal scatter plot, like what you are trying to do, will not give you a good display of the distribution of data. Instead, use some sort of density plot. Just compare this two:
x = vertcat (randn (2000000, 1)*3, randn (1000000, 1) +5);
y = vertcat (randn (2000000, 1)*3, randn (1000000, 1) +5);
plot (x, y, ".")
pkg load statistics;
data = hist3 ([x y], [100 100]);
imagesc (data)
axis xy
colormap (hot (124)(end:-1:1,:)) # invert colormap since hot ends in white
You can use one the the existing colormaps (see colormap list
) or create your own. The most common is jet (not for being good but because it's the default)
colormap (jet (124))
Upvotes: 1