Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Aligning Graphs, accurancy problems

25 views
Skip to first unread message

T4b

unread,
Mar 30, 2012, 3:47:26 PM3/30/12
to
I'm using gnuplot (version 4.4.4 because it's in the ubuntu repos and
I couldn't get the newer one to compile) to generate a sun dial and
then export it to dxf.
In principle that works, but I have several things which I want to
improve:
-I can't align the graphs properly, I got them to align more or
less right but when looking at the dxf file very closely the origin of
the graphs are still a little off. How do I get all 30 graphs to have
exactly the same origin? (of course I'm not drawing 30 graphs
seperately, I'm using "for")
-When I open the dxf file in a cad program and zoom in very much
some graphs which should look like strechted eights look like polygons
or otherwise wrong. I'm not completely sure that this is not because
of a formula which gives slightly wrong results, but I'm quite sure it
isn't, because it doesn't happen for all the 10 graphs which I draw
with the same formula (iterating through a parameter using for).
-I wonder if there is a trick to get it to scale right? I would
like to be able to have the dxf units be centimeters or millimeters.
The code I use is as follows:
set terminal x11
set angles degrees
set notics
set border 0
set size ratio -1
set notitle
set multiplot
myrange=200
set xrange [-myrange:myrange]
set yrange [-myrange:myrange]
set trange [180:360]
abweichung=50;
breitengrad=47.507912;
laengengrad=7.927561;
von=10;
bis=20;
gnomon=50;
z(stunde)=atan(cos(breitengrad)/( sin(abweichung)*sin(breitengrad)
+cos(abweichung)/tan((stunde-12-((15-laengengrad)*4/60))*15) ) );
sonnendkl(tag)=sin(360*(tag-80)/365.25)*(23+13/30); #richtig
epsilon(winkel)=acos( sin(breitengrad)*cos(winkel)
+cos(breitengrad)*sin(winkel)*sin(abweichung) );
schattenlaenge(tag, winkel)= (gnomon*cos( sonnendkl(tag) )) /
cos( epsilon(winkel) + sonnendkl(tag) );
zeitgleichung(x) =
-7.771*sin((x-1.042)*0.986)-0.068*sin(2*(x-1.042)*0.986)+9.829*sin(2*(x
+10.507)*0.986)-0.229*sin(4*(x+10.507)*0.986) # usage: -zeitgleichung(x
+182.5) # 182.5 isn't exact # in minutes

plot [-50:50] [-50:50] for [stunde=von:bis] -x/tan(z(stunde)) with
lines linetype -1
#Bei Anzeige von MOZ statt MEZ/wasauchimmer muss die Mittagslinie
separat gezeichnet werden:
#set parametric
#plot [-myrange:myrange] 0,t linetype -1
#unset parametric

set polar

plot [180:360] for [tag=365.25/12*5+21:365.25/12*11+21:365.25/12]
schattenlaenge(tag, t-270) linetype -1

set parametric
set trange [0:365]
plot for [stunde=von:bis] z(stunde+(-zeitgleichung(t+182.5))/60)-90,
schattenlaenge(t, z(stunde+(-zeitgleichung(t+182.5))/60) ) linetype -1
unset parametric

unset multiplot

I hope someone can help me. Thanks in advance. :-)

sfeam

unread,
Apr 2, 2012, 5:46:31 PM4/2/12
to
T4b wrote:

> I'm using gnuplot (version 4.4.4 because it's in the ubuntu repos and
> I couldn't get the newer one to compile) to generate a sun dial and
> then export it to dxf.
> In principle that works, but I have several things which I want to
> improve:
> -I can't align the graphs properly, I got them to align more or
> less right but when looking at the dxf file very closely the origin of
> the graphs are still a little off. How do I get all 30 graphs to have
> exactly the same origin?

set lmargin at screen <fraction>
set rmaring at screen <fraction>
etc

See
http://gnuplot.sourceforge.net/demo_4.4/margins.html

T4b

unread,
Apr 3, 2012, 4:34:00 AM4/3/12
to
On 2 Apr., 23:46, sfeam <sf...@users.sourceforge.net> wrote:
> T4b wrote:
> > I'm using gnuplot (version 4.4.4 because it's in the ubuntu repos and
> > I couldn't get the newer one to compile) to generate a sun dial and
> > then export it to dxf.
> > In principle that works, but I have several things which I want to
> > improve:
> >     -I can't align the graphs properly, I got them to align more or
> > less right but when looking at the dxf file very closely the origin of
> > the graphs are still a little off. How do I get all 30 graphs to have
> > exactly the same origin?
>
> set lmargin at screen <fraction>
> set rmaring at screen <fraction>
> etc
>
> See
>    http://gnuplot.sourceforge.net/demo_4.4/margins.html

