Gnuplot Scripts

Posted on
Tue Jun 30, 2015 9:05 am
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Gnuplot Scripts

Glad to hear that you at least figured out what was wrong!

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Tue Jun 30, 2015 9:26 am
SSteve offline
User avatar
Posts: 84
Joined: Sep 12, 2012
Location: Sierra Foothills, California

Re: Gnuplot Scripts

Here's the current result:

IMG_0186.PNG
IMG_0186.PNG (284.24 KiB) Viewed 6814 times


I'll work on the forecast icons next.

During these hot days it makes it easy to know when it's cooler outside than inside so we can open all the windows. It's much more convenient than going to the computer and finding the temperatures in Indigo. The great thing about this is that my wife, who is technically challenged, is happy to use it.

Posted on
Tue Jun 30, 2015 10:31 am
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Gnuplot Scripts

Now you're cooking.

I still find myself tweaking these things all the time. It's a sickness, really.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Tue Jun 30, 2015 10:43 am
SSteve offline
User avatar
Posts: 84
Joined: Sep 12, 2012
Location: Sierra Foothills, California

Re: Gnuplot Scripts

DaveL17 wrote:
Now you're cooking.

I still find myself tweaking these things all the time. It's a sickness, really.


Yeah, I already tweaked mine twice after that post. I updated the post with the first tweak (day of the month) then I changed the x axis on the top plot to have labels at every six hours. But then I had to stop to go to work.

