[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: print resolution in latex
From: |
Ben Abbott |
Subject: |
Re: print resolution in latex |
Date: |
Mon, 16 Jan 2012 12:12:42 -0500 |
*** please don't top-post. We prefer that replies are made at the bottom so
that those arriving late can follow along ***
On Jan 16, 2012, at 10:46 AM, Reza Housseini wrote:
> On Mon, Jan 16, 2012 at 2:40 PM, Ben Abbott <address@hidden> wrote:
>
>> On Jan 16, 2012, at 4:20 AM, Reza Housseini wrote:
>>
>> > Hello Octave user,
>> >
>> > I try to print area plots with up to 35040 data points for the epslatex
>> > device. But the generated .ps file in latex is huge (7.5MB), due to the
>> > octave print output. I tried to adjust the resolution with the -r option
>> > but this didn't work. Is there any other way to reduce the file size
>> > without manually reduce my input vector? There's no need that I see all
>> > the details over the 35040 points, is just to get the reader an impression
>> > of how the data looks like.
>> >
>> > Thanks a lot for the support,
>> >
>> > Best wishes,
>> > Reza
>>
>> Did you use the scattter() command to produce your plot ? This command
>> produces a patch object for each data point and can produce a very large
>> file (and slow plot updates).
>>
>> If you used that, you can try the plot command instead. Depending upon what
>> you want that may take some extra effort, but you can start with ...
>>
>> x = randn (1, 35040);
>> y = randn (1, 35040);
>> h = plot(x, y, "s");
>> set (h, "markerfacecolor", "auto")
>>
>> Gnuplot's markers are not implemented in a consistent way. So it may no
>> display as expected, but if you print it, you will get the expected result.
>>
>> print -depsc test.eps
>>
>> Using my example, the file size is 549 kB.
>>
>> If my guess that you're using scatter() is not correct, please give us more
>> information. If possible a simple script that demonstrates the problem would
>> be helpful.
>>
>> Ben
>
> Hello Ben,
> Thank you for the answer. I used the area plot function, here a small example:
>
> Y = randn (4, 35040);
>
> area(Y)
> set(gca,"Layer","top")
> grid on
>
> print("test.tex","-dtex","-S1000,400");
>
> So I want to stack the different vectors on each other and color the areas in
> between. With this approach however the files are large. Up to 5MB.
> I just wondered if there is an technique to reduce the generated data,
> because in this way there's no use for a report due to much too large file
> sizes.
>
> Reza
If a bitmap is acceptable, Jaun's advice is a quick and easy solution.
If it isn't acceptable, you can try to prune the area curve. The area curve is
actually a patch object.
N = 100;
figure (1)
clf
h = area (rand (1, N));
hp = findobj (h, "type", "patch");
xdata = get (hp, "xdata");
ydata = get (hp, "ydata");
cdata = get (hp, "cdata");
n = union (1:10:numel(xdata),[1:2, N+(1:2), 2*N+(0:1)]);
figure (2)
clf
patch (xdata(n), ydata(n), cdata)
This doesn't work so well for random data, but does it do what you want ?
Ben