This doesn't seem to work. Maybe I'm just too stupid for it.
I added
set lmargin at screen 0.0
set rmargin at screen 1.0
set bmargin at screen 0.0
set tmargin at screen 1.0
at the beginning of the script because I want to use the entire
canvas.
Then I changed the range of one of the plots (I changed the line "plot
[-50:50] [-50:50] for [stunde=von:bis] -x/tan(z(stunde)) with
lines linetype -1" to "plot [-50:50] [-50:0] for [stunde=von:bis] -x/
tan(z(stunde)) with
lines linetype -1") and the graph was moved so it fits better onto the
canvas.

As I understand *margin, it just sets the borders of the graphs; what
I want is to fix the origin of all graphs to the same point on the
canvas.

sfeam

unread,
Apr 3, 2012, 11:17:02 AM4/3/12
to
Then I must not understand the question.
What do you mean by "origin" if not the lower left-hand border of the graph?

Are you saying that you want the point [0,0] to appear in the same place
even though the graphs have different range and scale, and that place is not
on the border of the graph? I can't think of a way to do that.


T4b

unread,
Apr 3, 2012, 12:59:59 PM4/3/12
to
With origin I mean the point [0,0], yes. The scale of all graphs is
supposed to be the same. [0,0] should be in the middle of the top
border of the canvas.
http://ubuntuone.com/0edmLjKcBKBOsOnyWMXpSa
On this picture I added a red dot where the origin is at the moment to
make this completely clear and I added a box around the area which I
would like to display.

And I remembdered something else which I wanted to ask: how do I get
rid of the text?

sfeam

unread,
Apr 3, 2012, 1:39:25 PM4/3/12
to
Sorry, I can't think of a way to do that automatically.

> http://ubuntuone.com/0edmLjKcBKBOsOnyWMXpSa
> On this picture I added a red dot where the origin is at the moment to
> make this completely clear and I added a box around the area which I
> would like to display.
>
> And I remembdered something else which I wanted to ask: how do I get
> rid of the text?

Either turn off the plot legend ("key") altogether using the command
unset key
or append "notitle" to the individual plot commands.


T4b

unread,
Apr 3, 2012, 3:17:05 PM4/3/12
to
That's a pity. Imo that's something which should be added to gnuplot.
It really limits the ways I can use it. Of course it's only maybe 10
minutes work to remove all the extra lines which I don't need in a CAD
program; but if I wanted to generate, let's say, 5 dials it would
already take almost an hour. Thank you for attempting to help me
anyway.
>
> >http://ubuntuone.com/0edmLjKcBKBOsOnyWMXpSa
> > On this picture I added a red dot where the origin is at the moment to
> > make this completely clear and I added a box around the area which I
> > would like to display.
>
> > And I remembdered something else which I wanted to ask: how do I get
> > rid of the text?
>
> Either turn off the plot legend ("key") altogether using the command
>     unset key
> or append "notitle" to the individual plot commands.

That works., thanks,

T4b

unread,
May 12, 2012, 12:48:56 PM5/12/12
to
Now I'm doing something else with gnuplot and I'm again annoyed that
those graphs aren't drawn in the same coordinate system:
set terminal x11
set multiplot
plot x*x
set parametric
plot 0.25, 0 with dots
unset multiplot
How would you do something like this? Is it really possible there is
no way to do this in gnuplot?
(the dot is supposed to be in the focus of the parabola)

Hans-Bernhard Bröker

unread,
May 15, 2012, 12:45:13 PM5/15/12
to
On 12.05.2012 18:48, T4b wrote:
> Now I'm doing something else with gnuplot and I'm again annoyed that
> those graphs aren't drawn in the same coordinate system:

Well, you _told_ gnuplot you wanted two completely independent
coordinate systems, which appears to be the opposite of what you
actually want. Short of implementing a mind-reading device, there's no
really anything gnuplot can do about such a mismatch.

> set multiplot
> plot x*x
> set parametric
> plot 0.25, 0 with dots
> unset multiplot
> How would you do something like this?

plot x*x, '-' notitle with dots
0.25 0
e

T4b

unread,
Jun 11, 2012, 10:17:27 AM6/11/12
to
Ah. Now I get it.
The thing gnuplot could do would be to write more beginner-friendly
tutorials. ;-)
Or maybe it's just me.
Thanks, anyway.
0 new messages