BTW, I used %d to add the day number but it had a leading zero. There was no format specifier for day without leading zero like there is for hours. But I found that using %1d (that's the numeral one) eliminated the leading zero when the day is less than 10 and uses two digits for 10 and greater.

Posted on
Sun Jul 12, 2015 11:43 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: Gnuplot Scripts

I have problems with GNUPLOT V5.0 with polar coordinates. The grid lines are completely screwy. Any one using Polar plots?

should look like straight lines.


Karl
Attachments
polar-minute-S1.png
polar-minute-S1.png (8.22 KiB) Viewed 6765 times
Last edited by kw123 on Mon Jul 13, 2015 12:06 am, edited 1 time in total.

Posted on
Sun Jul 12, 2015 11:52 pm
SSteve offline
User avatar
Posts: 84
Joined: Sep 12, 2012
Location: Sierra Foothills, California

Re: Gnuplot Scripts

kw123 wrote:
I have problems with GNUPLOT V5.0 with polar coordinates. The grid liens are completely screwy. any one using Polar plots?

should look like straight lines.

Karl

Can you include some source code?

Posted on
Mon Jul 13, 2015 12:04 am
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: Gnuplot Scripts

in gnuplot 4.6 it looks like this:
polar-minute-S1.png
polar-minute-S1.png (9.52 KiB) Viewed 6779 times


and here the source code same for both.
Code: Select all
set datafile separator ";"
set output '/Users/karlwachs/Plots/polar-minute-S1.png'   
set terminal png truecolor enhanced  medium  size 350,350 dashlength 0.5      background rgb "#FFFFFF"

set key textcolor rgb "#000000"
unset xlabel
unset ylabel
unset ytics
unset xtics
unset border
set polar
set angles radian
set clip
set style line 100 lt 0 lw 1 linecolor rgb "#000000"
set grid polar 0.523598775598 back ls 100
set format r "%0.f"
set rtics (1,2,3,4,5)
set rrange [0:5]   
set label "N" at +0.25,+4.875 center textcolor rgb "#000000"
set label "E" at +4.85,-0.45 center textcolor rgb "#000000"
set label "S" at -0.25,-4.75 center textcolor rgb "#000000"
set label "W" at -4.85,+0.25 center textcolor rgb "#000000"
set for[i=0:330:30] label sprintf("%d",i) at 5.0*cos((450 -i)*0.0174532925199),  5.0*sin((450-i)*0.0174532925199) center  textcolor rgb "#000000"
set label "x-axis Text" at 4.8816,0.2375 center textcolor rgb "#000000"
plot '/Users/karlwachs/Documents/INDIGOplotD/data/minute.dat'\
  using 76:70  with points linetype 0   linewidth 2.0 linecolor rgb "#FF0000"  title ""    axis x1y1\

Posted on
Mon Jul 13, 2015 5:58 am
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Gnuplot Scripts

Hi Karl. When I delete "lt 0" from the "set style line 100..." line, the grid appears normal. Something changed there apparently in 5.0.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon Jul 13, 2015 5:00 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: Gnuplot Scripts

Indeed some of the basics have changed

-Linetype
-Time in seconds was since millennium now since epoch

My gnuplot 5.0.0 works but with 5.0.1 I get a "segmentation error" when I start gnuplot.
Anyone using 5.0.1?


http://www.gnuplot.info/ReleaseNotes_5_0_1.html



Sent from my iPhone using Tapatalk

Posted on
Mon Jul 13, 2015 5:53 pm
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Gnuplot Scripts

I'm still on 5.0.0.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon Jul 13, 2015 6:17 pm
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Gnuplot Scripts

Karl - now you have me distracted with trying to come up with a polar graph for my weather pages. I'm close, but am stuck on two fronts.

(1) I want to hide the 'r' axis, but I can not find a way. In the image below, you'll see that it's affecting the axis on the East. I can get close, but you'd think it'd be possible to hide it completely.
(2) I want to rotate the plot area so that 0 degrees is up (rather than to the right) and have the plot go clockwise instead of counterclockwise. I know that you went with radians over degrees...

I can fudge the second one by formatting my plot data to display properly, but that seems to be a kludge rather than an answer. I'd appreciate any pointers you might have.
Dave

Code: Select all
#! /usr/bin/env gnuplot
# -*- coding: utf-8 -*-

reset
source = "/Users/.../Dropbox/Public/chartsTest.csv"
set datafile separator ","
set output '/Users/.../Dropbox/Public/chartsTest.png'   
set terminal pngcairo truecolor enhanced size 500,500 font "Lato Light,11" dashlength 0.5 background rgb "#000000"

unset xtics
unset xlabel
unset ytics
unset ylabel

unset border
unset key

set angles degrees
set polar
set size square

set clip
set style line 100 lw 0.75 lc rgb "#444444"
set grid polar 45 back ls 100
set rtics (5,10,15,20) offset -1.5,1.5 tc rgb "#444444"
set rrange [0:20]

set tmargin 2.5
set lmargin 5
set rmargin 5
set bmargin 2.5

set label "N"  at +00.0,+21.0 center tc rgb "#FFFFFF"
set label "NE" at +15.0,+15.0 center tc rgb "#FFFFFF"
set label "E"  at +21.0,+00.0 center tc rgb "#FFFFFF"
set label "SE" at +15.0,-15.0 center tc rgb "#FFFFFF"
set label "S"  at +00.0,-21.0 center tc rgb "#FFFFFF"
set label "SW" at -15.5,-15.5 center tc rgb "#FFFFFF"
set label "W"  at -21.0,+00.0 center tc rgb "#FFFFFF"
set label "NW" at -15.0,+15.0 center tc rgb "#FFFFFF"

plot source using 1:2 with points pointtype 7 lw 2.0 lc rgb "#FF0000"
Attachments
chartsTest.png
chartsTest.png (26.91 KiB) Viewed 6707 times

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon Jul 13, 2015 8:29 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: Gnuplot Scripts

Sure. I am out. Will send you what I have when I am back.
Looks like you like black backgrounds.
You could mirror the numbers to rotate counter clockwise. But that's not just *-1.
+pi should do it but then you might get over 2pi then you need to subtract 2pi if greater. Also just move it up add pi/4. The same is true if you use degrees. Replace pi->180 etc.


Sent from my iPhone using Tapatalk

Posted on
Mon Jul 13, 2015 8:31 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: Gnuplot Scripts

Also if you want average several measurements in degrees(pi) it gets really ugly. Took me many days to figure than one out


Sent from my iPhone using Tapatalk

Posted on
Mon Jul 13, 2015 8:48 pm
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Gnuplot Scripts

kw123 wrote:
Sure. I am out. Will send you what I have when I am back.

Thanks Karl. I appreciate anything you can do (when you have time.)

Looks like you like black backgrounds.

Works with the major theme of my control pages. :D

You could mirror the numbers to rotate counter clockwise. But that's not just *-1.
+pi should do it but then you might get over 2pi then you need to subtract 2pi if greater. Also just move it up add pi/4. The same is true if you use degrees. Replace pi->180 etc.

Yeah, it just doesn't seem as simple as it should be.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon Jul 13, 2015 11:15 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: Gnuplot Scripts

When you want to average consider the following example

1. measurement: 0 Degree 1000 miles/ hour
2. measurement: 90 Degree 0 miles/hour

what is the average?
45 Degrees 500 miles/hour
or
~0.1 degrees 500 miles/ hour

first one is a 2 dimensional independent average, the other is a vector average...
From a physical point of view #2 is correct, but a little bit more complicated
This is an extreme example but makes it clearer.

for #1 you average R and phi independently

for # 2 you could do: convert to xy coordinates( x1= r1* cos(phi1), y1=r1*sin(phi1) (and same for x2,y2) and then average x=(x1+x2)/2 and y=(y1+y2)/2 (you use this for any number of measurements) and then back to R,phi (R=sqrt(x**2+y**2) , phi = arcos(x/R) ...( I believe that is correct) you could use that way also for #1 with r=1

for math convention( 0degrees=right, counter clockwise) to compass convention (north up clock wise)
phi = (360-phi +90)%360
(360-phi goes from counter clock wise to clock wise
+90 puts north up
%360 gets it back into range 0-360)

And you could use pi instead of 180 and 2pi=360, just the same.

hope that helps.

will look at the gnu part tomorrow

Karl

Page 6 of 10 1 ... 3, 4, 5, 6, 7, 8, 9, 10

Who is online

Users browsing this forum: No registered users and 2 guests