
As another option, the Asymptote
can handle bigger images.
p.asy
:
real unit=0.5mm;
unitsize(unit);
import graph;
import palette;
file fin=input("bigdata.dat");
real[][] v=fin.dimension(0,1310);
v=transpose(v);
int n=v.length;
int m=v[0].length;
write(n,m);
scale(Linear,Linear,Log);
pen[] Palette=
Gradient(
rgb(0,0,0.1)
,rgb(0,0,1)
,rgb(1,0,0)
,rgb(0,1,0)
,rgb(1,0.1,0)
,rgb(1,1,0)
);
picture bar;
bar.unitsize(unit);
bounds range=image(v, (0,0),(n,m),Palette);
palette(bar,"$A$",range,(0,0),(50,n),Right,Palette,
PaletteTicks(scale(10)*"$%0.1e$",pTick=black+5pt,Step=0.5e-6)
);
xaxis(0,m,RightTicks(scale(10)*"$%0f$",Step=200,step=100,beginlabel=false,black+5pt));
yaxis(0,n,LeftTicks(scale(10)*"$%0f$",Step=200,step=100,black+5pt));
add(bar.fit(),point(E),E);
The original 131x131
matrix data.dat
was scaled to 1310x1310
by this helper pre.asy
:
file fin=input("data.dat");
real[][] v=fin.dimension(0,131);
v=transpose(v);
int n=v.length;
int m=v[0].length;
real[][] w=new real[10n][10m];
file fout=output("bigdata.dat");
string s;
for(int i=0;i<10n;++i){
s="";
for(int j=0;j<10m;++j){
w[i][j]=v[rand()%n][rand()%m]*0.618+v[i%n][j%n]*0.382;
w[i][j]*=((real)(i+1)/10n+(real)(j+1)/10m)/2;
s=format("%#.5e ",w[i][j]);
write(fout,s);
}
write(fout,'\n');
}
Edit: There is nothing special in pre.asy
, it was used just to get
a bigger dataset bigdata.dat
(1310x1310
, about 20Mb
), to check
how asy
can handle it.
Btw, it the OP
already has the 1000x500
file, it would be better to try it instead.
Comments on pre.asy
:
file fin=input("data.dat");
real[][] v=fin.dimension(0,131); // read data file into the matrix v[][]
v=transpose(v);
int n=v.length; // n - number of rows
int m=v[0].length; // m - number of columns
This is a standard sequence to read a matrix from the data file.
Now, declare a new matrix w
, ten times bigger:
real[][] w=new real[10n][10m];
Declare the output file fout
and string s
:
file fout=output("bigdata.dat");
string s;
Next, there are C
-like for
loops to run through all indices of the new bigger matrix:
for(int i=0;i<10n;++i){
s="";
for(int j=0;j<10m;++j){
Now, put something into the current element w[i][j]
:
w[i][j]=v[rand()%n][rand()%m]*0.618+v[i%n][j%n]*0.382;
w[i][j]*=((real)(i+1)/10n+(real)(j+1)/10m)/2;
some random element of the original small matrix is used, but it can be anything.
In fact, it could be possible to calculate the entire matrix here, if the data
used by OP
are not coming from the sensors or use some really tricky algorithms.
s=format("%#.5e ",w[i][j]); // format the value
// according to scientific notation
// with 5 digits, e.g. `4.75586e-08`
write(fout,s); // write it to the file
}
write(fout,'\n'); // write a new line symbol
}
That's it.
And for the sake of comparison, this is the original 131x131
matrix,
with (natural) log
applied to the values,
and a palette similar (I hope) to colormap/bluered
in pgfplots:
real unit=0.5mm;
unitsize(unit);
import graph;
import palette;
file fin=input("data.dat");
real[][] v=fin.dimension(0,131);
v=transpose(v);
int n=v.length;
int m=v[0].length;
write(n,m);
for(int i=0;i<n;++i){
for(int j=0;j<m;++j){
v[i][j]=log(v[i][j]);
}
}
//\pgfplotsset{
//colormap={bluered}{
//rgb255(0cm)=(0,0,180); rgb255(1cm)=(0,255,255); rgb255(2cm)=(100,255,0);
//rgb255(3cm)=(255,255,0); rgb255(4cm)=(255,0,0); rgb255(5cm)=(128,0,0)}
//}
pen[] Palette=
Gradient(
rgb(0,0,180.0/255)
,rgb(0,1,1)
,rgb(100.0/255,1,0)
,rgb(1,1,0)
,rgb(1,0,0)
,rgb(128.0/255,0,0)
);
picture bar;
bar.unitsize(unit);
bounds range=image(v, (0,0),(n,m),Palette);
palette(bar,range,(0,0),(5,n),Right,Palette,
PaletteTicks(scale(1)*"$%0f$",pTick=black+0.5pt,Step=1,beginlabel=false)
);
xaxis(0,m,RightTicks(scale(1)*"$%0f$",Step=20,step=10,beginlabel=false,black+0.5pt));
yaxis(0,n,LeftTicks(scale(1)*"$%0f$",Step=20,step=10,black+0.5pt));
add(bar.fit(),point(E),E);

data.dat
to see the structure of data and how was it generated ?LuaLaTeX
as it has handle more points( memory capacity) than pdfLaTeX1. Also see Jake's Answer:pgfplot: plotting a large dataset1000x500
set (or some king of its draft), I can plot it with theAsymptote
(or you can try it yourself, with minor corrections to the answer with the plot ofbigdata.dat
).