|
From: sfeam <me...@uw...> - 2018-11-07 06:26:12
|
On Tuesday, 06 November 2018 20:46:31 Dima Kogan wrote:
>
> Ethan Merritt <me...@uw...> writes:
>
> >> I have a very VERY non-square image file (attached). This is a 4000x20
> >> png. I want to use gnuplot to plot it with a square aspect ratio. (In my
> >> actual use case, I'd plot stuff on top of it). I do this:
> >>
> >> set size ratio -1
> >> plot "wide.png" binary filetype=auto with rgbimage
> >>
> >> Normally this works, but with such a wide image the "set size ratio -1"
> >> doesn't work: the image is scaled to fill the plot, and I get very tall
> >> and very skinny pixels.
> >
> > I do not understand the problem.
> > Of course the pixels are very tall and skinny, since there are 4000
> > of them in one direction and only 20 in the other.
>
> Hi.
>
> I want a square aspect ratio of the thing being plotted (size ratio -1).
> This means:
>
> - square pixels
> - the image rendered by gnuplot should thus look like the input image:
> it should be very wide; i.e. not square
Ah, I understand now.
Yes there is a sanity check on the aspect ratio that limits it to a
ratio of 1:100. That code dates waayyy back and I don't know what
logic went into deciding this was the limit.
You could try changing it to, say, 1:1000.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/src/boundary.c b/src/boundary.c
index b096410..85a7f20 100644
--- a/src/boundary.c
+++ b/src/boundary.c
@@ -629,7 +629,7 @@ boundary(struct curve_points *plots, int count)
/* Set aspect ratio if valid and sensible */
/* EAM Mar 2008 - fixed borders take precedence over centering */
- if (current_aspect_ratio >= 0.01 && current_aspect_ratio <= 100.0) {
+ if (current_aspect_ratio >= 0.001 && current_aspect_ratio <= 1000.0) {
double current = ((double) (plot_bounds.ytop - plot_bounds.ybot))
/ (plot_bounds.xright - plot_bounds.xleft);
double required = (current_aspect_ratio * t->v_tic) / t->h_tic;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cheers,
Ethan
>
> The other mode is "size ratio 1" (or equivalently "size square"), which
> sets a square aspect ratio on the resulting image by making the pixels
> non-square.
>
> I'm attaching a less skewed image, so that you can see that "size ratio
> -1" is indeed the right thing. The issue here is that gnuplot behaves
> differently with the extra-wide image.
>
>
|